Multi Select "Get Value" and "select all" from client side

  1. #1

    Multi Select "Get Value" and "select all" from client side

    I am converting Ext.Net 1.6 to 2.5.3 version.

    I also refer in the below post and Use code, but it is not working multiselect all items and getvalue indexof code in the 2.5.3 version.

    Code:

    http://forums.ext.net/showthread.php...om-client-side

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test11.aspx.cs" Inherits="JPortal.Test11" %>
    
    <%@ Import Namespace="System.Collections.Generic" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    
    <!DOCTYPE html>
    
    
        <script runat="server">
        protected void SelectAll(object sender, DirectEventArgs e)
        {
            for (int i = 0; i < MultiSelect1.Items.Count; i++) {
                MultiSelect1.SelectedItems.Add(new SelectedListItem(MultiSelect1.Items[i].Value));    
            }
            MultiSelect1.UpdateSelectedItems();
        }
    </script>
     
    <!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="Head2" runat="server">
        <title>Ext.Net 2.5.3 Example</title>
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:MultiSelect ID="MultiSelect1" runat="server">
            <Items>
                <ext:ListItem Text="Item 1" Value="Value1" />
                <ext:ListItem Text="Item 2" Value="Value2" />
                <ext:ListItem Text="Item 3" Value="Value3" />
            </Items>
             <ListConfig ID="ListConfig1" runat="server">
                                                        <Listeners>
                                                               
                                                             <ItemClick Handler="if (#{MultiSelect1}.getValue().indexOf('Value1') != -1) { 
                                                            
                                                                                     #{label1}.show();
                                                                                   
                                                                                } else {
                                                              
                                                                                     #{label1}.hide();
                                                                                 
                                                                                };" />
                                                                    </Listeners>
                                                                  </ListConfig>
        </ext:MultiSelect>
            <ext:Label ID="label1" runat="server" Text="Item1 Selected" Hidden="true"></ext:Label>
        <ext:Button ID="Button1" runat="server" Text="Select all">
            <DirectEvents>
                <Click OnEvent="SelectAll" />
            </DirectEvents>
        </ext:Button>
        </form>
            
      
    </body>
    </html>
    Error:

    Click image for larger version. 

Name:	error inner html.jpg 
Views:	11 
Size:	81.2 KB 
ID:	24205

    My Requirement:

    Task1:

    If I select Item 1 then label1 text should be displayed otherwise label1 text

    should be hidden.

    Task 2: If i select all items then the inner Html error is throwing.



    how can i achieve the above task and please help us on this issue.
    Last edited by yenkarthi; Sep 04, 2015 at 5:26 AM.
  2. #2
    Hi @yenkarthi,

    Task1:

    If I select Item 1 then label1 text should be displayed otherwise label1 text

    should be hidden.
    Please try:
    <ItemClick 
        Handler="... same here ..."
        Delay="1" />

    Task 2: If i select all items then the inner Html error is throwing.
    Please start a new forum thread.
  3. #3

    Always returning -1 value for indexof in the Multiselect Item Click event

    Thanks Daniil for valuable reply.

    If i select any item in the Multi select control then it is always returning -1 value in the below code. Please advise.

    <ItemClick Handler="if (#{MultiSelect1}.getValue().indexOf('Value1') != -1)
  4. #4
    I cannot reproduce. Please provide exact steps.

    For example, I am trying the following.
    <ItemClick 
        Handler="console.log(#{MultiSelect1}.getValue().indexOf('Value1'));"
        Delay="1" />
    1. Click "Item 2"
    2. "-1" appears in a console. That is expected, because the "Value1" item is not selected.
    3. Click "Item 1"
    4. "1" appears in a console. That is expected.
    5. Click "Item 3"
    6. "1" appears in a console. That is expected.
  5. #5
    thanks a lot, it is working

Similar Threads

  1. Replies: 2
    Last Post: Feb 26, 2015, 2:56 PM
  2. Replies: 6
    Last Post: May 31, 2013, 4:04 AM
  3. Replies: 5
    Last Post: May 02, 2012, 6:37 PM
  4. Replies: 4
    Last Post: Oct 11, 2011, 3:42 AM
  5. [CLOSED] MultiSelect "select all" from client side
    By jmcantrell in forum 1.x Premium Help
    Replies: 12
    Last Post: Sep 20, 2011, 1:04 PM

Tags for this Thread

Posting Permissions