Ajaxcontroltoolkit modalpopup extender with dynamic content

asp.net , ajaxcontroltoolkit , modalpopupextender , checkboxlist United States
  • 4 years ago

    I have a checkboxlist populated by a datasource having a textbox as a controlparameter. The checkboxlist is located within a modalpopup. When I click the button, the checkboxlist shows the list pertaining to the previous select. If I close and click the button to show the modalpopup, the second click shows the updated checkboxlist. I've tried everything I can think of and nothing seems to work. The latest attempt is to have a dummy button (arcArcPat) for the modalpopup. I click on btnPrePat to get the dynamic checkbox, but no modalpopup appears. Of course, when I click on btnArcPat, everything's great because I've clicked on the btnPrePat first. I tried taking away the display:none; and then I only get a flash on the screen, nothing that stays. Help?

    <asp:Button ID="btnPrePat" runat="server" Text="pre arc" /><asp:Button ID="btnArcPat" runat="server" text="Search"  /> 
    <ajaxToolkit:ModalPopupExtender ID="mpePat" runat="server" TargetControlID="btnArcPat" PopupControlID="mpPat" DropShadow="true" BackgroundCssClass="modalBackground"></ajaxToolkit:ModalPopupExtender> 
    <asp:Panel ID="mpPat" runat="server" CssClass="modalPopup" Style="display: none;"> 
    <asp:CheckBoxList ID="cblPat" runat="server" RepeatDirection="Vertical" Font-Size="12px" /> 
    <asp:Button ID="btnPatClose" runat="server" Text="Close"   /> 
    </asp:Panel> 
    
        Protected Sub btnPrePat_Click(sender As Object, e As EventArgs) Handles btnPrePat.Click 
            ds = New Data.DataSet 
            strSql = "SELECT TOP (100) PERCENT t.patID,  myType FROM blah, blah" 
            da = New Data.SqlClient.SqlDataAdapter(strSql, cn) 
            Try 
                da.Fill(ds, "patSearch1") 
                If ds.Tables("patSearch1").Rows.Count > 0 Then 
                    cblPat.DataSource = ds.Tables("patSearch1") 
                    cblPat.DataTextField = ds.Tables("pat").Columns("myType").ToString 
                    cblPat.DataValueField = ds.Tables("pat").Columns("patID").ToString 
                    cblPat.DataBind() 
                End If 
            Catch ex As Exception 
                Response.Write(ex.ToString) 
            End Try 
            mpePat.Show() 
        End Sub
    
  • 4 years ago

    For anyone else - just wanted you to know that I figured out the bigger problem. Something must have corrupted the ajaxcontroltoolkit installation just enough. Once I re-referenced it, everything started working fine. Sorry for the trouble and thanks for your help.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” - Brian Kernighan