Question : Opening modal from code behind

I'm trying to open a modal popup using a hidden div and I'm not getting any results.

Where am I going wrong?

Here is the jquery I'm using, C# is in the snippet.

$(document).ready(function () {
            $("#multiPartPanel").dialog({
                bgiframe: true, autoOpen: false, height: 200, modal: true
            });
        });

        function openDialog(id) {
            alert('s');
            $('#' + id).dialog('open');

        }
        function closeDialog(id) {
            $('#' + id).dialog('close');
        }      
1:
2:
3:
4:
5:
6:
7:
8:
if (parts.Length > 1)
            {
                viewMultiPart.DataSource = parts;
                viewMultiPart.DataBind();

                string script = "jQuery('#multiPartPanel').dialog('open'); return true";
                Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "open", script, true);
            }

Answer : Opening modal from code behind

Try the following.  The close function is unnecessary unless you want to click on something within the dialog to close it, otherwise you can just use the X in the title bar.  If you do want to close it the other way, just uncomment.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
$(function () {
        $("#multiPartPanel").dialog({
                bgiframe: true, 
                autoOpen: false, 
                height: 200, 
                modal: true
        });
        $("#someId").click(function() {
		$('#multiPartPanel').dialog('open');
	});
        
        //$("#someIdWithinDialog").click(function() {
	//	$('#multiPartPanel').dialog('close');
	//});
});
Random Solutions  
 
programming4us programming4us