Hi guys, I am having trouble doing something I thought would be simple.
The scenario:
1. A combobox on a page with autopostback set to true and a sub in the codebehind that I want to fire whenever the combobox changes.
Protected Sub cmbxHerbicide_SelectedIndexChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles cmbxHerbicide.SelectedIndexChanged
Dim con As New S
.............
..............
End Sub
2. On page load I grab a querystring and use it to change the combobox.
cmbxHerbicide.SelectedValue = Request.QueryString("ActiveID")
Ok, when I run this the combobox is changed as expected but the sub does not fire.
So I thought I would try:
cmbxHerbicide.SelectedValue = Request.QueryString("ActiveID")
cmbxHerbicide_SelectedIndexChanged(e, e)
This produces an error.
Unable to cast object of type 'System.EventArgs' to type 'Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs'
How do I get around this?
I had expected that if I had AutoPostback set to true, and I changed the selection then the SelectedIndexChanged would fire.
What event args do I need to send?
Cheers
Ian
PS. The sub fires fine if I manually change the combobox. The reason I am doing it in this way is that sometimes I want to run the code from a value pulled from a querystring, but once the user is on the page they can then go and select other values. A worst case scenario is that I duplicate lots of code, I don't want to do that, the simple solution is to change the selection and call the sub.