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.
Hi,
My issue is issue #1 and I am using Build 12.1.20121.1005.
Hi SunilMehta,
I would like to take a moment to clarify with you whether the issue we are addressing here is that:
(1) for WebDropDown1 --> when setting the dropdown value in code (such as: Dim index = ItemDropDown.Items.FindItemByValue("2").Index)......, the dropdown is not loading with the text for that index in the dropdown text editor
Or is the issue that,
(2) for WebDropDown2 --> for the index that WebDropDown1 is set to, the WebDropDown2_ItemsRequested event does not fire, resulting in the value list being empty
If the issue is the first (1), I would like to verify that you are using the most recent service release for your NetAdvantage product. If you are using NetAdvantage 2012 vol 1 the build you should be using is 20121.2048. If you are using NetAdvantage 2011 vol 2, the build you should be using is 20112.2159.
However, if the issue is the second (2), I can confirm that I am finding that when item index is set in code, for that item that ("WebDropDown1") is set to, the ItemsRequested event is not firing, which does make sense. To address this I set the WebDropDown Load event:
For example:
Protected Sub WebDropDown2_Load(sender As Object, e As System.EventArgs) Handles WebDropDown2.Load
Dim selectedValue As Integer = Integer.Parse(WebDropDown1.SelectedValue.ToString())
Dim persons As List(Of Person) = DataProvider()
Dim filtered As List(Of Person) = persons.Where(Function(p) p.ID = selectedValue).ToList()
Me.WebDropDown2.DataSource = filtered
Me.WebDropDown2.TextField = "Fname"
End Sub
Attached to this thread is the my full sample. Please note that the ig_res folder has been omitted due to file size constraints. For proper styling you will want to add the ig_res folder. To do so, simple open the web form designer (aspx) and accept the styles when prompted.
Please let me know if you need any additional assistance regarding this matter.
Hi SunilMeta,
I am revisiting this issue with a revised sample and will follow-up with you on this issue on or before Monday.
Hi Troy,
I have implemented cascading webdropdown functionality in a similar way as descibed in the demo. I sent a code-sample as well to you. I am looking for a solution to my problem where I am not able to set the current display item of a webdropdown from code-behind vb file.
I pulled together a demo that shows the cascading dropdown approach. Let me know if you need any additional assistance.