modalpopupextender.show not working- very wierd!

Rate It (1)

Last post 03-15-2007 10:50 AM by p309444. 9 replies.

Sort Posts:

  • modalpopupextender.show not working- very wierd!

    03-13-2007, 12:52 PM
    • Loading...
    • p309444
    • Joined on 03-13-2007, 12:35 PM
    • Posts 7

    Hi. I have a problem.

    I want to dynamically alter the contents of a modal popup before it is displayed. This is what I have so far:

    *I have set the targetcontrolID of the popup extender to a hidden button

    *I have a different button that when the user presses, alters the values of fields within the modalpopup panel. This all works

    *This is the wierd bit- as soon as i put modalpopupextender1.show() into the sub that handles the button click then EVERY button on the page does not fire.

     I have put breakpoints in and this has confirmed that the button.click events are not firing! I have been on at this for over 2 days now. Please help! I have included the sub that handles the button click

     

    Protected Sub btnnewtask_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNewTask.Click

         ddlConsortia.Enabled = True

         ddlPractice.Enabled =

    True

         hdnTaskID.Value =

    "0"

         txtPracticeLead.Text =

    "Practice User"

         ModalPopupExtender1.Show()

    End Sub

     

    .aspx:

     

    <asp:UpdatePanel ID="UpdatePanel5" runat="server" UpdateMode="Conditional">

    <ContentTemplate>

    <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="pnlAssign"

    TargetControlID="btndummy" BackgroundCssClass="modalBackground" DropShadow="true"

    CancelControlID="btnCancelTask" />

    <asp:Button ID="btnDummy" runat="server" Text="Button" style="display:none" />

    <asp:Panel ID="pnlAssign" runat="server" Visible="true" CssClass="modalPopup">

    Assign Objective

    <br />

    <br />

    <table>

    <tr>

    <td align="right">

    Consortia

    </td>

    <td align="left">

    <asp:UpdatePanel ID="UpdatePanel8" runat="server">

    <ContentTemplate>

    <asp:DropDownList ID="ddlConsortia" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2"

    DataTextField="consortia" DataValueField="consortia" Enabled="False">

    </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:INFONET_DATAConnectionString %>"

    SelectCommand="select consortia from dbo.InfoNet_LookUpConsortia&#13;&#10;where purchpct='5kg' and priority = 2&#13;&#10;">

    </asp:SqlDataSource>

    </ContentTemplate>

    <Triggers>

    <asp:AsyncPostBackTrigger ControlID="btnNewTask" />

    </Triggers>

    </asp:UpdatePanel>

    &nbsp;

    </td>

    </tr>

    <tr>

    <td align="right">

    Practice

    </td>

    <td align="left">

    <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">

    <ContentTemplate>

    <asp:DropDownList ID="ddlPractice" runat="server" DataSourceID="SqlDataSource3" DataTextField="practicename"

    DataValueField="practicecode">

    </asp:DropDownList>

    </ContentTemplate>

    </asp:UpdatePanel>

    <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:INFONET_DATAConnectionString %>"

    SelectCommand="select practicename, practicecode&#13;&#10;from InfoNet_LookUpPractice&#13;&#10;where consortia= @consortia">

    <SelectParameters>

    <asp:ControlParameter ControlID="ddlConsortia" Name="consortia" PropertyName="SelectedValue" />

    </SelectParameters>

    </asp:SqlDataSource>

    </td>

    </tr>

    <tr>

    <td align="right">

    Practice lead

    </td>

    <td align="left">

    <asp:UpdatePanel ID="UpdatePanel9" runat="server">

    <ContentTemplate>

    <asp:TextBox ID="txtPracticeLead" runat="server"></asp:TextBox>

    </ContentTemplate>

    </asp:UpdatePanel>

    <span style="color: Red;">

    <asp:RequiredFieldValidator ID="vldpracticelead" runat="server" ControlToValidate="txtpracticelead"

    ErrorMessage="Practice lead is a required field" ForeColor="#6E90BD" Display="dynamic"></asp:RequiredFieldValidator>

    <cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" TargetControlID="vldpracticelead"

    HighlightCssClass="invalidControl">

    </cc1:ValidatorCalloutExtender>

    </span>

    </td>

    </tr>

    ....quite a large form.....

    </

    table>

    <br />

    <asp:Button ID="btnOKTask" runat="server" Text="OK" />

    <asp:Button ID="btnCancelTask" runat="server" Text="Cancel" />&nbsp;

    <asp:UpdatePanel ID="UpdatePanel7" runat="server">

    <ContentTemplate>

    <asp:HiddenField ID="hdnTaskID" runat="server" />

    </ContentTemplate>

    </asp:UpdatePanel>

    <br />

    <br />

    </asp:Panel>

    </ContentTemplate>

    <Triggers>

    <asp:AsyncPostBackTrigger ControlID="btnnewtask" />

    <asp:AsyncPostBackTrigger ControlID="btnoktask" />

    <asp:AsyncPostBackTrigger ControlID="btncanceltask" />

    </Triggers>

    </asp:UpdatePanel>

     

    any help would be great!

  • Re: modalpopupextender.show not working- very wierd!

    03-13-2007, 1:55 PM
    • Loading...
    • AjaxButter
    • Joined on 01-29-2007, 8:45 PM
    • Louisville, Colorado
    • Posts 130

    Just a thought off the top of my head is that your model is appearing in some manner as when a modal popup is fired it disables all the controls that aren't in the popup panel.  Is it possible you somehow set the panel that is popping up to invisible and your not seeing it but it really exists.

    AjaxButter

  • Re: modalpopupextender.show not working- very wierd!

    03-14-2007, 6:39 AM
    • Loading...
    • p309444
    • Joined on 03-13-2007, 12:35 PM
    • Posts 7

    Thanks for your reply. Thats what I thought, however other controls still work (I have a drop down list that when the selected index is changed, updates an update panel)- it is only the buttons that dont fire anymore.

     I also have a gridview, with a select column. when the user selects a row, then the fields in the modal popup are updated with values from the gridview row, then it shows the modal popup, I use this to enable users to edit the values in a database and it works! What i want to do is use the same modal popup to allow users to insert new rows into the database. This is where the button that resets all the fields then opens the modal popup comes into play, but so far no joy!

     I will try anything to get this to work!

  • Re: modalpopupextender.show not working- very wierd!

    03-14-2007, 6:40 AM
    • Loading...
    • p309444
    • Joined on 03-13-2007, 12:35 PM
    • Posts 7

    Thanks for your reply. Thats what I thought, however other controls still work (I have a drop down list that when the selected index is changed, updates an update panel)- it is only the buttons that dont fire anymore.

     I also have a gridview, with a select column. when the user selects a row, then the fields in the modal popup are updated with values from the gridview row, then it shows the modal popup, I use this to enable users to edit the values in a database and it works! What i want to do is use the same modal popup to allow users to insert new rows into the database. This is where the button that resets all the fields then opens the modal popup comes into play, but so far no joy!

     I will try anything to get this to work!

  • Re: modalpopupextender.show not working- very wierd!

    03-14-2007, 8:53 AM
    • Loading...
    • aquillin
    • Joined on 07-06-2006, 2:06 PM
    • San Antonio, TX
    • Posts 268

    After looking at you code, nothing pops out as being a problem.  So what I would try is to remove all the update panels, the retest the page.  If you get it to work, then one by one start adding back the update panels one by one till you find the culprit.  I have had similar problems and that was how i fixed it.  :)  Lemme know if that helps

     

    -Alan

  • Re: modalpopupextender.show not working- very wierd!

    03-14-2007, 10:49 AM
    • Loading...
    • p309444
    • Joined on 03-13-2007, 12:35 PM
    • Posts 7

    I already have done this. I started from scratch and added components to the page one by one. the page worked fine untill i added modalpopupextender.show() to the button.click event then it stopped wotrking completely. Even when i commented out the modalpopupexteder.show() line it didnt work! That is why i thought it was showing the popupup, but it wasnt visible, however that went out the window when i realised that other controls were working (ie drop down list).


    I think i have a work around. not ideal but if it works ill let you know.

     

    Thanks again

  • Re: modalpopupextender.show not working- very wierd!

    03-14-2007, 11:20 AM
    • Loading...
    • aquillin
    • Joined on 07-06-2006, 2:06 PM
    • San Antonio, TX
    • Posts 268

    are you running the ajax.net RTM or a beta?  Also what version of the toolkit are you running. 

    -Alan

  • Re: modalpopupextender.show not working- very wierd!

    03-15-2007, 7:11 AM
    • Loading...
    • p309444
    • Joined on 03-13-2007, 12:35 PM
    • Posts 7

    im not sure what version number it is, but its the latest one.

     I tried my work around, it kinda half works but still isnt what i wanted to do. Basically, buttons that are target controls for the modal popups still work(?!), just the others dont. I also have a gridview where the user can filter the data and select which columns are shown, so instead of having a refresh button to update the gridview, every control has autopostback set to true. so instead of the user choosing which columns they want then pressing refresh, now whenever they change the value of other controls on the page, the gridview updates automatically.

     

    Think this has beaten me, but if anyone has any ideas then i will be happy to try them

  • Re: modalpopupextender.show not working- very wierd!

    03-15-2007, 8:53 AM
    • Loading...
    • aquillin
    • Joined on 07-06-2006, 2:06 PM
    • San Antonio, TX
    • Posts 268

    I had a similar project that took me FOREVER to complete, but I ended up haveing to rely on javascript and AJAX to have it work correctly.  I also am relying on the AJAX to set the values inside my modal popup.  Here is my suggestion, and it is a big change, but remove the autopostback from the control and handle them client side using webservices.   Let me know if you need some help getting started.

     

    -Alan

  • Re: modalpopupextender.show not working- very wierd!

    03-15-2007, 10:50 AM
    Answer
    • Loading...
    • p309444
    • Joined on 03-13-2007, 12:35 PM
    • Posts 7

    I have it!Big Smile and it only took 4 days! lol.

     

    The modal popups have fields with validators on. all the buttons had causesvalidation set to true. when the buttons were pressed the fields to be validated were blank causing the validation to fail. Because the modalpopups work on the client side, they were loaded just not visible, so the button.click events were not firing because validation on the fields failed, despite not being visible!

     

    Simple reallyEmbarrassed

Page 1 of 1 (10 items)
Microsoft Communities