Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a textbox inside jquery pop-up dialog and i want text entered in textbox on button click(Server Side).

Jquery
JavaScript
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>
    <link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(function () {
            $("#dialog").dialog({
                buttons: {
                    Ok: function () {
                        $("[id*=Button1]").click();
                    },
                    Close: function () {
                        $(this).dialog('close');
                    }
                }
            });
        });
    </script>



ASPX
ASP.NET
<div id="dialog" style="display:none">
    Click OK to do PostBack!
        <asp:TextBox ID="TextBox1" AutoPostBack="true" runat="server"></asp:TextBox>
</div>
    <asp:Button ID="Button1" runat="server" Text="Button" style = "display:none" OnClick = "Button1_Click" />



C#

C#
protected void Button1_Click(object sender, EventArgs e)
    {
        string str = TextBox1.Text;

    }


please help me


thanks in advance
Posted
Updated 31-Aug-14 21:54pm
v4
Comments
[no name] 1-Sep-14 3:42am    
post your code
Ravi Sargam 1-Sep-14 3:55am    
please check code where i mistaken..
hypermellow 1-Sep-14 3:57am    
Hi, why do you have AutoPostBack="true" set on your Textbox?
Ravi Sargam 1-Sep-14 4:26am    
just i tried nothing is happening with or without postback
[no name] 1-Sep-14 4:43am    
You can get the value as like below
var val=$("#TextBox1").val();
But you did for close on button click

1 solution

Kindly have a look at the answer provided in the below link

access textbox text value in jquery popup to code behind page[^]

Hope this helps
 
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