Is there a way to set the current display text and value of a webdropdown in the server-side(code behind vb file)?
Thanks,
Sunil Mehta.
Sunil,
Try one more thing. Set the item's Selected Value to true as well. Example:
test = testDropDown.Items.FindItemByValue("2")
testDropDown.SelectedItemIndex = test.Index
testDropDown.SelectedValue = test.Text
test.Selected = true;
Let me know if that works.
Regards,Jon Infragistics, Inc. <http://ko.infragistics.com/support/get-help.aspx>
Hi Jon,
not working. I am just able to see that the expected item has been selected but not displaying in the webdropdown.
You will want to use the SelectedValue field instead.
index = webdropdown1.Items.FindItemByValue("0804")
webdropdown1.SelectedItemIndex = index.Index
webdropdown1.SelectedValue = index.Text
Sincerely,
Jon
Infragistics, Inc.
<http://ko.infragistics.com/support/get-help.aspx>
For your information, I tried the below statement in the code-behind file to set the current text:
index = webdropdown1.Items.FindItemByValue("0804").Index
webdropdown1.SelectedItemIndex = index
webdropdown1.CurrentValue = webdropdown1.Items(index).Text
But it did not work. Still the webdropdown shows empty text and not the desired text.
Once I know the index, I would like to see the text of that index in the webdropdown. But I am not able to see that. How to accomplish this in the code-behind. After trying the way you described above, the item which I want to display in the webdropdown is not coming. But when I open the dropdown container, that item shows that it has been selected. I want to set that selected item to be the current display item in the webdropdown.