"NULL" value in ComboBox

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    "NULL" value in ComboBox

    Hello,

    I have a problem with setting value "NULL" (as text) to ComboBox. I think it is a bug.

    A workaround is to add "null" (lowercase) to the combobox list (and then set Value = "null").

    Ext.Net version 3.3

    Regards
    P.K.

    test.aspx
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="pages_test" %>
    
    <!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">
        <div>
        
        </div>
        </form>
    </body>
    </html>
    test.aspx.cs
    using System;
    using System.Collections.Generic;
    using System.Web;
    using Ext.Net;
    
    public partial class pages_test : System.Web.UI.Page
    {
      protected void Page_Load(object sender, EventArgs e)
      {
        ResourceManager res_man = new ResourceManager();
        res_man.IDMode = IDMode.Explicit;
        res_man.DisableViewState = true;
        res_man.AjaxViewStateMode = Ext.Net.ViewStateMode.Disabled;
        res_man.DirectMethodNamespace = "dm";
    
        this.Controls.Add(res_man);
    
        Panel panel1 = new Panel() {ID = "panel1", Width = 300, Height = 200 };
        form1.Controls.Add(panel1);
    
        ComboBox combo1 = new ComboBox() { ID = "combo1" };
        combo1.Items.Add(new ListItem("NOT NULL"));
        combo1.Items.Add(new ListItem("NULL"));
        panel1.Items.Add(combo1);
    
        combo1.Value = "NULL";
      }
    }
  2. #2
    Hello P.K.!

    Please use this:

    combo1.SelectedItems.Add(new Ext.Net.ListItem("NULL"));
    Although it may look much longer, it is a more appropriate way on setting the selected item in combo boxes. The .Value approach should work, but in fact, the string NULL is interpreted as "assume the default value" and is not sent to client side to build the page at all. Adding the item to the selection ensures an actual pair name-value should be matched (although only the value part is important.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Thank you, it works.

    Regards
    P.K.

Similar Threads

  1. Replies: 2
    Last Post: Jun 16, 2016, 3:48 PM
  2. Replies: 1
    Last Post: Apr 06, 2016, 12:05 PM
  3. Replies: 1
    Last Post: Sep 30, 2013, 10:46 AM
  4. [CLOSED] "GetRowClass" Handler Returns "rowParams" null
    By cleve in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Sep 12, 2013, 9:32 PM
  5. Replies: 6
    Last Post: May 31, 2013, 3:04 AM

Tags for this Thread

Posting Permissions