在下面的网格视图中,我想更新一行。我试过但我无法做到。请帮助我这样做。
<asp:GridView Width="100%" runat="server" ID="srchgrid" AutoGenerateColumns="false" CellPadding="4" ForeColor="#333333" ShowFooter="false"
PageSize-Mode="NumericPages" PageSize="10" PagerStyle-Visible="true" AllowPaging="true" AllowSorting="true"
OnRowCommand="srchgrid_RowCommand" RowUpdating="srchgrid_RowUpdating"
CssClass="mGrid"
PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt">
<asp:TemplateField HeaderText="Edit" itemstyle-width="150px">
<ItemTemplate>
<asp:LinkButton ID="btnEdit" runat="server" RowIndex="Edit" Text="Edit" CausesValidation="false"/>
</ItemTemplate>
protected void srchgrid_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
if (e.RowIndex.Equals("Edit"))
{
LinkButton btnView = (LinkButton)srchgrid.Rows[e.RowIndex].FindControl("btnView");
}}
答案 0 :(得分:0)
添加单元格[ Cell_No ]
LinkButton btnView = (LinkButton)srchgrid.Rows[e.RowIndex].Cells[Cell_No].FindControl("btnView");