0
protected void btnSelectCommittee_Click(object sender, EventArgs e)
    {
        this.WebDialogWindow1.WindowState = Infragistics.Web.UI.LayoutControls.DialogWindowState.Normal;
    }

By using the above code, it can change the windowState of the web dialog window to visible. The problem now is it is refreshing the page. It seems that page refreshing can be avoided by using onClientClick method and call javascript function. However, I have no idea on how to update the window state of Infragistics DialogWindowState via Javascript. Please help!

SuicideSheep
  • 5,260
  • 19
  • 64
  • 117

2 Answers2

3

Of course, it would refresh the page. It's server-side handle that would require this to produce any changes on a remote client. However, don't forget ASP.NET controls also have a Client-side Object Model(CSOM) in JavaScript (which you can use to handle events and manipulate the control). I think what you need is this sample about Dialog Window Client Events and note in there you have the very same functionality (show button) ready for the Show Dialog image button in WebDialogFrame.aspx:

<img id="ShowDialogButton" src="<%= this.GetGlobalResourceObject("WebDialogWindow","ClientSideEvents_ShowDialogImage") %>" width="98"
            height="24"  alt="<%= this.GetGlobalResourceObject("WebDialogWindow","Client_Side_Events_Tooltip_1") %>" onclick="$find('<%=WebDialogWindow1.ClientID%>').set_windowState($IG.DialogWindowState.Normal);" />

I have taken out the important bit you can assign as click handler to whatever you see fit on the client-side and added explanations:

// Show the dialog
function showDialog() {
    // get reference to the Infragistics.Web.UI.WebDialogWindow instance 
    var dialog = $find('<%=WebDialogWindow1.ClientID%>');
    //perform any checks neccesary or skip them, it's ok to
    //set Normal state even if the dialog is already visible
    if (dialog.get_windowState() != $IG.DialogWindowState.Normal)
    //set state to Normal
        dialog.set_windowState($IG.DialogWindowState.Normal);
}
Damyan Petev
  • 1,585
  • 7
  • 10
  • Why is it necessary to have "if (dialog.get_windowState() != $IG.DialogWindowState.Normal)"? Why not just use "dialog.set_windowState($IG.DialogWindowState.Normal);" – Lill Lansey Oct 30 '13 at 15:15
  • It isn't really - I think I tried and the end result is the same, just trying avoid unnecessary actions (they are extremely tiny, yes). So as I have put it in the comments in code - feel free to skip, it's just a good spot to do general checks for this or any other logic that might dictate if the dialog should be shown. – Damyan Petev Oct 30 '13 at 16:16
2

The answer is fairly simple where it's possible to change the windowState without refreshing the page by using onClientClick="return showDialog();"

function showDialog() {
        var dialogWindow = $find('<%=WebDialogWindow1.ClientID%>');

        //Using `show()` method to display the window if the windowState is hidden
        dialogWindow.show();

        //using `hide()` method to hide the windowState
        //dialogWindow.hide();
        return false;
    }
SuicideSheep
  • 5,260
  • 19
  • 64
  • 117