AJAX and IsPostBack

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BM

    AJAX and IsPostBack

    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!
  • George Ter-Saakov

    #2
    Re: AJAX and IsPostBack

    AJAX call runs as a POST back. Just test it...

    George.
    "BM" <moore.brent@gm ail.comwrote in message
    news:a91154c5-39c2-4a5f-9c2a-4a586ef9b1cd@u6 9g2000hse.googl egroups.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!

    Comment

    • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

      #3
      RE: AJAX and IsPostBack

      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.Is InAsyncPostBack

      -- 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!
      >

      Comment

      • BM

        #4
        Re: AJAX and IsPostBack

        On Apr 7, 1:01 pm, "George Ter-Saakov" <gt-...@cardone.com wrote:
        AJAX call runs as a POST back. Just test it...
        >
        George."BM" <moore.br...@gm ail.comwrote in message
        >
        news:a91154c5-39c2-4a5f-9c2a-4a586ef9b1cd@u6 9g2000hse.googl egroups.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=Fals e 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 loadIncompleteG rid()

        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...

        Comment

        • Mark Fitzpatrick

          #5
          Re: AJAX and IsPostBack

          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" <moore.brent@gm ail.comwrote in message
          news:d04a2cb1-0b23-4f11-aee4-2aa62de11a7c@a1 g2000hsb.google groups.com...
          On Apr 7, 1:01 pm, "George Ter-Saakov" <gt-...@cardone.com wrote:
          >AJAX call runs as a POST back. Just test it...
          >>
          >George."BM" <moore.br...@gm ail.comwrote in message
          >>
          >news:a91154c 5-39c2-4a5f-9c2a-4a586ef9b1cd@u6 9g2000hse.googl egroups.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=Fals e 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 loadIncompleteG rid()
          >
          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...

          Comment

          • BM

            #6
            Re: AJAX and IsPostBack

            On Apr 7, 3:30 pm, "Mark Fitzpatrick" <markf...@fitzm e.comwrote:
            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" <moore.br...@gm ail.comwrote in message
            >
            news:d04a2cb1-0b23-4f11-aee4-2aa62de11a7c@a1 g2000hsb.google groups.com...
            >
            On Apr 7, 1:01 pm, "George Ter-Saakov" <gt-...@cardone.com wrote:
            AJAX call runs as a POST back. Just test it...
            >
            George."BM" <moore.br...@gm ail.comwrote in message
            >
            >news:a91154c 5-39c2-4a5f-9c2a-4a586ef9b1cd@u6 9g2000hse.googl egroups.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=Fals e 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 loadIncompleteG rid()
            >
            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
            "LoadScriptsBef oreUI" 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.

            Comment

            Working...