Hi,
Rajiv Das wrote:
I want to postback to the Search.aspx from default.aspx.
I have a textbox and a button on default.aspx
I want the postbackurl to be Search.aspx?q={textbox.text}
How to achieve this?
Any hacks?
I am currently doing a self-post back + redirect.
You can access the ACTION attribute of the form using JavaScript.
<form id="myForm" action="Search.aspx" onsubmit="return setAction();">
<input id="textbox" />
<input type="submit" value="Submit" />
</form>
<script type="text/javascript">
function setAction()
{
var myForm = document.getElementById( "myForm" );
var myText = document.getElementById( "textbox" );
if ( myForm
&& myForm.action
&& myText
&& myText.value != null )
{
myForm.action = "Search.aspx?q=" + myText.value;
}
return true;
}
</script>
HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog:
http://www.galasoft-LB.ch
PhotoAlbum:
http://www.galasoft-LB.ch/pictures
Support children in Calcutta:
http://www.calcutta-espoir.ch