[CLOSED] Multicombo Item format showing error while checking selected items

  1. #1

    [CLOSED] Multicombo Item format showing error while checking selected items

    Hi,

    I have given multiline format for items in multi combo. After select some items clicked on button to verify selected items. It is throwing error like "A potentially dangerous Request.Form value was detected from the client ...". Can you please check it where I have to modify? Please check the attachment...

    Click image for larger version. 

Name:	MultiComboCheck.PNG 
Views:	155 
Size:	14.7 KB 
ID:	3624

    
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="ExtMultiComboCheck.aspx.vb"
        Inherits="Testing_ExtMultiComboCheck" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" 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 runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:MultiCombo ID="cboContents" runat="server">
        </ext:MultiCombo>
        <ext:Button ID="btnShowSelected" runat="server" Text="Show Selected" Width="400">
            <DirectEvents>
                <Click OnEvent="ShowAllSelected">
                </Click>
            </DirectEvents>
        </ext:Button>
        </form>
    </body>
    </html>
    code behind...
    Imports Ext.Net
    Partial Class Testing_ExtMultiComboCheck
        Inherits System.Web.UI.Page
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not Ext.Net.X.IsAjaxRequest Then
                Call LoadComboInfo()
            End If
        End Sub
    
        Public Sub LoadComboInfo()
            Dim i As Integer
            cboContents.Items.Clear()
            cboContents.Items.Add(New Ext.Net.ListItem("All", "0"))
    
            For i = 1 To 6
                cboContents.Items.Add(New Ext.Net.ListItem("Delivery Name: " & i & "<br>" & "Item_mail" & i & "@item.com" & "<br>&nbsp;&nbsp;&nbsp;&nbsp;" & "Item_mail" & i & "@item.com", i))
            Next
        End Sub
    
        Public Sub ShowAllSelected(ByVal sender As Object, ByVal e As DirectEventArgs)
            Dim selectedInfo As String = ""
            Dim i As Integer
            If cboContents.SelectedItems.Count > 0 Then
                If cboContents.SelectedItems.Count >= 1 And cboContents.SelectedItems(0).Value <> "0" Then
                    For i = 0 To cboContents.SelectedItems.Count - 1
                        If cboContents.SelectedItems(0).Value <> "0" Then
                            selectedInfo = selectedInfo & cboContents.SelectedItems(i).Value & ","
                        End If
                    Next
                    selectedInfo = selectedInfo.Trim(",")
                End If
            Else
                selectedInfo = "x"
            End If
    
            Ext.Net.X.Msg.Alert("Selected Info", selectedInfo).Show()
    
        End Sub
    End Class
    Last edited by Daniil; Dec 27, 2011 at 3:26 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please look at this thread:
    http://forums.ext.net/showthread.php?16295

    If you will choose the option #2, you will need to send a MultiCombo's value manually.
  3. #3
    Here is the example for the option #2.

    Please note how it's formatted - the code behind are placed directly into the aspx markup within:
    <script runat="server">
        //code behind
    </script>
    and there is only Language in:
    <%@ Page Language="C#" %>
    The example below can be copied, pasted and launched without any changes.

    Please format your code samples the same way.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.MultiCombo1.Items.Add(new Ext.Net.ListItem("<span>item 1</span>", "1"));
                this.MultiCombo1.Items.Add(new Ext.Net.ListItem("<div>item 2</div>", "2"));
                this.MultiCombo1.SelectAll();
            }
        }
    
        protected void Submit(object sender, DirectEventArgs e)
        {
            string values = HttpUtility.HtmlDecode(e.ExtraParams["values"]),
                   r = "";
            List<Ext.Net.ListItem> items = JSON.Deserialize<List<Ext.Net.ListItem>>(values);
    
            foreach (Ext.Net.ListItem item in items)
            {
                r += HttpUtility.HtmlEncode(item.Text + " : " + item.Value) + "<br/>";
            }
            X.Msg.Alert("Submit", r).Show();
        }
    </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 runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:MultiCombo ID="MultiCombo1" runat="server" SubmitValue="false" />
            <ext:Button runat="server" Text="Submit">
                <DirectEvents>
                    <Click OnEvent="Submit">
                        <ExtraParams>
                            <ext:Parameter 
                                Name="values" 
                                Value="Ext.util.Format.htmlEncode(Ext.encode(MultiCombo1.getSelection()))" 
                                Mode="Raw" />
                        </ExtraParams>
                    </Click>
                </DirectEvents>
            </ext:Button>
        </form>
    </body>
    </html>
  4. #4
    Hi Daniil,

    Thank you. It is working. I didn't get you on the statement..."and there is only Language in:"


    Quote Originally Posted by Daniil View Post
    Here is the example for the option #2.

    Please note how it's formatted - the code behind are placed directly into the aspx markup within:
    <script runat="server">
        //code behind
    </script>
    and there is only Language in:
    <%@ Page Language="C#" %>
    The example below can be copied, pasted and launched without any changes.

    Please format your code samples the same way.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.MultiCombo1.Items.Add(new Ext.Net.ListItem("<span>item 1</span>", "1"));
                this.MultiCombo1.Items.Add(new Ext.Net.ListItem("<div>item 2</div>", "2"));
                this.MultiCombo1.SelectAll();
            }
        }
    
        protected void Submit(object sender, DirectEventArgs e)
        {
            string values = HttpUtility.HtmlDecode(e.ExtraParams["values"]),
                   r = "";
            List<Ext.Net.ListItem> items = JSON.Deserialize<List<Ext.Net.ListItem>>(values);
    
            foreach (Ext.Net.ListItem item in items)
            {
                r += HttpUtility.HtmlEncode(item.Text + " : " + item.Value) + "<br/>";
            }
            X.Msg.Alert("Submit", r).Show();
        }
    </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 runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:MultiCombo ID="MultiCombo1" runat="server" SubmitValue="false" />
            <ext:Button runat="server" Text="Submit">
                <DirectEvents>
                    <Click OnEvent="Submit">
                        <ExtraParams>
                            <ext:Parameter 
                                Name="values" 
                                Value="Ext.util.Format.htmlEncode(Ext.encode(MultiCombo1.getSelection()))" 
                                Mode="Raw" />
                        </ExtraParams>
                    </Click>
                </DirectEvents>
            </ext:Button>
        </form>
    </body>
    </html>
  5. #5
    Quote Originally Posted by rnachman View Post
    I didn't get you on the statement..."and there is only Language in:"
    I meant that you can leave only Language property in Page statement and remove others like:
    AutoEventWireup="false" 
    CodeFile="ExtMultiComboCheck.aspx.vb"
    Inherits="Testing_ExtMultiComboCheck"

Similar Threads

  1. MultiCombo not returning any selected items
    By dtamils in forum 1.x Help
    Replies: 3
    Last Post: Feb 27, 2013, 3:56 AM
  2. Replies: 0
    Last Post: Sep 19, 2011, 11:11 AM
  3. [CLOSED] Always selected Item is nothing for combobox as menu item
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 04, 2011, 4:51 PM
  4. Replies: 0
    Last Post: Feb 01, 2010, 12:42 PM
  5. Checking grid panel items
    By ranganath in forum 1.x Help
    Replies: 0
    Last Post: May 19, 2009, 5:54 AM

Tags for this Thread

Posting Permissions