the href button is in master page. the the textbox is in a Contentplaceholder..
i want to pass the value of that textbox in contentplaceholder to otherpage ( other page will also be displayed in contentplaceholder as you know, since am using masterpage.)
is the code above enough?? if not please help me..
boonmathew
Member
96 Points
56 Posts
pass textbox value to another form through href
May 07, 2012 11:52 AM|LINK
how can i pass the textbox value in one form to another through href.??
i have used Response.Redirect("sample.aspx?id="+TextBox1.Text);
But i want to pass it through href..
Plz help me
nijhawan.sau...
All-Star
16400 Points
3173 Posts
Re: pass textbox value to another form through href
May 07, 2012 11:59 AM|LINK
Is the textbox inside some gridview etc?
<a href='<%# Eval("Userid","sample.aspx?id={0}") %>'>Your link text</a>
boonmathew
Member
96 Points
56 Posts
Re: pass textbox value to another form through href
May 07, 2012 12:09 PM|LINK
the href button is in master page. the the textbox is in a Contentplaceholder..
i want to pass the value of that textbox in contentplaceholder to otherpage ( other page will also be displayed in contentplaceholder as you know, since am using masterpage.)
is the code above enough?? if not please help me..
thanks in advance..
sriramabi
Contributor
4351 Points
1277 Posts
Re: pass textbox value to another form through href
May 07, 2012 01:06 PM|LINK
pls see this
http://forums.asp.net/t/1448738.aspx/1
http://forums.asp.net/t/1277940.aspx/1
http://weblogs.asp.net/shijuvarghese/archive/2010/02/26/querystring-values-along-with-id-parameter-in-asp-net-mvc.aspx
asp.netx.0lo...
Member
362 Points
71 Posts
Re: pass textbox value to another form through href
May 10, 2012 03:04 AM|LINK
Hi boonmathew
I think you can use javascript in masterpage instead of using Response.Redirect(...).
Here are the way.
<head runat="server"> <title></title> <asp:ContentPlaceHolder id="head" runat="server"> </asp:ContentPlaceHolder> <script type="text/javascript"> function Click() { var t = document.getElementById("ContentPlaceHolder1_TextBox1").value; var s_a = document.getElementById("mylink"); s_a.href = "Sample.aspx?id=" + t; } </script> </head> <body> <form id="form1" runat="server"> <div> <a id="mylink" href="javascript:void(0)" onclick="Click()">Your text here</a> <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div> </form> </body>Then you can use TextBox1.Text = (string)Request.QueryString["id"]; to reveice the id in your Sample.aspx file.
Thanks