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 |
| |||
| 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 |
| Sponsored Links |
| |||
| 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 |
| |||
| 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. |
| |||
| 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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |
LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/asp-asp-net-programming/5121-how-populate-items-drop-downlist-without-postback.html | |||
| Posted By | For | Type | Date |
| PostBack - Page 1 - Strategicboard Blog Search Engine | This thread | Refback | 01-29-2008 12:00 PM |
| DiscussWeb IT Community - Technical Support and Technology Discussions | This thread | Refback | 01-28-2008 06:40 AM |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to Populate menu using sitemap and asp .net menu control and c#: | Archer | C# Programming | 3 | 04-29-2008 09:23 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 |
| Desktop items when logging in | pcguy | Operating Systems | 0 | 07-31-2007 06:35 PM |