2
私はフォーム上にいくつかのフィールドを持つgridvewを持っています。私は2つのフィールドを私の背後のコードでそれらのデータを使用したいと思った私のグリッドビューに追加し、私は後ろのコードでそれらをフェッチしますが、私はそれらの列がgridviewで見えるようにしたくないので、彼らの可視属性 'False'は動作しませんでしたが、私はそのデータにアクセスできませんでした。どのように達成することができますか?GridviewのBoundfieldの問題
<asp:BoundField DataField="Service_Id" HeaderText="Service_Id" SortExpression="Service_Id" HeaderStyle-BackColor="Gray"
Visible="true">
<HeaderStyle BackColor="Gray"></HeaderStyle>
</asp:BoundField>
<asp:BoundField DataField="UserId" HeaderText="UserID" SortExpression="UserId" HeaderStyle-BackColor="Gray"
Visible="true">
<HeaderStyle BackColor="Gray"></HeaderStyle>
</asp:BoundField>
そして、これは私のページの背後にあるコードです:
Button Button1 = (Button)sender;
GridViewRow grdRow = (GridViewRow)Button1.Parent.Parent;
HiddenFieldServiceID.Value = grdRow.Cells[0].Text;
HiddenFieldUserID.Value = grdRow.Cells[1].Text;