Click here to Skip to main content
15,943,623 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In the below code i have textbox in sample.ascx and a javascript function in .aspx how can i call js function from ascx page.
Do.aspx
Js:
C#
function But2() {
           document.getElementById("hidRectX").value = "431";
           document.getElementById("hidRectY").value = "312";
           document.getElementById("hidRectX1").value = "175";
           document.getElementById("hidRectY1").value = "40";
           DisplayRect();
           moveScroll();
       }


sample.ascx

<asp:TextBox ID="txtField" runat="server" width="200Px">/xml>
Posted
Comments
What have you tried?

1 solution

Hello,

You can try out this code it might work

C#
string strScript = "txtField";

            if (!Page.ClientScript.IsStartupScriptRegistered("myscript"))
                Page.ClientScript.RegisterStartupScript(this.But2(), "myscript", strScript, true);
 
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