AJAX and IsPostBack
am 07.04.2008 18:25:04 von bm
I have a question that seems like it should have a simple answer, but
I can't seem to find it by searching...
Anyway, I'm trying to capture the IsPostBack event when I select an
item within an UpdatePanel. I don't want items running during
postback (list, grid population, etc) events - pretty standard: If
IsPostBack Then Exit Sub
But, since AJAX doesn't technically postback (?), the IsPostBack is
coming back false...
So, how can I capture the Async postback done by AJAX? Is there any
IsAsyncPostBack keyword and what library is it in?
Page load process:
1. Load drop down menus
2. Load data grids
"Postback process"
1. Select datagrid row
2. Populate several fields below with further information
When I select the datagrid row, IsPostBack remains false. I've tried
splitting into multiple update panels but now they are all in a
singular panel.
TIA for the help!
Re: AJAX and IsPostBack
am 07.04.2008 19:01:43 von George Ter-Saakov
AJAX call runs as a POST back. Just test it...
George.
"BM" wrote in message
news:a91154c5-39c2-4a5f-9c2a-4a586ef9b1cd@u69g2000hse.google groups.com...
>I have a question that seems like it should have a simple answer, but
> I can't seem to find it by searching...
>
> Anyway, I'm trying to capture the IsPostBack event when I select an
> item within an UpdatePanel. I don't want items running during
> postback (list, grid population, etc) events - pretty standard: If
> IsPostBack Then Exit Sub
>
> But, since AJAX doesn't technically postback (?), the IsPostBack is
> coming back false...
>
> So, how can I capture the Async postback done by AJAX? Is there any
> IsAsyncPostBack keyword and what library is it in?
>
> Page load process:
> 1. Load drop down menus
> 2. Load data grids
>
> "Postback process"
> 1. Select datagrid row
> 2. Populate several fields below with further information
>
> When I select the datagrid row, IsPostBack remains false. I've tried
> splitting into multiple update panels but now they are all in a
> singular panel.
>
> TIA for the help!
RE: AJAX and IsPostBack
am 07.04.2008 19:12:03 von brucebarker
an update panel async callback does set IsPostback true (as this is a just a
test for __Viewstate and the callback sends all form fields). you can also
check the scriptmanger.IsInAsyncPostBack
-- bruce (sqlwork.com)
"BM" wrote:
> I have a question that seems like it should have a simple answer, but
> I can't seem to find it by searching...
>
> Anyway, I'm trying to capture the IsPostBack event when I select an
> item within an UpdatePanel. I don't want items running during
> postback (list, grid population, etc) events - pretty standard: If
> IsPostBack Then Exit Sub
>
> But, since AJAX doesn't technically postback (?), the IsPostBack is
> coming back false...
>
> So, how can I capture the Async postback done by AJAX? Is there any
> IsAsyncPostBack keyword and what library is it in?
>
> Page load process:
> 1. Load drop down menus
> 2. Load data grids
>
> "Postback process"
> 1. Select datagrid row
> 2. Populate several fields below with further information
>
> When I select the datagrid row, IsPostBack remains false. I've tried
> splitting into multiple update panels but now they are all in a
> singular panel.
>
> TIA for the help!
>
Re: AJAX and IsPostBack
am 07.04.2008 19:57:41 von bm
On Apr 7, 1:01 pm, "George Ter-Saakov" wrote:
> AJAX call runs as a POST back. Just test it...
>
> George."BM" wrote in message
>
> news:a91154c5-39c2-4a5f-9c2a-4a586ef9b1cd@u69g2000hse.google groups.com...
>
> >I have a question that seems like it should have a simple answer, but
> > I can't seem to find it by searching...
>
> > Anyway, I'm trying to capture the IsPostBack event when I select an
> > item within an UpdatePanel. I don't want items running during
> > postback (list, grid population, etc) events - pretty standard: If
> > IsPostBack Then Exit Sub
>
> > But, since AJAX doesn't technically postback (?), the IsPostBack is
> > coming back false...
>
> > So, how can I capture the Async postback done by AJAX? Is there any
> > IsAsyncPostBack keyword and what library is it in?
>
> > Page load process:
> > 1. Load drop down menus
> > 2. Load data grids
>
> > "Postback process"
> > 1. Select datagrid row
> > 2. Populate several fields below with further information
>
> > When I select the datagrid row, IsPostBack remains false. I've tried
> > splitting into multiple update panels but now they are all in a
> > singular panel.
>
> > TIA for the help!
Thanks - I did test it and I suppose I wasn't 100% clear. It _does_
run a PostBack but it runs through the page initialization once first
with IsPostBack=False and then it runs it again with IsPostBack=True
Page_Init() [originally under PreRender]
1 If IsPostBack Then
2 Exit Sub
3 End If
4
5 loadDropDowns()
6 loadIncompleteGrid()
Obviously when I first load the page, lines 5 and 6 run.
When I click on the DataGrid, it runs lines 5 and 6 and then runs
through again with the break at line 2
Maybe then there's something more wrong with my pages...
Re: AJAX and IsPostBack
am 07.04.2008 21:30:22 von Mark Fitzpatrick
You may want to play with the timing. Try moving your calls to the
subroutines into an event that's further up the heirarchy such as the OnLoad
event. You should find that the behavior changes at some point as you get
further into the page lifecycle.
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression
"BM" wrote in message
news:d04a2cb1-0b23-4f11-aee4-2aa62de11a7c@a1g2000hsb.googleg roups.com...
> On Apr 7, 1:01 pm, "George Ter-Saakov" wrote:
>> AJAX call runs as a POST back. Just test it...
>>
>> George."BM" wrote in message
>>
>> news:a91154c5-39c2-4a5f-9c2a-4a586ef9b1cd@u69g2000hse.google groups.com...
>>
>> >I have a question that seems like it should have a simple answer, but
>> > I can't seem to find it by searching...
>>
>> > Anyway, I'm trying to capture the IsPostBack event when I select an
>> > item within an UpdatePanel. I don't want items running during
>> > postback (list, grid population, etc) events - pretty standard: If
>> > IsPostBack Then Exit Sub
>>
>> > But, since AJAX doesn't technically postback (?), the IsPostBack is
>> > coming back false...
>>
>> > So, how can I capture the Async postback done by AJAX? Is there any
>> > IsAsyncPostBack keyword and what library is it in?
>>
>> > Page load process:
>> > 1. Load drop down menus
>> > 2. Load data grids
>>
>> > "Postback process"
>> > 1. Select datagrid row
>> > 2. Populate several fields below with further information
>>
>> > When I select the datagrid row, IsPostBack remains false. I've tried
>> > splitting into multiple update panels but now they are all in a
>> > singular panel.
>>
>> > TIA for the help!
>
> Thanks - I did test it and I suppose I wasn't 100% clear. It _does_
> run a PostBack but it runs through the page initialization once first
> with IsPostBack=False and then it runs it again with IsPostBack=True
>
> Page_Init() [originally under PreRender]
> 1 If IsPostBack Then
> 2 Exit Sub
> 3 End If
> 4
> 5 loadDropDowns()
> 6 loadIncompleteGrid()
>
> Obviously when I first load the page, lines 5 and 6 run.
> When I click on the DataGrid, it runs lines 5 and 6 and then runs
> through again with the break at line 2
>
> Maybe then there's something more wrong with my pages...
Re: AJAX and IsPostBack
am 08.04.2008 20:36:18 von bm
On Apr 7, 3:30 pm, "Mark Fitzpatrick" wrote:
> You may want to play with the timing. Try moving your calls to the
> subroutines into an event that's further up the heirarchy such as the OnLoad
> event. You should find that the behavior changes at some point as you get
> further into the page lifecycle.
>
> Hope this helps,
> Mark Fitzpatrick
> Microsoft MVP - Expression
>
> "BM" wrote in message
>
> news:d04a2cb1-0b23-4f11-aee4-2aa62de11a7c@a1g2000hsb.googleg roups.com...
>
> > On Apr 7, 1:01 pm, "George Ter-Saakov" wrote:
> >> AJAX call runs as a POST back. Just test it...
>
> >> George."BM" wrote in message
>
> >>news:a91154c5-39c2-4a5f-9c2a-4a586ef9b1cd@u69g2000hse.goog legroups.com...
>
> >> >I have a question that seems like it should have a simple answer, but
> >> > I can't seem to find it by searching...
>
> >> > Anyway, I'm trying to capture the IsPostBack event when I select an
> >> > item within an UpdatePanel. I don't want items running during
> >> > postback (list, grid population, etc) events - pretty standard: If
> >> > IsPostBack Then Exit Sub
>
> >> > But, since AJAX doesn't technically postback (?), the IsPostBack is
> >> > coming back false...
>
> >> > So, how can I capture the Async postback done by AJAX? Is there any
> >> > IsAsyncPostBack keyword and what library is it in?
>
> >> > Page load process:
> >> > 1. Load drop down menus
> >> > 2. Load data grids
>
> >> > "Postback process"
> >> > 1. Select datagrid row
> >> > 2. Populate several fields below with further information
>
> >> > When I select the datagrid row, IsPostBack remains false. I've tried
> >> > splitting into multiple update panels but now they are all in a
> >> > singular panel.
>
> >> > TIA for the help!
>
> > Thanks - I did test it and I suppose I wasn't 100% clear. It _does_
> > run a PostBack but it runs through the page initialization once first
> > with IsPostBack=False and then it runs it again with IsPostBack=True
>
> > Page_Init() [originally under PreRender]
> > 1 If IsPostBack Then
> > 2 Exit Sub
> > 3 End If
> > 4
> > 5 loadDropDowns()
> > 6 loadIncompleteGrid()
>
> > Obviously when I first load the page, lines 5 and 6 run.
> > When I click on the DataGrid, it runs lines 5 and 6 and then runs
> > through again with the break at line 2
>
> > Maybe then there's something more wrong with my pages...
I've somewhat solved the problem just by setting the ScriptManager's
"LoadScriptsBeforeUI" property to False. It now registers a Postback
as such the first time around. Now it just calls my functions 2 or 3
times, so I'm at another issue. My pages have stopped throwing errors
at least for now.