通过转发器中的链接按钮重定向到另一个页面 [英] redirect to another page through link button in repeater

查看:63
本文介绍了通过转发器中的链接按钮重定向到另一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Response.Redirect("Default3.aspx?Name=" + 
Repeater1.Items[0].FindControl("id_string").ToString());       





显示这个



System.Web.UI.WebControls.TextBox



i想重定向文本框的值而不是控件类型



show this

System.Web.UI.WebControls.TextBox

i want to redirect the value of textbox not type of control

推荐答案

FindControl返回一个控件让你需要将其作为TextBox投射才能获得它的Text值。



例如:

FindControl returns a control so you need to cast it as a TextBox to be able to get it's Text value.

For example:
TextBox txtId = Repeater1.Items[0].FindControl("id_string");
if (txtID != null)
{
  Response.Redirect("Default3.aspx?Name=" + txtID.Text);
}







那么我建议将你的网页命名为更具描述性的页面比Default3.aspx以及使用更有意义的控件名称,例如txtID而不是id_string。




By the way, I would suggest naming your pages to something more descriptive than Default3.aspx as well as use control names that make more sense, such as txtID rather than id_string.


这篇关于通过转发器中的链接按钮重定向到另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆