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