Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Mentors,

I am trying to call a code behind function of another page from javascript of my page using _dopostback.

But its not calling.

I tried calling the load event of that page also even that is not being fired.

my call is:

__doPostBack(window.parent.frames["firstGrid"].document.getElementById('InboxGrid').id, '');

please tell me where i am wrong?

can i use __dopostback to call the codebehind function of another page?
Posted
Updated 10-Jan-13 20:27pm
v2
Comments
Sandeep Mewara 9-Jan-13 4:04am    
doPostback with TWO underscores, right?

__dopostback - right
_dopostback - wrong

Please confirm.
gouravkaila 9-Jan-13 6:05am    
yes i am using it same way i.e. with two underscores but still not wrking.
Sandeep Mewara 9-Jan-13 8:03am    
When and how it is called?
gouravkaila 9-Jan-13 8:19am    
I am calling it on the client click of a button.
i have two pages one with a button and one wit a gridview.
on the click of that button i want to delete a particular row of the grid.I want to call the rowdeleting event of gridview from this page.
please suggest. Do i need to paste my code?
gouravkaila 10-Jan-13 1:45am    
Can i call the code behind of another page from __dopostback ?

1 solution

Use XMLHTTPRequest Concept to delete the record in another page.

XMLHTTPRequest example[^]


After deleting the record, refresh the current page by using script as follows,before this save one temp variable in hidden variable as

document.getElementById('hdnDeletedRecord').value='DELETE';
document.forms[0].submit();

In aspx.cs page

check this variable and if hidden variable contains 'DELETE' then reload the grid.
 
Share this answer
 
v2
Comments
gouravkaila 11-Jan-13 6:30am    
Thanks a lot sanjeev.I have already tried that but the issue is that i am deleting the records from a grid that is present on another page.If i use xmlhttprequest,it deletes the records but i cant refresh the gridview to get the updated data without a postback or reloading.I am using removeat function for that .So i want to call the same using __dopostback.
Sanjeev Alamuri 11-Jan-13 6:39am    
check my updated solution.
gouravkaila 11-Jan-13 7:46am    
i could not find it sir

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