猿问

gridview中guid无法读取

使用gridview将oracle中的数据读取出来 其中有两列隐藏域为guid数据类型

想在想提取guid数据在后台使用 获取的值为system.byte[] 不为guid

 

前台代码

<asp:HiddenField ID="HiddenOpGuid" runat="server" Visible="false" Value='<%# Eval("TRANSACTIONID").ToString() %>'></asp:HiddenField>

 

后台代码

        protected void grvMonitor_RowDataBound(object sender, GridViewRowEventArgs e)
        {

               e.Row.Cells[0].Visible = true;

                HiddenField hidefield = (HiddenField)e.Row.Cells[0].FindControl("HiddenOpGuid");

               e.Row.Cells[0].Visible = false;

              this.textbox.text=hidefield.value;

      }

该如何解决


慕无忌1623718
浏览 274回答 2
2回答

忽然笑

<asp:TemplateField HeaderText="..."><ItemTemplate><asp:Label ID="LabValue" runat="server" Text='<%# Eval("TRANSACTIONID").ToString() %>' Visible="False"></asp:Label></ItemTemplate></asp:TemplateField>//放一个隐藏的Label然后找到它,直接取它的Text不行吗?&nbsp;&nbsp;&nbsp; protected void grvMonitor_RowDataBound(object sender, GridViewRowEventArgs e)&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (e.Row.RowType == DataControlRowType.DataRow)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Label&nbsp;LabValue= (Label)e.Row.FindControl("LabValue");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //LabValue.Text =??&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; }

一只斗牛犬

打断点&nbsp; 跟一下看看什么结果!再判断......
随时随地看视频慕课网APP
我要回答