Hi,
I have a RadGrid with three Levels, with a GridDropDownColumn in the second level. I would like to get the SelectedValues of the Dropdownlist for all the rows in this column in InsertCommand so that I can check wether the newly inserted column value is a duplicate entry or not.
I am able to iterate through the items in the second level of the grid and retrieve the SelectedItem.text for each row, but to be able to check for duplicate I need to compare the new SelectedValue with the existing SelectedValue.
The code I am using is given below.
Any help is highly appreciated.
Thanks
Meera
I have a RadGrid with three Levels, with a GridDropDownColumn in the second level. I would like to get the SelectedValues of the Dropdownlist for all the rows in this column in InsertCommand so that I can check wether the newly inserted column value is a duplicate entry or not.
I am able to iterate through the items in the second level of the grid and retrieve the SelectedItem.text for each row, but to be able to check for duplicate I need to compare the new SelectedValue with the existing SelectedValue.
The code I am using is given below.
GridTableView nestedView1 = (GridTableView)parentItem.ChildItem.NestedTableViews[0];
foreach (GridDataItem childItem1 in nestedView1.Items)
{
if (childItem1.OwnerTableView.Name == "Products")
{
string selectedText= childItem1["ProductId"].Text;
GridEditableItem NewItem1 = (GridEditableItem)e.Item;
TableCell NewProdId = NewItem1["ProductId"];
string NewTxtProdId = (NewProdId.Controls[0] as DropDownList).SelectedValue;
string selectedValue="";
//Find a way to get selectedvalue of childItem1
if (selectedValue == NewTxtProdId)
{
DisplayMessage("This product id is already selected.");
e.Canceled = true;
}
}
}
Any help is highly appreciated.
Thanks
Meera