Click here to Skip to main content
15,905,144 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have entered amount '500' in textbox which is in asp page.the same value should be retrieved in the html page when i click submit button of the asp page.
how to do that.how will i get '500' binded in the html textbox.
Posted
Updated 3-Sep-12 20:47pm
v2
Comments
Seyed Ahmad Mirzaee 4-Sep-12 2:41am    
I dont Understand Youre Question!
Please Improve It!

without making runat="server" on html control, then try this

on .aspx page

<head runat="server">
    <title>Untitled Page</title>
    
    <script type="text/javascript">
    
    function HtmlTextboxValue()
    {
    document.getElementById("textbox_html").value=document.getElementById("<%=textbox_temp.ClientID%>").value; 
    }
    
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:hiddenfield id="textbox_temp" runat="server" />
    <div>
        <br />
        <br />
        <br />
        Asp Textbox :     <asp:textbox id="textbox_asp" runat="server" />
        <br />
        <br />
        <br />
        Html Textbox :    <input type="text" id="textbox_html" />
        <br />
        <br />
        <br />
        <asp:button id="Button1" runat="server" text="Button" onclick="Button1_Click" />
    </div>
    </form>
</body>


on codebehind .cs page

protected void Button1_Click(object sender, EventArgs e)
    {

        textbox_temp.Value = textbox_asp.Text;
        Page.ClientScript.RegisterStartupScript(Type.GetType("System.String"), "addScript", "HtmlTextboxValue()", true);

    }
 
Share this answer
 
v3
Comments
Member 8388026 5-Sep-12 0:07am    
but i m transfering the data from one asp page to html page
vino2012 5-Sep-12 2:26am    
then pass asp textbox value through querystring or cookies or form submit...
Set ClientIdMode="Static" for TextBox
this Action, Id Of textbox in serverSide And ClientSide Equaled!
if You Insert Your Code Then Better Me to Help you
 
Share this answer
 
If you are ready to make runat="server" on html control, then try this

on .aspx page
<form id="form1" runat="server">
    <div>
        <br />
        <br />
        <br />
        Asp Textbox :     <asp:textbox id="textbox_asp" runat="server" />
        <br />
        <br />
        <br />
        Html Textbox :    <input type="text" runat="server" id="textbox_html" />
        <br />
        <br />
        <br />
        <asp:button id="Button1" runat="server" text="Button" onclick="Button1_Click" />
    </div>
    </form>


On codebehind .cs file

protected void Button1_Click(object sender, EventArgs e)
    {
        textbox_html.Value = textbox_asp.Text;

    }
 
Share this answer
 
v2
Comments
Member 8388026 5-Sep-12 3:55am    
i want to transfer from one asp page to another html page

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