Click here to Skip to main content
11,583,555 members (63,869 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: viewstate postback
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
0 OriginalGriff 430
1 Dave Kreskowiak 230
2 Richard Deeming 220
3 Sergey Alexandrovich Kryukov 220
4 virusstorm 203
0 OriginalGriff 1,523
1 Sergey Alexandrovich Kryukov 995
2 Abhinav S 696
3 Dave Kreskowiak 621
4 Suvendu Shekhar Giri 568


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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100