Updatepanel and ObjectDataSource Bug?

Last post 12-04-2006 1:55 PM by kbghost. 7 replies.

Sort Posts:

  • Updatepanel and ObjectDataSource Bug?

    11-30-2006, 6:08 PM
    • Member
      115 point Member
    • kbghost
    • Member since 11-08-2006, 8:18 PM
    • Posts 39

    I have an issue with the updatepanel.  I have a button outside the updatepanel that is supposed to update the data that the gridview is displaying.  I am using the typical AsyncPostBackTrigger to bind to the button, but for some reason, the data is not being updated.  I even have a label inside the updatepanel to make sure the updatepanel is updating, but unfortunatley, the gridview's data stays old until I reload the page or sort the gridview. 

     Is this an UpdatePanel and ObjectDataSource bug? I've seen a Gridview update, but just not when it comes through objectdatasource.  Here is an example of my code.

    <

    asp:ObjectDataSource ID="objPlanInfo" runat="server" SelectMethod="ViewPlanInfo"  TypeName="DataLayer" />

    <

    asp:UpdatePanel ID="pnlPlanGrid" runat="server" UpdateMode="conditional">
    <ContentTemplate>
    <asp:GridView ID="gridPlanInfo" runat="server" AllowPaging="true" AllowSorting="true" DataSourceID="objPlanInfo"></asp:GridView>
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    </ContentTemplate>

    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="btnChangeUserPlan" />
    </Triggers>

    </

    asp:UpdatePanel>

    <asp:Button ID="btnChangeUserPlan" runat="server" Text="Submit" OnClick="btnChangeUserPlan_Click" />

  • Re: Updatepanel and ObjectDataSource Bug?

    11-30-2006, 8:13 PM
    • Participant
      1,863 point Participant
    • WishStar99
    • Member since 08-05-2006, 12:11 AM
    • VietNam
    • Posts 553

    Nah,

    You mist the EventName in your trigger. Add: EventName="Click"

     

    WS

    //---------------------------------------------//
    //------------------- Chloé ------------------//
    //---------------------------------------------//
  • Re: Updatepanel and ObjectDataSource Bug?

    11-30-2006, 8:13 PM
    • Participant
      1,863 point Participant
    • WishStar99
    • Member since 08-05-2006, 12:11 AM
    • VietNam
    • Posts 553

    Nah,

    You missed the EventName in your trigger. Add: EventName="Click"

     

    WS

    //---------------------------------------------//
    //------------------- Chloé ------------------//
    //---------------------------------------------//
  • Re: Updatepanel and ObjectDataSource Bug?

    11-30-2006, 9:20 PM
    • Member
      115 point Member
    • kbghost
    • Member since 11-08-2006, 8:18 PM
    • Posts 39
    I actually had that in before, it didn't work. I tried it again, same problem. Thanks though, any other suggestiosn?
  • Re: Updatepanel and ObjectDataSource Bug?

    12-02-2006, 9:03 PM
    • Member
      115 point Member
    • kbghost
    • Member since 11-08-2006, 8:18 PM
    • Posts 39
    So has anybody been able to get my example working? An update panel that contains a control that pulls data from an objectdatasource with a trigger from a button on the outside??
  • Re: Updatepanel and ObjectDataSource Bug?

    12-03-2006, 8:02 AM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 6:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • TrustedFriends-MVPs
    hello.

    well, it should work without any problems. i do have 1 questions though:

    1. are you getting a response form the server (use fiddler to check this)
    2. are you using master pages? if so, is the button in the master and the updatepanel in a content page? if this is the case, you need to get the uniqueid of the button instead of its id.
    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: Updatepanel and ObjectDataSource Bug?

    12-04-2006, 11:26 AM
    • Member
      115 point Member
    • kbghost
    • Member since 11-08-2006, 8:18 PM
    • Posts 39

    Ah friend! You are what they refer to as the "enlightened one".  It was indeed a naming error as both my button and update panel were inside a control that inherited from a master page. I feel like I'm closer, but not quite there yet.  I don't know how to give the button's clientID on the front end, so I just attached the triggers on the backend on pageload.  Here's the code.

    if (!Page.IsPostBack)
    {
    AsyncPostBackTrigger triggerBtn = new AsyncPostBackTrigger();
    triggerBtn.ControlID = btn.ID;
    triggerBtn.EventName = "Click";
    pnlPlanGrid.Triggers.Add(triggerBtn);
    }
    

    Now oddly enough, I still have the same issue.  I tried attaching triggerBtn.ControlID to the btn.ClientID, but it didn't work properly for some strange reason.  Am I missing anything else?

  • Re: Updatepanel and ObjectDataSource Bug?

    12-04-2006, 1:55 PM
    • Member
      115 point Member
    • kbghost
    • Member since 11-08-2006, 8:18 PM
    • Posts 39

    Hm, on second thought, that may not have been the issue, because they're both on the same control and you should be binding to the button's id name right?

     back to square one Sleep

Page 1 of 1 (8 items)