Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Controls / August 2005

Tip: Looking for answers? Try searching our database.

DataList ItemCommand - trying to get data from contained control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Xavier Pacheco - 24 Aug 2005 04:45 GMT
Can anyone make heads or tails out of this? I have a DataList control
that contains a DropDownList and a HyperLink control. The HyperLink
control initiates a command named "REGISTER".

The following code executes, I find the DropDownList, but it contains
no values. IOW, it appears to be empty.

Am I going about this correctly?  When the user presses the hyperlink
contained in the ItemTemplate of the DataList, I want to get the
selected value of the DropDownList, also contained in the Item Template
of the DataList.

private void DataList1_ItemCommand(object source,
system.Web.UI.WebControls.DataListCommandEventArgs e)
{
 if ( e.CommandName == "REGISTER" )
 {
   string ctl_name = String.Format( CTRLNAME, e.Item.ItemIndex );
   DropDownList ddl = (DropDownList)e.Item.FindControl(  
       "DropDownList1" );
   int EventInstanceID = Int32.Parse( ddl.SelectedValue );
 }
}

Any ideas ?
- x
Nathan Sokalski - 27 Aug 2005 05:10 GMT
It looks like you are accessing the control correctly, but before I try to
solve your problem any further, might I point out that you are assigning
values from that control to variables, but then the eventhandler is done. In
otherwords, can I ask how you are determining whether or not you actually
got the data from the control?
Signature

Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

> Can anyone make heads or tails out of this? I have a DataList control
> that contains a DropDownList and a HyperLink control. The HyperLink
[quoted text clipped - 22 lines]
> Any ideas ?
> - x

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.