2.0: accessing control in DataList_Edit

R

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/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top