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.
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?
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.