I have a textbox and an image button as follows
<asp:TextBox ID="myText" runat="server"></asp:TextBox>
<asp:ImageButton ID="btnExecute" runat="server" OnClick="btnExecute_Click" />
Now here is my problem, on the Page_Load there are some bindings.. and these bindings go into dozens of controls and classes, by the time it’s about to reach my code in the On_Click for my button its too late.. it would redirect to somewhere else.. I needed to redirect to a different page but it would never reach its destination unless i somehow ommit all the stuff in between which i am not willing to do..
So, the solution that i thought is to use Javascript on that image button OnClientClick, unfortunately I am not so good at it and was hoping you could help me.. the pseudo code would be something like this
if(the current url contains some page.aspx)
{
var value = get the value from myText;
then navigate to myotherpage?txtvalue=value;
}
Can someone help me with this javascript without going into to much details on why i am doing it like this? please
I would really appreciate it.
Thank you
Naively translating your pseudo code to javascript: