Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: viewstatepostback
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---
 
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 11-Jan-13 0:34am
Edited 11-Jan-13 0:37am
v2
Comments
ryanb31 at 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 at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Thanks All,
 
Its working fine now.
 

default__doPostBack = __doPostBack;
 
   var theForm = window.parent.self.firstGrid.document.Form1;
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Shai Vashdi 576
1 OriginalGriff 183
2 Tadit Dash 150
3 Peter Leow 140
4 Sergey Alexandrovich Kryukov 121
0 Sergey Alexandrovich Kryukov 9,280
1 OriginalGriff 5,473
2 Peter Leow 4,100
3 Maciej Los 3,540
4 Abhinav S 3,333


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 25 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid