以下のようなグリッドがあります。
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" s
onrowcommand="GridView1_RowCommand">
<Columns>
<asp:ButtonField DataTextField="Name" HeaderText="Name" />
<asp:BoundField DataField="ArrDate" DataFormatString="{0:MM/dd/yyyy}"
HeaderText="Arr Date" />
<asp:BoundField HeaderText="Dep Date" DataField="DepDate"
DataFormatString="{0:MM/dd/yyyy}" />
<asp:BoundField HeaderText="Mail" DataField="Mail" />
<asp:BoundField HeaderText="Status" DataField="Status" />
<asp:BoundField DataField="ResId" HeaderText="ResId" Visible="False" />
</Columns>
</asp:GridView>
コードビハインド:-
try
{
string text = GridView1.Rows[2].Cells[5].Text;
ScriptManager.RegisterStartupScript(this, GetType(), "Message", "alert('ResId = " + text + ".');", true);
}
catch { }
メッセージが表示されます - RegId =。
値を取得できません。そこで、RedId BoundField を可視に変更します。今、私は値を取得しました。
つまり、RegId =6 です。
私は今2つの問題を抱えています -
1) 非表示列の RegId 値を取得する方法。2)クリックした行の値を見つける方法...bzsコードでROWVALUEを変更できるのは..
string text = GridView1.Rows[ROWVALUE].Cells[5].Text;