cannot get the text in textbox in datalist,what can i do ?

M

mintboy

hello
thank U for take a look this Message !



/////////////////c# code file
private void DataListClass_UpdateCommand(object source,
System.Web.UI.WebControls.DataListCommandEventArgs e)
{
string UpdateName = ((TextBox)e.Item.FindControl("TextBoxName")).Text;//
here i can not get the text that i modified.
string UpdateLink = ((TextBox)e.Item.FindControl("TextBoxLink")).Text;//
it shows the old text .
//somebody
tell me change viewstate,
//but
it dose nothing for me.

mydsClass.Tables["class"].Rows[e.Item.ItemIndex][1] = UpdateName;
mydsClass.Tables["class"].Rows[e.Item.ItemIndex][2] = UpdateLink;

DataListClass.EditItemIndex = -1;
DataListClass.DataBind();

}


//////////////aspx file ///////////////////////////////

<EditItemTemplate>
<asp:TextBox id=TextBoxName runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.class_name") %>'
EnableViewState="False">
</asp:TextBox>
<asp:TextBox id=TextBoxLink runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.class_link") %>'
EnableViewState="False">
</asp:TextBox>
<asp:LinkButton id="LinkButtonUpdate" runat="server"
CommandName="Update">Update</asp:LinkButton>
<asp:LinkButton id="LinkButtonCancel" runat="server"
CommandName="Cancel">Cancel</asp:LinkButton>
</EditItemTemplate>
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top