相关文章推荐
果断的饼干  ·  C#: Simple HTTP ...·  1 年前    · 
成熟的遥控器  ·  PostgreSQL - ...·  1 年前    · 
I m javascript learner and i hv written following code to Show DialogBox on a button click. but it gives error. please help.....
Error :- Error 1 'ASP.default_aspx' does not contain a definition for 'LoadJScript' and no extension method 'LoadJScript' accepting a first argument of type 'ASP.default_aspx' could be found (are you missing a using directive or an assembly reference?)
< head runat =" server" > < title > Demo Page for Test < /title > < script language =" javascript" type =" text/javascript" > function LoadJScript() // document.getElementById("label1"). var name = prompt("Enter Your Name Here",MERAZ); < /script > < /head >
ASP.NET
< body > < asp:Button ID =" Button1" runat =" server" Text =" Button" OnClick =" LoadJScript()" / > < /body > search where all you are using this method name "LoadJScript"
I believe somewhere in server control you are using this method.
if i am not wrong check if you are calling this method on onclick event of server control and passing one parameter,
to check search (Cntr+f) this method name, and use ClientClick property instead onClick to call javascript method .
Hope this helps you If you want to use onClick have to use return key word. Once your java script return true it will go for server side click event.
<asp:button id= " Button1" runat= " server" text= " Button" onClick= " return LoadJScript();" xmlns:asp= " #unknown" /> <script language= " javascript" type= " text/javascript" > function LoadJScript() var name = prompt( " Enter Your Name Here" , " MERAZ" ); if (name!= null ) // your logic here return true ; // your logic here return false ; </script>
  • Read the question carefully.
  • Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  • If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  • Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid.
  •