accesing control in EditItemTemplate of DataList

R

R.A.M.

Hello,
I am learning ASP.NET.
On .aspx page I have a data-list with text-box that I would like to read
during line modification.

<asp:DataList ...
OnEditCommand="Sample_Edit" >
...
<EditItemTemplate>
...
<asp:TextBox ID="SampleEdit" runat="server" />
...
</EditItemTemplate>
...
</asp:DataList>

In code-behind I have:

protected void Sample_Edit(object sender, DataListCommandEventArgs e)
{
...
string Sample = ((TextBox)e.Item.FindControl("SampleEdit")).Text; //
here problem
...
}

The problem is that although e.Item is fine, FindControl returns null.
Could you help me to programme it correctly?
Thank you !!!
/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,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top