Getting control of Items within a Datalist  
Author Message
ree32





PostPosted: 2004-10-6 14:47:23 Top

dotnet-framework-aspnet, Getting control of Items within a Datalist I have a problem as I have placed a dropdownlist in a datalist.

Whenever the selected index changes I need to change a label inside
the datalist.

The problem is I can't get control of the label.

When dropdownlist changes it goes to a function with args of
systemEvent than a DataListItemEventArgs so I have no way getting
control of the item in the datalist to change the label.

Can someone please help me.
 
Michael Tkachev





PostPosted: 2004-10-6 18:58:00 Top

dotnet-framework-aspnet >> Getting control of Items within a Datalist Label l = (Label)DataList.Items[e.Item.ItemIndex].Controls[CotrolNumber];

"ree32" <email***@***.com> wrote in message
news:email***@***.com...
> I have a problem as I have placed a dropdownlist in a datalist.
>
> Whenever the selected index changes I need to change a label inside
> the datalist.
>
> The problem is I can't get control of the label.
>
> When dropdownlist changes it goes to a function with args of
> systemEvent than a DataListItemEventArgs so I have no way getting
> control of the item in the datalist to change the label.
>
> Can someone please help me.


 
ree32





PostPosted: 2004-10-6 19:57:00 Top

dotnet-framework-aspnet >> Getting control of Items within a Datalist Thanks for your help but I was wondering where do I get the control
number?
Also the e.Item.Index how will it work outside the a datalist command
as the eventargs passed in aren't DataListItemEventArgs, but EventArgs
(since its responding to a change in the dropdownlist).

>>Re: Getting control of Items within a Datalist
>>From: Michael Tkachev
>>Date Posted: 10/6/2004 5:37:00 AM

>>Label l = (Label)DataList.Items[e.Item.ItemIndex].Controls[CotrolNumber];
 
 
Michael Tkachev





PostPosted: 2004-10-8 17:03:00 Top

dotnet-framework-aspnet >> Getting control of Items within a Datalist Hi,

the first ControlNumber is 0 - zero. Also you can use a "FindControl"
method.
Label l =
(Label)DataList.Items[e.Item.ItemIndex].Controls.FindControl("ControlID");
you should use an OnItemCommad event for your DataList. and then don't use
event for dropdownList.

Bye


"ree32" <email***@***.com> wrote in message
news:email***@***.com...
> Thanks for your help but I was wondering where do I get the control
> number?
> Also the e.Item.Index how will it work outside the a datalist command
> as the eventargs passed in aren't DataListItemEventArgs, but EventArgs
> (since its responding to a change in the dropdownlist).
>
> >>Re: Getting control of Items within a Datalist
> >>From: Michael Tkachev
> >>Date Posted: 10/6/2004 5:37:00 AM
>
> >>Label l =
(Label)DataList.Items[e.Item.ItemIndex].Controls[CotrolNumber];