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.
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?
//You set the prompt for the value list the firts time
.Prompt = "Select please..";
{
}
Regarding the above post by Salki, I have also found the same issue, if i set the SelectedItemIndex of a column of type Dropdownlist, it doesnt work.
Please let me know if you have a solution to it
Thanks,
Ramya
HI,
I have an ultragrid with a column.style = dropdownlist
this dropdopnlist have some items
i need to select one of those items
i tried like this
public void AddTransactionRow(int BillTypeID, int PartnerID, int TranID)
int RowNo = this.ugrdJournalDet.Rows.Count;
this.ugrdJournalDet.DisplayLayout.Bands[0].AddNew();
this.ugrdJournalDet.Rows[RowNo].Cells["DetailsType"].ValueList.SelectedItemIndex= BillTypeID;
this.ugrdJournalDet.Rows[RowNo].Cells["ItemID"].ValueList.SelectedItemIndex = PartnerID;
this.ugrdJournalDet.Rows[RowNo].Cells["PaymentID"].ValueList.SelectedItemIndex = TranID;
didn't work!
this column "DetailsType" is dropdownlist.
anybody helps me.
Salki
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.