This is en example showing how to call a javascript piece of code at the client side, and the equivalent in the server side, but this time using the code behind of the page in C#:
The example consists on a web form in which you have to provide a name using a text box, choose a date using a calendar component, and finally select a flight company using a dropdown list component.
Clicking over the Alert button the forms will show two messages indicating the name, date and flight company, using client side and server side.
Once we have enter the name and choosed the date and flight company we obtained two messages, the first one produced by the client side :
And the second one produced from the server side just at the top of the page:
This is the markup for the web form showing the javascript code for the client side, and the button used to calls the client side method "sayMessage()" defined in the javascript, and the method "Button3_Click" for the server side defined in the code behind file.
This is the code behind implementing the Button3_Click method:
No hay comentarios:
Publicar un comentario