Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

DropDown in DataList

This is a discussion on DropDown in DataList within the ASP.NET forums, part of the Web Development category; I have datalist and in the Item template i have taken a dropdown list in a ASP.NET 1.1 web application. I have populated the dropdown at runtime. Now i want ...

Go Back   Geeks Talk > Web Development > ASP.NET
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

ASP.NET ASP.NET and ASP Related Problems

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-25-2007
Junior Member
 
Join Date: Jun 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Sreedevi Pidaparthi is on a distinguished road
Smile DropDown in DataList

I have datalist and in the Item template i have taken a dropdown list in a ASP.NET 1.1 web application. I have populated the dropdown at runtime. Now i want to capture the value selected in the DropDown. I tried SelectedIndexChanged procedure of the DropDown and the DataList and ItemCommand of DataList but to no avail. These events are being fired but i have no clue on how to capture the value selected in the DropDown List..... When an item in the drop Down is selected then the ItemCommand event of the datalist isnt triggered.....Please Help.

Thanks in Advance.
Sreedevi

Last edited by Sreedevi Pidaparthi; 06-26-2007 at 12:23 PM.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-17-2007
Contributing Member
 
Join Date: Sep 2006
Location: bangalore, india
Posts: 1,016
Thanks: 0
Thanked 91 Times in 72 Posts
psuresh1982 will become famous soon enough
Re: DropDown in DataList

Check whether the ValueField has unique values or not....

-------------------
suresh
Reply With Quote
  #3 (permalink)  
Old 06-15-2009
Junior Member
 
Join Date: Jun 2009
Location: India
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Suyash123 is on a distinguished road
Re: DropDown in DataList

protected void drp1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddl = (DropDownList)sender;

string contactid = ddl.SelectedIndex.ToString();


// to access any other element in datalist
// DataListItem row = ddl.NamingContainer as DataListItem;

//Label lbl = (Label)row.FindControl("lbl_text");

if (ddl.SelectedItem.Text != "-Select-")
{
....
}
else
{

}
}

}
Reply With Quote
  #4 (permalink)  
Old 08-12-2009
Junior Member
 
Join Date: Aug 2009
Location: Chennai
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
chinnakulandaiv is on a distinguished road
Re: DropDown in DataList

protected void drp1_SelectedIndexChanged(object sender, EventArgs e)
{
string selectedValue=drp1.SelectedValue.ToString().Trim();

//Do rest of the code

}

this will help u to get the selected value from the drop down list
Reply With Quote
  #5 (permalink)  
Old 08-17-2009
Junior Member
 
Join Date: Aug 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
akanshu is on a distinguished road
Re: DropDown in DataList

protected void drp1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddl = (DropDownList)sender;

string contactid = ddl.SelectedIndex.ToString();


// to access any other element in datalist
// DataListItem row = ddl.NamingContainer as DataListItem;

//Label lbl = (Label)row.FindControl("lbl_text");

if (ddl.SelectedItem.Text != "-Select-")
{
....
}
else
{

}
}

}
Reply With Quote
Reply

  Geeks Talk > Web Development > ASP.NET

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

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


Similar Threads

Thread Thread Starter Forum Replies Last Post
ADO.NET 2.0 : Check Box and Dropdown List in a Datagrid Srikanth VB.NET 2 02-19-2007 02:14 PM


All times are GMT -4. The time now is 04:07 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved