Click here to Skip to main content
15,921,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

How to call Server side method from JavaScript without using Ajax
Posted

Hi christokavi,

For example you have grid view containing no of records(ex. Employee details), then you have a button VIEW for displaying selected employee details on another panel controls. Now i need a feature that when you double click the row then display the details same as the VIEW button.

Please refer,
Grid View Row Navigation done by Mr.Samir NIGAM Thank you Samir:thumbsup::thumbsup:

I have taken the above article for my example and then i added the feature for double click which your requirement.

Controls
Gridview - gvData
VIEW button - btnView

public void gvData_RowDataBound(object sender, GridViewRowEventArgs e)
{
    e.Row.Attributes.Add("ondblclick", "javascript: document.getElementById('ctl00_ContentPlaceHolder1_btnView').click(); return false;");
}


According to the code i just called the server side method btnView event by javascript in gvData event.

If you have any doubt then let me know.

Regards,
thatraja
 
Share this answer
 
AJAX is used to call a server through javascript.

Other than that, you can post a form to the server. Just do Form.Submit()

You can use IPostBackEventHandler for that. Actually every button you place in ASP.NET, the page is actually posted using Form.Submit() through javascript. Just inspect the View->Source of the page.

:rose:
 
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