Saturday, March 31, 2012

Server side function calling

Hi,
Uses: VS.NET 2003, VB.NET, Windows xp

I've written an apsx web page through vb.net. In that I've mentioned a
procedure(Server Side). Now I want to call it through Jscript.

The reason behind is about validations. There are some text to enter in one
text box. So once the user has entered the text, it will check whether the
text is null, if not it will call that server side procedure I've mentioned
in aspx page.

I'm wondering how can I call it. One guy in the news group said to use the
following:

1. __doPostBack(...);
2. document.forms[0].submit();
3. document.getElementById(<Some asp control's client ID>).click();

however it wasn't specific and I didn't understod how to use it. Using codes
to illustrate the solution will be much worthy here.

Thank you,
--
Mohammed Hifni Shahzard Nazeer,
JB Securities Pvt. Ltd.,
Colombo.Hifni Shahzard wrote:
> Hi,
> Uses: VS.NET 2003, VB.NET, Windows xp
> I've written an apsx web page through vb.net. In that I've mentioned a
> procedure(Server Side). Now I want to call it through Jscript.
> The reason behind is about validations. There are some text to enter
> in one text box. So once the user has entered the text, it will check
> whether the text is null, if not it will call that server side
> procedure I've mentioned in aspx page.
> I'm wondering how can I call it. One guy in the news group said to
> use the following:
> 1. __doPostBack(...);
> 2. document.forms[0].submit();
> 3. document.getElementById(<Some asp control's client ID>).click();
> however it wasn't specific and I didn't understod how to use it.
> Using codes to illustrate the solution will be much worthy here.
> Thank you,

If you want validation, use a CustomValidator. You could provide some
client-side javascript, but that's not required. You are after the server-side
event. There you can do your validation.

Hans Kesting
You can use the AJAX.NET libraries to asynchronously do a server side method
call easily through javascript.

Go here http://ajax.schwarz-interactive.de/...le/default.aspx for
examples and downloadable libraries and code.

--
- Paul Glavich
MVP ASP.NET
http://weblogs.asp.net/pglavich
ASPInsiders member - http://www.aspinsiders.com

"Hans Kesting" <news.2.hansdk@.spamgourmet.com> wrote in message
news:%23VZF4l%23zFHA.1968@.TK2MSFTNGP10.phx.gbl...
> Hifni Shahzard wrote:
>> Hi,
>> Uses: VS.NET 2003, VB.NET, Windows xp
>>
>> I've written an apsx web page through vb.net. In that I've mentioned a
>> procedure(Server Side). Now I want to call it through Jscript.
>>
>> The reason behind is about validations. There are some text to enter
>> in one text box. So once the user has entered the text, it will check
>> whether the text is null, if not it will call that server side
>> procedure I've mentioned in aspx page.
>>
>> I'm wondering how can I call it. One guy in the news group said to
>> use the following:
>>
>> 1. __doPostBack(...);
>> 2. document.forms[0].submit();
>> 3. document.getElementById(<Some asp control's client ID>).click();
>>
>> however it wasn't specific and I didn't understod how to use it.
>> Using codes to illustrate the solution will be much worthy here.
>>
>> Thank you,
> If you want validation, use a CustomValidator. You could provide some
> client-side javascript, but that's not required. You are after the
> server-side
> event. There you can do your validation.
> Hans Kesting

No comments:

Post a Comment