IT Community - Software Programming, Web Development and Technical Support

How to populate items to Drop downlist without postback?

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 ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  2 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 01-28-2008, 05:19 AM
KiruthikaSambandam KiruthikaSambandam is offline
D-Web Analyst
 
Join Date: Aug 2007
Posts: 332
KiruthikaSambandam is on a distinguished road
Default How to populate items to Drop downlist without postback?

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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-31-2008, 10:05 PM
rrrajesh84in rrrajesh84in is offline
D-Web Master
 
Join Date: Mar 2007
Posts: 399
rrrajesh84in is on a distinguished road
Default Re: How to populate items to Drop downlist without postback?

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
__________________
.....................................
''''''
Rajesh''''''
Ants. . . . . . Like me
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-17-2008, 07:57 PM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 189
poornima is on a distinguished road
Smile Re: How to populate items to Drop downlist without postback?

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.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-01-2008, 09:44 PM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 189
poornima is on a distinguished road
Smile Re: How to populate items to Drop downlist without postback?

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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT -7. The time now is 09:16 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0