i have a datalist control
<ItemTemplate>
<asp:Label ID="lblAddressID" runat="server" Text='<%# Bind("StudentName") %>'/>
开发者_如何学Python <asp:Label ID="lbl" runat="server" />
<asp:Button runat="Server" ID="cmdEdit" CommandName="Edit" Text="Edit"/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtAddressID" runat="server" Text='<%# Bind("StudentName") %>' BackColor="#FFFF66" />
<%-- <asp:Label ID="lbl" runat="server"/>
<asp:Button runat="Server" ID="cmdUpdate" CommandName="Update" Text="Update" />
<asp:Button runat="Server" ID="cmdCancel" CommandName="Cancel" Text="Cancel"/>--%>
</EditItemTemplate>
</asp:DataList>
and during page load im binding the datas:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DataTable dt = new DataTable();
dt = obj.GetDatas();
DataList1.DataSource = dt;
DataList1.DataBind();
}
}
now i received the datas binded to the control. i need to update my datas in edit mode.
How to carry out edit mode to update datas in Datalist control ??
any help...
have look at this sample
EditItemTemplate and DataList
source code:
DataList3_cs.aspx
精彩评论