开发者

Controlling visibility of an UpdatePanel on SelectedIndexChanged

After several hours of debugging this issue (see title) I am resorting to the internets. To state in advance, yes I have read the "Questions with similar titles" whilst creating this question. While they did provide some good insight, a solution has not been reached.

Here is the basic event map:

  1. Page loads, RadioListBox's first index[0] is set to selected="true".
  2. User selects other index, if a particular item value is chosen, set visibility to "true" of subsequent Panel

I am fairly new to the ASP.NET AJAX world, so any and all advice is appreciated. Unless you tell me to eat poo, I might not appreciate that.

Here is the code followed by steps I have taken to debug it.

Markup: (yes I know fieldsets not inside of form tags isn't semantic, I'll worry about that later)

<asp:UpdatePanel runat="server" ID="updpnlDDCancelPartnerOpts" UpdateMode="Conditional">
  <ContentTemplate>
    <asp:Panel runat="server" CssClass="frmDDCancelPartnerOpts">
      <fieldset>
        <legend>Digital Cancellation Options:</legend>
        <br />
        <asp:RadioButtonList ID="rdlstCancellOptions" runat="server" AutoPostBack="true"
                                    cssclass="rdBtnLstDDCancelOpts"                                 onselectedindexchanged="rdlstCancellOptions_SelectedIndexChanged">
          <asp:ListItem Value="cancelall" Selected="True">Cancel ALL Digital Distribution:</asp:ListItem>
          <asp:ListItem Value="canceldotcom">Cancel CD Baby ONLY:</asp:ListItem>
          <asp:ListItem Value="partnercancellations">Cancel From Specific Partners:</asp:ListItem>
        </asp:RadioButtonList>
      </fieldset>
    </asp:Panel>

    <asp:Panel runat="server" ID="pnlChecks"  CssClass="partner">
    </asp:Panel>
  </ContentTemplate>
  <Triggers>
    <asp:AsyncPostBackTrigger ControlID="rdlstCancellOptions" EventName="SelectedIndexChanged"/>
  </Triggers>
</asp:UpdatePanel>

CodeBehind: (I'm just posting the Event method, if you wis开发者_如何学运维h to see more, just ask :)

protected void rdlstCancellOptions_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (rdlstCancellOptions.SelectedValue == "partnercancellations")
            {
                pnlChecks.Visible = true;
                updpnlDDCancelPartnerOpts.Update();
            }
        }

Debuggin':

I have wrapped each ( the RLB control and the pnlChecks panel) in separate UpdatePanels, I have used triggers and not used them, with just about every combination of AutoPostBack.

Most of all though, when A break point is set on the event function, it hits it, iterates through it and then returns you to the page - without refreshing and setting the pnlChecks Panel to visible.

The ScriptManager is included in the MasterPage.

I know I'm probably leaving out hordes of information. It is late, however, and after a 17 hours work day ( no not all 17 hours was spent on this) I can no longer force my eyes to stare at a computer screen.

So please, if there is anything ( most likely obvious) that I am missing, feel free to share. +million internet to all!

Koohoy0x


Try this:

<asp:Panel runat="server" ID="pnlChecks" Visible="false" CssClass="partner"> 
     Show me
</asp:Panel> 

Your code is OK but the panel got nothing to show, it's already visible :)


Answer found. The parameter used to populate the datasource was local to a different method, thus returning null to the checkbox list. Debbuging using Count we figured out that the data wasn't even being generated. The Ajax is working fine, however. Thank you all for your response and time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜