I want to make a cascading dropdown list without using an UpdatePanel. I need tips for starting out this task. Currently,
I am using asp.net 2.0
Will I be able to parse JSON in VSS 2005 if I use JQuery ?
What is the recommended alternate for UpdatePanel in Visual Studio 2005 ?
If you use web forms , an alternative way is to create PageMethods and call them from JavaScript and fill the select with jQuery.
I will recommend jquery.Create a webservice in your project and call the webservice from jquery and parse the json result on UI.
Check out this link.
If you have any doubt let me know.
Related
Does anyone have, or could point me to, an example of using jQuery to page through an ASP.NET datagrid control?
I would like to page through a large set of data displayed by an ASP.NET DataGrid control however I would like to avoid a page refresh and hence want to use AJAX to get the new sets of data. I would also like to avoid the ASP.NET AJAX toolkit and would like to do it all using jQuery-AJAX. Thank you.
The DataGrid is a server side control that relies on postbacks. jQuery and AJAX are client side technologies. Write a AMSX or WCF service to serve up your data and consume it with jQuery. You can use jQuery templates to make things easier. Or wrap the DataGrid in an UpdatePanel and you will have the poor man's AJAX(sometimes called AJAH).
There may be a jQuery plugin to help with this.
Here's a nice article to get you started:
Easily build powerful client-side AJAX paging, using jQuery
Try using jGrid, it´s free, but there are commercial dotnet implementations available.
It´s quite powerfull,you can do almost everything with it. And loading your data is easy to. But, you have to forget the Idea of aspnet datagrid, unless you will use updatepanel(which is very stable and usefull and has nothing to do wiht asp net ajax toolkit)
Does JSON, JQuery & ASP.NET 2.0 webforms go together or is it only preferred in MVC with ASP.NET 3.5 & 4.0?
While using JSON, would gridviews and repeaters controls be of any use (binding with JSON data) or do I format the results in custom tables myself ?
Would my business object classes still be of any use while using JSON ?
What is the ideal combination for JSON with ASP.NET (JQuery+ASP.NET AJAX+ JSON) ?
5.Can anyone post me a link/code snippet of simple CRUD application with JSON and ASP.NET webforms ?
Thank you.
I would really recommned you to move on to MVC, since it is far more better than ASP.NET Webforms. but still here are my answers to your questions.
yes, they can easily be used together, and they will make user experience more richer than simeple ASP.Net.
You can use JTemplates, Mustache script and other scripts for binding with JSON data. and you would never require GridView or Repeater control for this.
yes, they would be useful to some extent. but most probably your business logic will be exposed on client side, when working with jquery, json and ajax.
your data will be in JSON format, and ASP.NET will be used as backend layer. AJAX will be used to call ASP.NEt pages/handlers to fetch data from database asynchronously. adn you can use jquery for manipulating data on clientside and then display on the UI.
Sorry, I could not find any such link over google. let me search more, I might find one to share with you.
a reminder:
Even the framework makes them look working in same scope, ASP .NET & javascript(jQuery, JSON) lives in thier own scopes. ASP .NET(back end) generate nothing more than html, css, javascript to browers(front end). Then, browers interpret the html, javascript, css. They don't really work together. Also, JSON is nothing fancy than a notation as its name(JavaScript Object Notation)
e.g.
code:
$("#<%= Textbox1.ClientID %>").val("mywork");
what really happens in html
$("#Textbox1").val("mywork");
I've used JSON & JQuery in an ASP.NET website quite successfully. (non-MVC)
You can bind JSON to ASP.NET elements, but I'm not sure it is worth the effort
Do you mean .NET objects? Check out System.Web.Script.Serialization.JavaScriptSerializer
You should take care not to employ too much interaction if you help it. Use JQuery for client side interaction only.
I am looking for a filtering mechanism, as the user types in the drop down box I want to filter the list to the list items that match what the user is typing. Is there any premade control for this or does anyone know the best way to achieve this feature?
Thanks
Well, that's the simple solution. The Ajax Control Toolkit AutoComplete Extender comes in handy if you wish to accomplish this. You may also have to implement a small Service.
Check it out and you will tell us.
The Ajax Control Toolkit has an auto complete extender (http://www.asp.net/ajaxlibrary/act_AutoComplete.ashx).
JQuery has an auto complete feature in the UI core (http://jqueryui.com/demos/autocomplete/).
Others built into third party tools.
HTH.
I have a web page devoloped in visual studio 2008.
I have 4 dropdowns and a repeater in the page.based on the selection(search criteria) from the dropdowns the repeater value will change.
and one dropdown selection will bind values to the other dropdown also.
Since the page is causing a lot of postback we decided to implement ajax here.
I am yet to learn ajax.
Can anyone tell what is the best way to do this .which ajax control replace dropdowns?
i have already server side code written on all dropdowns.
Please give me a good solution which i can implement in less time and reuse my code.
One more update: i have a master page used in the project.
I am using update panel of ajax which does not work if i use master page.
(That means all the dropdown controls and repeater i put it in update panel.But still page postback occurs.)
In a normal page(without master page) it works? why is this happening?
Thanks
SNA
You are able to use UpdatePanel and place dropdowns inside it.
Your solution will depend on the AJAX framework you choose, but here are cascading dropdown examples in ASP.NET AJAX and jQuery
If your main reason for using AJAX is to remove the number of postbacks you are getting, then I would recommend against using Microsoft's built in solution, e.g updatepanels.
The learning curve will be higher but learn to use jQuery, maybe with a little help from jTemplate to help you build your drop downs on the page.
Using updatepanels will not reduce your postbacks as behind the scenes asp.net is doing a full page life-cycle, sending all content back to your client but only updating the update panel. jQuery will be far more efficient. (and the reason I use it!!)
Update
If you don't believe me, see... Why Update Panels are dangerous
Update #2
If you don't want to go the whole way of learning Ajax just yet (although I'd recommend it) you could always pre-load your page with all the possible drop down combinations and then swap them using javascript / javascript + jQuery.
Here is one example of how you may do it -- use jQuery for dependent drop down combos
Using this method you are more likely to be able to save the code you've already written to work out the drop down options.
How do you implement autocomplete on ASP.Net Gridview? Can anyone point me where to go to achieve this? I'm willing to use non-.Net ajax controls if that what it takes.
You will need to utilise an AJAX framework (JQuery is one i often recommend) which will provide the functionality to display the drop down box. You will then need to create a separate page (or web service) to return all the possible values to display in the auto-complete drop down.
To save on performance i recommend only initiating the auto-complete once the user has typed in 2 or 3 letters. These can then be passed by the JavaScript to the backed to proivde values to show in the drop down list.
The back end can communicate with the JavaScript using either simple CSV, JSON, XML Web service etc. See http://www.pengoworks.com/workshop/jquery/autocomplete.htm for examples.
The AJAX Control Toolkit provides an autocomplete but requires a web service to work. You could always write your own asmx if there isn't one you can use.
Otherwise, there are all sorts of JS and jQuery examples:
http://www.javascript-examples.com/autocomplete-demo/
Scriptaculous has a nice autocomplete component. It is built on prototype.js.
I've used it to display an autocomplete list with formatted text and images etc. In that sense I think it is more flexible than the ASP.NET AJAX implementation.
Documentation http://wiki.github.com/madrobby/scriptaculous/ajax-autocompleter
Download http://script.aculo.us/downloads