What is the most efficient and robust way to program ASP.NET with javascript? -
I wanted to know what is the best way to program ASP.NET with JS? So far, I am trying to code with codebehind features. Add ("onclick," ....); Is there a better and better way to use JS with ASP.NET?
Thank you
Writing all your functions in a different JS file is more flexible Now what are you doing The problem may be the control ID in your JS file. Okay, there are many ways.
Hardcoding Just look at the Source View and Identify Control which you want to use. It's easy, but if you want to change the control ID some time then the related function will not work something like that all in the ASPX file Announce a variable with client id that uses in JS file and in your JS file
var MyControlIDs = {"Textbox1": "& lt;% = Textbox1.ClientID%>", " Label1 ":" & lt;% = Label1.ClentID%> "}; var mycontrol = window .MyControlIDs and anywhere you want var textbox = document .getElementById (mycontrol.TextBox1);
Comments
Post a Comment