こんにちは、グリッド ビューからインデックス (行) を抽出したいのですが、その中でテキスト ボックスを使用しています。ID は gridview のテキスト ボックスから抽出する必要があります。私はこのコードを使用します:
protected void TextBox_Email_TextChanged(object sender, EventArgs e)
{
TextBox thisTextBox = (TextBox)sender;
GridViewRow currentRow = (GridViewRow)thisTextBox.Parent.Parent;
int rowindex = 0;
int idx = currentRow.RowIndex;
string ArticleID = (string)GridView1.DataKeys[idx].Values[1];
}
しかし、VSは私にこのエラーを与えました:
Unable to cast object of type 'System.Web.UI.WebControls.DataControlFieldCell' to type 'System.Web.UI.WebControls.GridViewRow'.
どんな体でも私を助けることができますか?
ありがとう