Custom Web Service w/C#

  • Thread starter Thread starter cappjr
  • Start date Start date
C

cappjr

Here's what I'm trying to do. I have a form with a text box called
"accountNum". I have a label under that text box called "orgName".

What I want to do, using Web Services, is when the user enters in
their account number, the Web service connects to the database and
pulls the organization name associated with that account number and
displays the results in the "orgName" label.

Can anyone help or point me in the right direction?

Thanks!
Jeremy
 
Let me clarify...I'm not trying to learn how to write the Web Service
itself. I have that done already. What I'm needing is to return that
result to a Label without hitting a submit button. You know, kind of
like how the AJAX CascadingDropDown control works.
 
Let me clarify...I'm not trying to learn how to write the Web Service
itself. I have that done already. What I'm needing is to return that
result to a Label without hitting a submit button. You know, kind of
like how the AJAX CascadingDropDown control works.
Use asynchronous client-side javascript methods to handle the
textbox's OnTextChanged event. The script can call the web service
when the Enter key is pressed.

I do not like the idea of calling a web service from client-side
scripting. Too much information is publicly exposed about something
that may need to be a private resource. Instead I would call a page
specifically designed for the task and pass the text in the query
string.

protected void Page_Load(object sender, EventArgs e)
{
string textboxText = Request.QueryString["TextboxText"].Trim();;
string labelText - getLabelText(textboxText);

Response.Clear();
Response.Write(labelText);
Response.End();
}

Doing this keeps the async call within the scope and security of the
session.
 
Let me clarify...I'm not trying to learn how to write theWebService
itself. I have that done already. What I'm needing is to return that
result to a Label without hitting a submit button. You know, kind of
like how the AJAX CascadingDropDown control works.

Use asynchronous client-side javascript methods to handle the
textbox's OnTextChanged event. The script can call thewebservice
when the Enter key is pressed.

I do not like the idea of calling awebservicefrom client-side
scripting. Too much information is publicly exposed about something
that may need to be a private resource. Instead I would call a page
specifically designed for the task and pass the text in the query
string.

 protected void Page_Load(object sender, EventArgs e)
 {
  string textboxText = Request.QueryString["TextboxText"].Trim();;
  string labelText - getLabelText(textboxText);

   Response.Clear();
   Response.Write(labelText);
   Response.End();

}

Doing this keeps the async call within the scope and security of the
session.



- Show quoted text -

Thanks for the reply. I'll give both a try.
 
This does almost exactly what I want it to do!

http://www.semenoff.dk/en/Code-Corner/ASP.Net.AJAX/WebService-From-JavaScript.aspx

Let me clarify...I'm not trying to learn how to write theWebService
itself. I have that done already. What I'm needing is to return that
result to a Label without hitting a submit button. You know, kind of
like how the AJAX CascadingDropDown control works.

Use asynchronous client-side javascript methods to handle the
textbox's OnTextChanged event. The script can call thewebservice
when the Enter key is pressed.

I do not like the idea of calling awebservicefrom client-side
scripting. Too much information is publicly exposed about something
that may need to be a private resource. Instead I would call a page
specifically designed for the task and pass the text in the query
string.

 protected void Page_Load(object sender, EventArgs e)
 {
  string textboxText = Request.QueryString["TextboxText"].Trim();;
  string labelText - getLabelText(textboxText);

   Response.Clear();
   Response.Write(labelText);
   Response.End();

}

Doing this keeps the async call within the scope and security of the
session.



- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top