C1Dialog ShowModal from client side

Posted by: jamesw on 9 September 2020, 7:54 am EST

  • Posted 9 September 2020, 7:54 am EST

    Hello,

    I am upgrading from a very old version of the C1Dialog. What is the syntax in the current version to open / show a C1Dialog from within javascript? I don't want to postback.

    In the older version, I was using dialog.showModal();
  • Replied 9 September 2020, 11:00 pm EST

    Hello James,

    For the newer version, the following code is used:
    $('#<%=dialog.ClientID%>').c1dialog("open");


    Please refer to the demo sample for reference:
    https://demos.componentone.com/aspnet/ControlExplorer/C1Dialog/ModalDialog.aspx

    Regards,
    Manish Gupta
  • Replied 11 September 2020, 2:46 am EST

    That worked great. Thank you!

    Last question (hopefully) on this conversion - what about setUrl and set_text? How are those handled client side now? I need to set both dynamically in javascript.
  • Replied 13 September 2020, 8:54 pm EST

    Hi James,
    The Dialog can load the content from URL dynamically using the contentUrl property. Please refer to the following code snippet for reference:
    $("#dialog").c1dialog("option","contentUrl","https://google.co.in")


    Also, for changing text, you may get the element and change the content by DOM manipulation.

    Regards,
    Manish Gupta
  • Replied 14 September 2020, 8:21 am EST

    That worked great for the contentUrl. Here is what I ended up doing for the title which also worked great:

    $('#<%=dialog.ClientID%>').c1dialog("option", "title", "Insert Title Here");
  • Replied 14 September 2020, 4:12 pm EST

    Hello James,
    Thank you for notifying us that your issue has been resolved. We are glad to know it. We were not sure if you were referring to the Title of the Dialog. That is why we suggested the DOM manipulation.

    Thank you once again for sharing your efforts here.

    Regards,
    Manish Gupta
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels