468,505 Members | 1,757 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,505 developers. It's quick & easy.

2.0: accessing control in DataList_Edit

RAM
Hi,
Could you help me please?
I have:

<asp:DataList ID="MateriałyDataList" runat="server"
OnEditCommand="Materiały_Edit">
...
<EditItemTemplate>
...
<asp:Label ID="NumerEdit" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Numer" %>' />
...
</EditItemTemplate>
</asp:DataList>

And I try to access the asp:Label in Materiał_Edit():

proctected void Materiały_Edit(object sender, DataListCommandEventArgs e)
{
string Numer = ((Label)e.Item.FindControl("NumerEdit")).Text; // HERE
PROBLEM
...
}

I have runtime error: FindControl returns null. I have checked: e.Item is a
DataListItem object with attibutes: DataItem=null, ItemIndex=0,
ItemType=Item. The problem occurs at each position of the asp:DataList.
DataBinding works correctly.
Could you help me?
/RAM/
Oct 10 '06 #1
0 859

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Vivek Sharma | last post: by
3 posts views Thread by AdamM | last post: by
1 post views Thread by Jeff Lynch | last post: by
6 posts views Thread by evandelagrammaticas | last post: by
reply views Thread by =?Utf-8?B?QmFyZW4=?= | last post: by
3 posts views Thread by Nathan Sokalski | last post: by
8 posts views Thread by GaryDean | last post: by
reply views Thread by NPC403 | last post: by
3 posts views Thread by gieforce | last post: by
reply views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.