nave

nave

  • NA
  • 31
  • 0

Show Jquery dialog from code behind - half way there...

Jul 25 2013 6:54 AM
I'm trying to open/show Jquery dialog from code behind like this:

<script type="text/javascript">
                                            $(document).ready(function () {
                                                $('#divToOpen').dialog({
                                                    autoOpen: false,
                                                    width: 700,
                                                    open: function (type, data) {
                                                        $(this).parent().appendTo("form");
                                                    }
                                                });
                                            });

                                            function showDialog(id) {
                                                $('#' + id).dialog("open");
                                            }

                                            function closeDialog(id) {
                                                $('#' + id).dialog("close");
                                            }
                                        </script>

code behind:

private void CloseDialog(string dialogId)
        {
            string script = string.Format(@"closeDialog('{0}')", dialogId);
            ScriptManager.RegisterClientScriptBlock(this, typeof(System.Web.UI.Page), UniqueID, script, true);
        }

        private void ShowDialog(string dialogId)
        {
            string script = string.Format(@"showDialog('{0}')", dialogId);
            ScriptManager.RegisterClientScriptBlock(this, typeof(System.Web.UI.Page), UniqueID, script, true);
        }

calling the ShowDialog from client side is showing/closing fine.
calling the CloseDialog function is working fine from code behind.

the problem is with the ShowDialog function from code behind. calling this function is showing the "divToOpen" div content but not in the jquery UI dialog popup window. just showing the div content on page.

so calling the function is working but only "half way" because the UI is not loading.

Please help
what am i doing wrong?

Answers (2)