This is a migrated thread and some comments may be shown as answers.

ajax call server side function from client side

2 Answers 274 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
nirmal
Top achievements
Rank 1
nirmal asked on 11 Aug 2009, 11:02 AM
Hi,

I want to execute the following steps in the order mentioned.

1. From a client side function on a modal pop up, call a serve side function on the modal pop up code behind
2. Depending on the bool value returned from the server side function to the client side function the modal pop up may or may not be closed.

Can anyone please help me with this ?
Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 11 Aug 2009, 12:57 PM
Hello Nirmal,

1. You can fire an AjaxRequest from the client side. Check out the following help document to get this implemented:
OnAjaxRequest event

2. Then you can execute custom JavaScript code  from the server using the RegisterStartupScript static method of the ScriptManager as mentioned in the help document below:
Executing custom javascript code after AJAX update

Thanks
Princy.
0
nirmal
Top achievements
Rank 1
answered on 11 Aug 2009, 01:50 PM
Hi Princy,

Thanx for the response. It solves my purpose. However I am not sure about how to pass a value(success or failure of the server side operation) to the client side function. 
Tags
General Discussions
Asked by
nirmal
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
nirmal
Top achievements
Rank 1
Share this question
or