Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use javascript value and doPostback?

i have a page where on click of a button, a javascript function runs. It then aggregates some data and places the data on a hidden field in this page. It then opens a new window. This new window picks up this aggregated data like so :-

$('#accepted').val(window.opener.$('#accepted').val());

where accepted is the hidden field in both parent and child window (no runat="server" was used). The issue now is that i require this data to databind two grids. Currently I've done a doPostback on both grids, but what i really want to do is doPostback for the form once and handle the databinding the PageLoad event. So two questions :-

1) How do i doPostback the form?

2) How do i do this while still being able to differentiate from the actual form submission?

like image 431
Ron Avatar asked Nov 14 '22 20:11

Ron


1 Answers

To post the form you should just be able to add a call to __doPostback in your javascript, after the accepted field is set. You can use the EventTarget and EventArgument parameters of the __doPostback to control the binding in your grid.

So, you could put this in your js:

__doPostback('rebindGrid', '');

and then this in your page load event:

if (Request.Form["__EVENTTARGET"] == "rebindGrid")
{
    //....Do so stuff
}
like image 152
DoctorMick Avatar answered Dec 19 '22 03:12

DoctorMick