日期:2014-05-17 浏览次数:20470 次
<asp:BoundColumn ReadOnly="true" DataField="Id">
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="ABC">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "TypeName").ToString()%>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="Label2" runat="server" Text="" ></asp:Label>
<asp:TextBox ID="txt_TypeName" runat="server" ></asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:EditCommandColumn CancelText="取消" EditText="编辑" UpdateText="更新"></asp:EditCommandColumn>
public void edit(object sender, DataGridCommandEventArgs e)
{
Label Label2 = (Label)Datagrid1.Items[e.Item.ItemIndex].Cells[1].Controls[0];
Label2.Text = "7";
}
<asp:TemplateColumn>
<EditItemTemplate>
<asp:LinkButton ID="lbkEditUpdate" runat="server" CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton>
<asp:LinkButton ID="lnkEditCancel" runat="server" CausesValidation="True" CommandName="Cancel" Text="Cancel"></asp:LinkButton>