On Enter Button click redirect with querystring as textbox value

put your text box and button in panel with default button




     functionbutton_click(objTextBox, objBtnID) {
         if (window.event.keyCode == 13) {
             if (objTextBox.value != “”) {
<asp:TextBox ID=”TextBox1″ runat=”server”></asp:TextBox>
    <asp:Button ID=”Button1″ runat=”server” Text=”Button” onclick=”Button1_Click” />
Page load:-
this.TextBox1.Attributes.Add(“onkeypress”, “button_click(this,'” + this.Button1.ClientID + “‘)”);
protected void Button1_Click(object sender, EventArgse)
        if (!string.IsNullOrEmpty(TextBox1.Text))
            Response.Redirect(“Default2.aspx?text=”+ TextBox1.Text);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s