1
Reply

i had created two forms.form1 & form2.form1 consists of a textbox & form2 consists of a label and a button.i want to transfer the text in the textbox in form1 to the label in form2 when the button in form2 was clicked.how can i do it?

achu

achu

15y
7.1k
0
Reply

     à In Page_Load event of form2.aspx.cs, add following code :

     

    Button1.Attributes.Add("onClick", "return textTransfer();");

     

     

    à In head tag of form2.aspx add following code :

     

    <script language="javascript">

        function textTransfer() {

        debugger;

        var doc=document.forms[0];

        var txt=Label1.innerHTML;

        window.open ("form1.aspx?val="+txt,"mywindow","scrollbars=no,resizable=yes,width=400,height=280");

        }

        </script>

     

     

    à In Page_Load event of form1.aspx.cs, add following code :

     

    TextBox1.Text = Request.QueryString["val"].ToString();