比如有一列:
...
...
<asp:TemplateField HeaderText="数量" Visible="True">
<ItemTemplate>
<asp:TextBox ID="goods_q" runat="server"
Text='<%# Eval("goods_q") %>' Width="70px" />
</asp:textbox>
</ItemTemplate>
</asp:TemplateField>
...
...TextBox goods_q = GridView1.Rows[i].FindControl("goods_q") as TextBox;
string s = goods_q.Text;
当没有隐藏时可以取到值2000,但当设为隐藏Visible="False">后取到的值为空。问题是这一列不能显示出来,所以一定要设为隐藏,但又要取其值。
...
...
<asp:TemplateField HeaderText="数量" Visible="True">
<ItemTemplate>
<asp:TextBox ID="goods_q" runat="server"
Text='<%# Eval("goods_q") %>' Width="70px" />
</asp:textbox>
</ItemTemplate>
</asp:TemplateField>
...
...TextBox goods_q = GridView1.Rows[i].FindControl("goods_q") as TextBox;
string s = goods_q.Text;
当没有隐藏时可以取到值2000,但当设为隐藏Visible="False">后取到的值为空。问题是这一列不能显示出来,所以一定要设为隐藏,但又要取其值。
解决方案 »
- “JS”脚本函数,怎样注册到“后台.cs”使用
- 求一个项目合同书样本
- 请教如何获取GridView单元格的值
- 如何制作ASP.NET安装包
- SQL问题
- 根据参数,如果记录存在就返回记录,如果记录不存在就返回一个值,代码接收返回值,告诉用户记录不存在?求存储过程.
- gridview 问题.
- 存储过程中有多个select语句,如果在asp.net中得到最后一条select语句的返回结果集
- ASP.NET调用windows的计算器
- C#如何取到邮件群组
- 来个高手指导下,ASP.net能不能 某个页面收集其它页面的信息
- http://www.domain.com/mulu/test.txt 如何设置,输入名称和密码才能看到
參考
Text='<%# Eval("goods_q") %>' Width="70px" />
</asp:textbox>
你隐藏textbox就可以了吗