multi select add selected item on server side

  1. #1

    multi select add selected item on server side

    is this the proper way to add a selected item for a multiselect in an ajax event?

    
    extmselQ.SelectedItems.Add(new SelectedListItem(drRight["wid"].ToString(), drRight["name"].ToString(), extmselQ.Items.IndexOf(new Coolite.Ext.Web.ListItem(drRight["id"].ToString(), drRight["name"].ToString()))));
    
    extmselQ.UpdateSelection();
    the selected item gets added when i check the code using a breakpoint but it doesn't show up on the page. this code is included on the BeforeShow event of a window containing a multi select item
  2. #2

    RE: multi select add selected item on server side

    Hi,

    Can you show full example? I made test sample and it works fine. Can you change BeforeShow to Show event?

    Here is my test sample
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
    
        <script runat="server">
            protected void SetSelection(object sender, AjaxEventArgs e)
            {
                MS1.SelectedItems.Add(new SelectedListItem("", "1", -1));
                MS1.SelectedItems.Add(new SelectedListItem("", "2", -1));
    
                MS1.UpdateSelection();
            }
        </script>
    
    </head>
    <body style="padding: 10px;">
        <form id="form1" runat="server">
        <ext:ScriptManager ID="ScriptManager1" runat="server"/>
        <ext:Button runat="server" Text="Show the window">
            <Listeners>
                <Click Handler="#{Window1}.show();" />
            </Listeners>
        </ext:Button>
        <ext:Window ID="Window1" runat="server" Width="300" Height="300" Title="Window" Show&#111;nload="false">
            <Body>
                <ext:MultiSelect ID="MS1" runat="server">
                    <Items>
                        <ext:ListItem Text="Text1" Value="1" />
                        <ext:ListItem Text="Text2" Value="2" />
                        <ext:ListItem Text="Text3" Value="3" />
                        <ext:ListItem Text="Text4" Value="4" />
                        <ext:ListItem Text="Text5" Value="5" />
                    </Items>
                </ext:MultiSelect>
            </Body>
            <AjaxEvents>
                <BeforeShow OnEvent="SetSelection">
                </BeforeShow>
            </AjaxEvents>
        </ext:Window>
        </form>
    </body>
    </html>

    Vladimir Shcheglov
    Sr. Developer
  3. #3

    RE: multi select add selected item on server side

    i was able to make it work now, just got wrong values on the function parameters. thanks anyways
  4. #4

    RE: multi select add selected item on server side

    just got another question... how do i refresh the page contained on the window's autoload property? without realoding the whole window...


    as of now i am using a client side refresh but the window content disappears after this function


    var win = Ext.getCmp('extwinPublicQSC_" + hdnQSID.Value + "'); 
    if (win) 
    { var updater = win.getUpdater(); 
        updater.disableCaching = true; 
       updater.update({url: 'Pages/PublicQuestionSetContent.aspx?pqsid=" + hdnQSID.Value + "'}); 
    }
  5. #5

    RE: multi select add selected item on server side

    Hi,

    just use reload function


    win.reload(true); 


    true - is mean that nocache




    Vladimir Shcheglov
    Sr. Developer

Similar Threads

  1. Replies: 0
    Last Post: Sep 19, 2011, 12:11 PM
  2. Replies: 0
    Last Post: Oct 25, 2010, 10:49 AM
  3. [CLOSED] Item Count for Store - Server Side
    By JD in forum 1.x Premium Help
    Replies: 1
    Last Post: Feb 02, 2010, 10:07 AM
  4. Replies: 0
    Last Post: Feb 01, 2010, 1:42 PM
  5. How to fire server side event for menu item.
    By Satyanarayana murthy in forum 1.x Help
    Replies: 5
    Last Post: Dec 03, 2009, 11:55 AM

Posting Permissions