我没有用到模板列,都是用这样的方式:<asp:BoundField DataField="ItemCode" HeaderText="编码" ReadOnly="True" >
<ItemStyle HorizontalAlign="Center" Width="80px"/>
<HeaderStyle Width="80px" />
</asp:BoundField>
<asp:CommandField ShowDeleteButton="True" HeaderText="操作" CancelText="取消" DeleteText="删除" EditText="编辑" ShowEditButton="True" UpdateText="更新" >
<HeaderStyle Width="80px" />
<ItemStyle HorizontalAlign="Center" />
</asp:CommandField>当点击编辑按钮时,非只读列自动出现TextBox框,更改其内容,最后更新,但获取不到修改后的值 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
String itemname = ((TextBox)GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text.Trim();
...
}这里得到的总是以前的旧值,修改后的值得不到,请问如何解决?
<ItemStyle HorizontalAlign="Center" Width="80px"/>
<HeaderStyle Width="80px" />
</asp:BoundField>
<asp:CommandField ShowDeleteButton="True" HeaderText="操作" CancelText="取消" DeleteText="删除" EditText="编辑" ShowEditButton="True" UpdateText="更新" >
<HeaderStyle Width="80px" />
<ItemStyle HorizontalAlign="Center" />
</asp:CommandField>当点击编辑按钮时,非只读列自动出现TextBox框,更改其内容,最后更新,但获取不到修改后的值 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
String itemname = ((TextBox)GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text.Trim();
...
}这里得到的总是以前的旧值,修改后的值得不到,请问如何解决?
解决方案 »
- 一个网站二级域名怎么指定页面
- AJAX 控件的 AutoComplete 能输入多个值吗
- Gridview 中编辑列问题
- 无法加载 DLL“C:\Windows\System32\Wintab32.dll”: 动态链接库(DLL)初始化例程失败。 (异常来自 HRESULT:0x8
- 怎么在GridView模版列的LinkButton单击事件中改变当前行的背景色?
- 急事 在线等!!!!!问题简单!!
- 大家都用什么工具进行性能、压力测试呢?
- 在ASP.net里,用代码关掉浏览器,用C#怎么写呀??
- 请问这是什么问题:应用程序中的服务器错误--访问被拒绝
- 在C#里,如何设置Web服务器控件的焦点
- 用语句实现数据库存储过程
- 在线求救~
取值是对的,但是
if(!IsPostBack)
SetBind();
在postback后不要绑定