是这样的。现在用Table直接显示数据库中的数据,当用户点击一行数据时,本行数据中的单元格中的内容变为 文本框,以便用户能改修改数据。
现在的问题是,当用户点击编辑一行时。我用如下代码写入文本框(仅以修改一个字段为例)//Lid 是一行数据的主键。
//("Line" + Lid.ToString() 是前面已经定义好的行IDTableCell temp_cell = (this.FindControl("Line" + Lid.ToString()) as TableRow).Cells[1]; TextBox temp_tb = new TextBox();
temp_tb.ID = "temp_pdm" + Lid.ToString();
temp_tb.Width = 65;
temp_tb.Text = "...";
temp_cell.Controls.Add(temp_tb);用户修改完成后点击 确认 后用
TableRow temp_tr = (this.FindControl("Line" + Lid.ToString()) as TableRow);TextBox tb = (TextBox)temp_tr.Cells[1].FindControl("temp_pdm" + Lid.ToString());
或
TextBox tb = (temp_tr.Cells[1].FindControl("temp_pdm" + Lid.ToString() as TextBox);中不到数据。
请高手指教,谢谢
现在的问题是,当用户点击编辑一行时。我用如下代码写入文本框(仅以修改一个字段为例)//Lid 是一行数据的主键。
//("Line" + Lid.ToString() 是前面已经定义好的行IDTableCell temp_cell = (this.FindControl("Line" + Lid.ToString()) as TableRow).Cells[1]; TextBox temp_tb = new TextBox();
temp_tb.ID = "temp_pdm" + Lid.ToString();
temp_tb.Width = 65;
temp_tb.Text = "...";
temp_cell.Controls.Add(temp_tb);用户修改完成后点击 确认 后用
TableRow temp_tr = (this.FindControl("Line" + Lid.ToString()) as TableRow);TextBox tb = (TextBox)temp_tr.Cells[1].FindControl("temp_pdm" + Lid.ToString());
或
TextBox tb = (temp_tr.Cells[1].FindControl("temp_pdm" + Lid.ToString() as TextBox);中不到数据。
请高手指教,谢谢
解决方案 »
- 类似发帖的内容不存入数据库存到哪里?
- 电子商务网站,库存的减少
- 伪造访问来源
- 对"/"进行判断怎么做?
- <%#%>中的代码与位置有关吗?
- 请问:如何用AJAX自动触发绑定DATAGRID[VS2003]<font color='#ff0000'>[急]</font>
- 有关于A,B页面之间的响应问题,(UP者有分)
- 怎么样得到某个月的天数??
- 判断输入是否合法的邮箱地址?
- 请教Guid.NewGuid() 与 InsertParameters 的问题?
- 没看过wpf,wcf,wf这些技术,但是想问一下这些主要是干哪些领域的?主要是c/s构架吗?在b/s构架上有益处吗
- 关于将CSV文件的数据读到Dateset上的问题,急,在线等!
Request["("temp_pdm" + Lid.ToString()"]
结贴