Click here to Skip to main content
15,888,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<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>



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))
Posted
Comments
Mandip Grewal 27-May-14 7:51am    
Please share the whole code of your repeater to let us understand the concept and suggest you appropriate way to get value of textbox..

1 solution

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[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900