很菜的有关问题
很菜的问题
在datagrid的编辑模版中有个名为txt_new的文本框,在datagrid的update事件中有
TextBox newname =(TextBox)e.Item.FindControl( "txt_new ");
string name=newname.text.tostring();
为什么每次name的值都是空呢??
------解决方案--------------------
DataGrid在转入编辑状态的时候,还在再进行一次数据绑定
------解决方案--------------------
没有确定rows[i]?string name=newname.text.tostring();
没必要text.tostring()
------解决方案--------------------
在更新DataGrid_Update()事件中写
TextBox tb=(TextBox)e.Item.Cells[3].Controls[0];
string str=tb.Text;
------解决方案--------------------
TextBox newname = (TextBox)web.Items[e.Item.ItemIndex].FindControl( "txt_new ");
在datagrid的编辑模版中有个名为txt_new的文本框,在datagrid的update事件中有
TextBox newname =(TextBox)e.Item.FindControl( "txt_new ");
string name=newname.text.tostring();
为什么每次name的值都是空呢??
------解决方案--------------------
DataGrid在转入编辑状态的时候,还在再进行一次数据绑定
------解决方案--------------------
没有确定rows[i]?string name=newname.text.tostring();
没必要text.tostring()
------解决方案--------------------
在更新DataGrid_Update()事件中写
TextBox tb=(TextBox)e.Item.Cells[3].Controls[0];
string str=tb.Text;
------解决方案--------------------
TextBox newname = (TextBox)web.Items[e.Item.ItemIndex].FindControl( "txt_new ");