asp.net 3.5アプリケーション[C#]にgridviewがあります。これは次のようになります:
<asp:GridView CssClass="grid_table" ID="GridView1" AllowPaging="true" PageSize="10"
AutoGenerateEditButton="true" ShowHeader="true"
AutoGenerateDeleteButton="true" DataKeyNames="studentId" runat="server"
OnRowEditing="GridView1_RowEditing"
OnRowCancelingEdit="GridView1_RowCancelingEdit"
OnRowDeleting="GridView1_RowDeleting"
OnRowUpdating="GridView1_RowUpdating"
onpageindexchanging="GridView1_PageIndexChanging" onrowupdated="GridView1_RowUpdated"
>
<EmptyDataTemplate>
<asp:Label ID="lblNoRecord" runat="server" Text="No Record Found" ForeColor="Red"> </asp:Label>
</EmptyDataTemplate>
</asp:GridView>
さて、rowUpdatingイベントで、私は以下のコードを書いています:
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
int mytext = Convert.ToInt16(GridView1.Rows[e.RowIndex].Cells[1].Text);
string cConatiner = GridView1.Rows[e.RowIndex].Cells[4].Text;
}
この場合、myTextは正しい値、つまり1列目の値を示していますが、セルの値を1,2,3,4,5,6に変更すると、空になります。
私はそれを間違ってやっていますか?
私を助けてください。
前もって感謝します。