Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

Assign Null to DropDownList Column

Last post 09-08-2008 12:22 by anwang168. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 09-04-2008 20:19

    Assign Null to DropDownList Column

    How can a user remove the value from a drop down list column after he/she selected an entry in the drop down list.

    We tried to assign an empty string to the UltraGridColumn.ValueList.Prompt property. However, the empty string entry can not even be found inside the dropdown list. If we assign anything other than empty string, it does show up as first entry in the dropdown list, but it will not stay selected after the focus exit the cell. The dropdown list will go back to the previous selected value.

     

    • Post Points: 20
  • 09-05-2008 1:00 In reply to

    Re: Assign Null to DropDownList Column

    Hello,

    I am tying to reproduce the problem locally, but unfortunately am not able to - it works great for me. Here is the code I am using - a column of type DropDownList and I am initializing its ValueList in the grid InitializeLayout event:

      <igtbl:UltraGridColumn BaseColumnName="CompanyName" IsBound="True"
                            Key="CompanyName" Type="DropDownList">
                            <Header Caption="CompanyName">
                                <RowLayoutColumnInfo OriginX="1" />
                            </Header>
                            <Footer>
                                <RowLayoutColumnInfo OriginX="1" />
                            </Footer>
                        </igtbl:UltraGridColumn>  

        protected void UltraWebGrid1_InitializeLayout(object sender, LayoutEventArgs e)
        {
            UltraGridColumn c = UltraWebGrid1.Columns.FromKey("CompanyName");
            c.ValueList.ValueListItems.Add("", "");
            c.ValueList.ValueListItems.Add("1", "1");
            c.ValueList.ValueListItems.Add("2", "2");
            c.ValueList.ValueListItems.Add("3", "3");
        }

    You can seein the screenshot that I am able to get the empty string display fine and on selection, it is correctly intesrted in the cell. What am I missing?


    Best Regards,
    Rumen Stankov (MCSD.NET)
    The Infragistics ASP.NET Team
    • Post Points: 20
  • 09-05-2008 12:10 In reply to

    Re: Assign Null to DropDownList Column

    We did not have an empty value in the ValueListItems.

    If we assign UltraGridColumn.ValueList.Prompt = "" and nothing is added in the dropdownlist. If we assign UltraGridColumn.ValueList.Prompt = "Please Select", the "Please Select" will always be the first entry in the dropdownlist. The problem is that we can not remove the value once it is assigned.

     Please replace the line c.ValueList.ValueListItems.Add("", ""); with c.ValueList.Prompt = ""; or c.ValueList.Prompt = "Please Select"; and try again and you will see my problem.

    • Post Points: 20
  • 09-05-2008 13:08 In reply to

    Re: Assign Null to DropDownList Column

    Hi. Im not sure if I understand what you're trying to achieve, but as far as I can think of, what you want to do is to have something like "Please select" as the prompt of the drop down in the column but once the user has selected some value, you want to remove the "Please select" string, right?

    Yo can do it like this:

    //You set the prompt for the value list the firts time

    .Prompt = "Select please..";

    and then you set it to null in the UpdateCell event, so it no longer be display as you have already selected a value. void UltraWebGrid1_UpdateCell(object sender, Infragistics.WebUI.UltraWebGrid.CellEventArgs e)

    {

    e.Cell.Column.ValueList.Prompt =
    null;

    }

    "Programming is an art form that fights back" _ Se habla español.
    • Post Points: 20
  • 09-08-2008 12:22 In reply to

    Re: Assign Null to DropDownList Column

    I was sorry that my question was not clear.

    My question was to remove the value from a cell if the cell is a dropdown list after a non-null value is selected. I guess the use of "Prompt" is not the right way to do this job. I do not think to ask user deleting the current row is a good solution.

    • Post Points: 5
Page 1 of 1 (5 items)
Powered by Community Server (Commercial Edition), by Telligent Systems