How To use Javascript in asp.net Web application?

Posted by Samy33 under JavaScript on 2/19/2010 | Views : 12736 | Status : [Member] | Replies : 7
Hai .....
I am having one doubt in using Javascript on asp.net Web application.Its not working on asp.net. I wrote a java script for validation purpose in asp.net its not working enough....how to use the script in asp.net




Responses

Posted by: Vuyiswamb on: 2/19/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
why do you say its not working. tell us more about your problem

Thank you for posting at Dotnetfunda
[Administrator]

Samy33, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Samy33 on: 2/19/2010 [Member] Starter

Up
0
Down
I dont know how to Call javascript funtion in asp.net Button control.Can you send the javascript codings which you are already used in your project

Samy33, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 2/19/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
its Simple

in your markup in the head you can add the following

   <script language="javascript">

function Showit()
{

alert('Wow i did it');
return false;
}
</script>

and in your button right click on it and go to the properties of your button, and look for onclientClick and write this

  Showit()


and run your test app and click the button and you will see your message

Thank you for posting at dotnetfunda

Vuyiswa Maseko



Thank you for posting at Dotnetfunda
[Administrator]

Samy33, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Samy33 on: 2/21/2010 [Member] Starter

Up
0
Down
This is not problem in my script.Alert msgs are working very nicely. i wrote javascript for validation.How to call the TextBox Name in Javascript.
for Example>>.
If(document.form1.GetElementId("TextBox1")="")
{
alert("Please Enter Ur Name");
return false;
}
>>>>
This Is my coding for validation at one Part


how to call a script in asp.net

tell me

Samy33, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishithraj on: 2/24/2010 [Member] Bronze

Up
0
Down
instead of document.form1.GetElementId("TextBox1"), try with document.GetElementId("TextBox1")

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Samy33, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishithraj on: 2/24/2010 [Member] Bronze

Up
0
Down
And where do you want to call this code. That you should have told us before.

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Samy33, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Samy33 on: 2/24/2010 [Member] Starter

Up
0
Down
Script is called in asp.net button control for validation checking

Samy33, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response