从转发器中查找文本框并使用超链接绑定数据 [英] find textbox from repeater and bind data with hyperlink

查看:106
本文介绍了从转发器中查找文本框并使用超链接绑定数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<asp:HyperLink ID="HyperLink2" runat="server" CssClass="submit_button" NavigateUrl='<%# string.Format("~/Default2.aspx?Id={0}&Qty={1}",
                    HttpUtility.UrlEncode(Eval("Id").ToString()), HttpUtility.UrlEncode(((TextBox)Repeater1.FindControl("TextBox1")).Text)) %>'>Buy Now</asp:HyperLink>







我想在转发器控件中的超链接的navigateurl属性中绑定文本框值(TextBox1.Text)..我这样做就像下面但它是不工作..我不知道为什么..我做错了什么???请建议我正确的方式...



HttpUtility.UrlEncode(((TextBox)Repeater1.FindControl(TextBox1))。Text))




I want to bind textbox value (TextBox1.Text) in navigateurl property of hyperlink which is in a repeater control.. I am doing this like below but it is not working.. I dont know why.. am i doing something wrong??? please suggest me the right way...

HttpUtility.UrlEncode(((TextBox)Repeater1.FindControl("TextBox1")).Text))

推荐答案

当您编写 Repeater1.FindControl(TextBox1)时,您认为哪个TextBox1,有很多根据转发器的数据源!

阅读此处以了解ASP.NET模板及其中的控件ID的使用 - 了解ASP.NET模板 [ ^ ]
When you wrote Repeater1.FindControl("TextBox1"), which "TextBox1" do you think to get, there is numerous according to the data source of the repeater!
Read here to understand ASP.NET templates and the use of control id inside it - Understanding ASP.NET Templates[^]


这篇关于从转发器中查找文本框并使用超链接绑定数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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