Click here to Skip to main content
15,884,628 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear All

In the Fee Payment form using ASP.Net webform when I enter student id, the student name should be retrieved and displayed in the display filed from student history table so that Operator confirm that the student ID and the student name are the same student.

in order to accomplish this how to write a javascript function that retrieve the appropriate information as the student id is entered in the asp.net next and hit enter.


Regards

Amy

What I have tried:

I want to accomplish this task by using Javascript on change or some other event. I don't have Idea how to retrieve information using javascript so please help me
Posted
Updated 6-Apr-16 4:50am
Comments
Thanks7872 6-Apr-16 6:40am    
'What I have tried' is meant to explain what you have done so far,not what you want to do.
F-ES Sitecore 6-Apr-16 7:01am    
You have to write a server-side function to get the data, like a webmethod or webservice, and call that webmethod from javascript. Google "call asp.net webmethod from jquery" for examples.

Simple. You don't, for a long list of reasons.

It CAN, however, talk to the web server and call methods exposed by the application Controllers to manipulate data, including having methods that query the SQL Server for you and return the data to your javascript code on the client.

Google for "javascript call controller method" for examples.
 
Share this answer
 
First, you want an interface that is going to work across all browsers. That being said, ActiveXObject() methods are out (IE, only).

    But much more importantly:
  • you are publicly exposing information about your server
  • you are allowing for a duplicate of your page with modified (harmful) SQL


JavaScript, you may have noticed, does not make it easy to do anything to the user's system - let along your server! It would be a security nightmare.

SQL should be called on the server, out of the view of any possible client. PHP is commonly used for this. You can generate the page on the server or use AJAX to retrieve the data and populate your existing page.

Even were you able to get this possibility on you client side you should run head-long in another direction . . . or risk the consequences.



 
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