像这样,获取不到,估计是获取第一个textbox的值:
string repalycontent = "";
RepeaterItem rm = (RepeaterItem)((System.Web.UI.Control)sender).Parent;
repalycontent = ((TextBox)(rm).FindControl("TextBox1")).Text.ToString().Trim(); for (int i = 0; i < Repeater1.Items.Count; i++)
{
TextBox lbl = (TextBox)Repeater1.Items[i].FindControl("TextBox1");
repalycontent = lbl.Text.ToString();
}正确的写法是什么样的呢,谢谢咯
string repalycontent = "";
RepeaterItem rm = (RepeaterItem)((System.Web.UI.Control)sender).Parent;
repalycontent = ((TextBox)(rm).FindControl("TextBox1")).Text.ToString().Trim(); for (int i = 0; i < Repeater1.Items.Count; i++)
{
TextBox lbl = (TextBox)Repeater1.Items[i].FindControl("TextBox1");
repalycontent = lbl.Text.ToString();
}正确的写法是什么样的呢,谢谢咯
解决方案 »
- 这段登录login.aspx代码怎么会有错呢?
- 快10天了,都解决不了的Session赋值问题, .NET区没人了吗?
- 如何使用ASP.NET来调用MATLAB,并且进行计算操作
- .net从c/s结构变B/S有啥方法?
- 关于OleDbParameter的问题!急,在线等
- <asp:TemplateField>为什么没值输出
- 关于AJAX页面刷新的问题
- asp.net做的Web Service client端(实现查询功能)client端的代码有问题,请各位高手进来帮我看看!
- asp.net 学习!
- 在ASP.NET中如何调用WORD?
- ibatis参数问题
- 如何在弹出页面中进行文本框验证(后台验证提示如何显示在当前页面)
你那样获取也是对的 你要看看你获取的TextBox里面有没有值哦。。
然后通过
TextBox lbl = (TextBox)Repeater1.Items[i].FindControl("TextBox1");//i变为你获取的行index
repalycontent = lbl.Text.ToString();
for (int i = 0; i < Repeater1.Items.Count; i++)
{
TextBox lbl = Repeater1.Items[i].FindControl("TextBox1") as TextBox;
}
RepeaterItem item =(RepeaterItem) ((Button)sender).Parent;
TextBox l = (TextBox)item.FindControl("TextBox1 ");