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
  #1  
Old 01-28-2008, 05:19 AM
KiruthikaSambandam KiruthikaSambandam is offline
D-Web Analyst
 
Join Date: Aug 2007
Posts: 327
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
  #2  
Old 01-31-2008, 10:05 PM
rrrajesh84in rrrajesh84in is offline
D-Web Master
 
Join Date: Mar 2007
Posts: 365
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  
Old 03-17-2008, 07:57 PM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 188
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  
Old 07-01-2008, 09:44 PM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 188
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
  #5  
Old 10-11-2008, 07:39 PM
detta detta is offline
D-Web Trainee
 
Join Date: Sep 2008
Posts: 8
detta is on a distinguished road
Default Re: How to populate items to Drop downlist without postback?

ASP.NET pages, known officially as "web forms", are the main building block for application development.
_______________________

play shooting games Scouts website
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 Off
Pingbacks are Off
Refbacks are Off

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


All times are GMT -7. The time now is 12:28 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
Stamford Dentist | Euro Millions Lottery | Tech Support Services

SEO by vBSEO 3.0.0