Click here to Skip to main content
15,878,543 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello Mentors,

Could anybody tell me how can i use __dopostback method to call the codebehind of another page.

I want to override the __dopostback so that i could change the value of theform and set it equal to the form for which i want to call the _postback.

this is what asp.net does automatically---

C#
var theForm = document.forms['Form1'];
if (!theForm) {
    theForm = document.Form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}



i want to set the theForm =window.parent.self.firstGrid.document.Form1;


as i want to call the code behind of Form1 which is another aspx.
Posted
Updated 11-Jan-13 0:37am
v2
Comments
ZurdoDev 11-Jan-13 7:57am    
This sounds like a bad idea. Maybe you can explain why you want to do this and we can figure out a more proper way to do what you need.
gouravkaila 14-Jan-13 4:20am    
The issue is that..i have 2 pages.One is header page and another aspx page which i am using to load the Gridview.
I want to delete the GridView rows on click of a button placed on Header page.

Now the issue is that i am using Datatable.rows.removeat(Index) to remove a row from the gridview without a postback.

As both the pages are different so on click of a button on header page is not refreshing the Grid on another page.For that i am calling

__doPostBack('InboxGrid', 'Delete$0')

from the Header page. Kindly suggest the alternate if any.




1 solution

Thanks All,

Its working fine now.


C#
default__doPostBack = __doPostBack;

   var theForm = window.parent.self.firstGrid.document.Form1;
 
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