Telerik MVC Grid - Client Side Object Model for Databinding Urls - jquery-ui-dialog

Are the data binding Urls encapsulated in the Telerik MVC Grid Client Side object?
Scenario is;
I'm tapping in to a onSave client side event for some validations. After validations are passed I need to post to Insert Databinding Url conditionally based on user confirmation.
NOTE : I can't use javascript confirm to hold the thread as I'm using jQuery UI dialog for confirmation

The insert url is exposed as ajax.insertUrl:
var grid = $("#Grid").data("tGrid");
var insertUrl = grid.ajax.insertUrl;

Related

How to create telerik RadTextbox dynamically from client side on button click

Is there anyway to create RadTextbox dynamically from client side like the ordinary html textbox like this.
$(document).ready(function(){
$("#btnCreateTextBox1").click(function(){
$("", {type: "text", "class": "numeric" }).appendTo('#container');
});
});
Here it is an client side control it is creating but what about for the server control like RadTextbox or asp.net textbox control.
There really isn't a way to take a server control such as the RadTextBox and dynamically create it on the client. Taking a look at your specific example the reason this works is because, as you mentioned, you are creating a regular HTML element and not a complex control with potentially several HTML elements and server-side API.
You could of course instantiate the RadTextBox dynamically on the server-side or just use the markup approach for the non-dynamic way. You can then interact with the control via it's client-side objects as mentioned in this documentation article.

jquery ajax and asp.net data entry form

I have a pretty big data entry form which has many text fields which are dynamically added on the browser by the user. So i can not use server side controls such as asp:TextBox.
What would be the best way to submit the form and capture all the data on the server side?
I use asp.net 3.5 (web forms)
register a hidden field in your asp net page
put your changes on client side into it.
load hidden field in postback
VALIDATE SOOO MUCH!

asp.net gridview ajax

In Ajax,is there any technique exist to validate ASP.NET GridView, i.e., to check whether the GridView contains at least one row?
Any comments welcomed.
I assume you render the GidView on the page. If I get you can check it using Javascript/jQuery on client side...
If you want to check it on the server side you have to call a method on the .aspx page using Ajax. In this case you should create a static web method on the page that check how many rows the gridview has got then you have to call that method using Ajax or jQuery
http://www.singingeels.com/Articles/Using_Page_Methods_in_ASPNET_AJAX.aspx

jQuery to bind data to ASP.NET DataList using a ashx handler

Using jQuery how do I bind data from a call to a asp.net ashx handler to a datalist?
Simple answer : You don't. A datalist is server side and jQuery is all local.
Complex answer : You can use jQuery to allow the user to interact with controls and displays locally. You can also use jQuery to update your data store (SQL). Then you can reload the data into a server side varable from the data store inthe code behind.

Using JSON or postback method?

I need to develop a page which has 2 dropdownlist.
Options of dropdownlist 2 are based on selection of dropdownlist 1.
I have 2 methods to change the dropdownlist 2. What will you choose?
1:
Postback when users select dropdownlist 1 and change dropdownlist 2.
Pros:
Can use the postback feature, can use the asp.net validator
Cons:
Need to communicate with server (more traffic)
Users will see the page loading in the status bar.
2:
Get all the data (not very much data) in a JSON object when loading the page and change the dropdownlist 2 using javascript.
Pros:
Don't need to communicate with server(less traffic)
Cons:
Can't use the postback feature and validator and more troublesome to write server validation.
Also, I usually write the JSON object to the page as follows:
var locations = <asp:Literal runat="server" id="litLocation" text="[]" />
And then set the "litLocation" in page_load after the data is processed by datacontractjsonserializer.
Do you do it in the same way?
I prefer the second option, no need to reload the whole page just to refresh one dropdown list. I'd also do the client side dev in jQuery, much easier. You can do the client side validation for the change event of the first dropdown in jQuery as well, and keep the form submit validation in ASP.NET.
Have a look at the selectChain plugin for jQuery (demo's etc here).
Why not have your javascript call the server when the select box is clicked on, using a GET method, and fill in the select box, using json as the response, then, when an option is picked then fill in the second select box with another ajax request.
This would be scalable, in that if you want to add more options you just change the server, and everything is centralized.
You will need to validate when the form is submitted anyway, as it is possible to change a value of a form to something illegal using some debugging tools, such as Firebug, so never trust anything from a webpage until you have validated it.
So, no point worrying about the validation until the form is actually submitted.

Resources