This is a discussion on How to populate items to Drop downlist without postback? within the ASP and ASP.NET Programming forums, part of the Web Development category; Hi all, I want to populate the ddl without postback to the server. Suppose there are 2 dropdownlists. The second ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Hi all, I want to populate the ddl without postback to the server. Suppose there are 2 dropdownlists. The second ddl population depends on the selected item of first one. So when we select an item from first ddl, it should populate the desired values in second ddl without postback ............... can any one help me ? Thanks KiruthikaSambandam |
|
#2
| |||
| |||
| hi It is possible using Ajax. Or you should have store all the values in the hidden field or some where else in the page and retrieve it through java script and load it in the client side itself. this is my suggestion not the resolution for your problem |
|
#3
| |||
| |||
| Hi, No need to go for ajax.U just generate XML file and retrieve data from that file.so that u can avoid full page refresh but partial refreshment s there. |
|
#4
| |||
| |||
| Hi, See the following example. My need is to get the state list in one DropDownlist according to the country name in another DropDownlist. Consider My xml(countryContent.xml) like this, <xml> <country Name="US"> <state countryId="1" stateName="ottawa" /> <state countryId="1" stateName="SovietUnion" /> <state countryId="1" stateName="u" /> <state countryId="1" stateName="UUU " /> </country> <country Name="India"> <state countryId="2" stateName="Agra" /> <state countryId="2" stateName="AndraPradesh" /> <state countryId="2" stateName="Kerala" /> <state countryId="2" stateName="Maharastra" /> <state countryId="2" stateName="Mumbai" /> <state countryId="2" stateName="TamilNadu" /> <state countryId="2" stateName="U.P" /> </country> </xml> In PageLoad,write the following coding protected void Page_load(object sender,EventArgs e) { DataTable dataTable = new DataTable(); DataRow dr; dataTable.Columns.Add("countryName", typeof(string)); if (!IsPostBack) { XmlDocument xdoc = new XmlDocument(); XmlTextReader xtr = new XmlTextReader(Server.MapPath("countryContent.xml") ); xdoc.Load(xtr); XmlNodeList xnl = xdoc.DocumentElement.SelectNodes("country"); foreach (XmlNode xnode in xnl) { dr = dataTable.NewRow(); dr[0] = xnode.Attributes[0].Value; dataTable.Rows.Add(dr); } countryDropDownList.DataSource = dataTable; countryDropDownList.DataValueField = "countryName"; countryDropDownList.DataBind(); } } Like this, write the coding for state DropDownlist. This will avoid page refresh |
|
#5
| |||
| |||
| ASP.NET pages, known officially as "web forms", are the main building block for application development. _______________________ play shooting games Scouts website |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to populate a Winforms treeview control from dataset | arjkhanna | Operating Systems | 8 | 05-22-2009 11:42 PM |
| How to Create the TabControl form in asp.net without postback | bluesky | ASP and ASP.NET Programming | 3 | 10-22-2007 03:00 AM |
| create Editable label without postback | shaalini | ASP and ASP.NET Programming | 4 | 10-18-2007 01:18 AM |
| Why do the menu items drop behind some HTML elements.? | Pvinothkumar | HTML, CSS and Javascript Coding Techniques | 1 | 09-13-2007 05:03 AM |
| How to postback the checkbox value in treeview when each time it is checked ? | bluesky | ASP and ASP.NET Programming | 0 | 07-15-2007 11:24 PM |
Our Partners |