Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
590
Open WeDialogWindow from dropdownlist
posted

How do get a webdialogwindow to open by selecting a specific item in an asp dropdownlist? Also, is it possible to do this without setting the dropdownlist to autopostback?

Any help is much appreciated.

 

  • 24497
    Verified Answer
    posted

    Hi,

    There are set_windowState(state), show() and hide() member methods of dialog on client. You may use them on any event on client. Below example uses drop-down list action to show hide dialogs.

    <script type="text/javascript">
       function selectOnChange(select)
       {
        var i = select.selectedIndex;
        var dialog = null;
        if(i == 0)
         return;
        if(i == 1 || i == 3)
         dialog = $find('<%=WebDialogWindow1.ClientID%>');
        else
         dialog = $find('<%=WebDialogWindow2.ClientID%>');
        if(!dialog)
         return;
        if(i == 1 || i == 2)
        {
         //dialog.set_windowState($IG.DialogWindowState.Normal);
         dialog.show();
        }
        if(i == 3 || i == 4)
        {
         //dialog.set_windowState($IG.DialogWindowState.Hidden);
         dialog.hide();
        }
       }
    </script>

    <select onchange="selectOnChange(this)">
       <option>Select action</option>
       <option>Show Dialog1</option>
       <option>Show Dialog2</option>
       <option>Hide Dialog1</option>
       <option>Hide Dialog2</option>
    </select>

    <ig:WebDialogWindow ID="WebDialogWindow1" runat="server" Width="300px" Height="300px" WindowState="Hidden"></ig:WebDialogWindow>
    <ig:WebDialogWindow ID="WebDialogWindow2" runat="server" Width="100px" Height="100px" WindowState="Hidden"></ig:WebDialogWindow>