Call a server side code from Jquery.


I will brief about how to call a server side code from Jquery. How we can achieve this in the Jquery/javascript code.If you are working on context menu if we want to handle the Menu items click on server side code with how to achieve this i will explain with code snippets and real time Images.

In some occasions or in some scenarios we need to call a server side event from the Client Script Using J query or JavaScript.

Scenario to Call a server side Code or Server side Event :

For example when we are working with Controls like Context Menu based on the Menu items click we need to perform an action event i.e Button_click based on that we need to populate the data to Controls.

The below is the snapshot(image) to get exact idea....

Context Menu

On click of Menu items we need to call server side code or server side event

Cleint click server side call

Call from Jquery :



function contextMenuWork(action, el, pos)
{
switch (action)
{
case "ctivate":
{
$("#HiddenFieldRowId").val("1");
$("#ButtonHiddenAddCustomer").click();
break;
}
case "eActivate":
{
$("#HiddenFieldRowId").val("0");
$("#ButtonHiddenAddCustomer").click();
}
}
}



Clickevent from jquery


asp:Button ID="ButtonHiddenAddCustomer" runat="server" CssClass="addCustomer"
style="display:none" OnClick="ButtonHiddenAddCustomer_Click" '


Attachments

Article by srirama
A Good advice from parent to a Child , Master to a Student , Scholar to an Ignorant is like a doctor prescribed pill it is bitter to take but when they take it will do all good for them --- Bhushan

Follow srirama or read 73 articles authored by srirama

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: