Hi,
I downloaded trial version of Webdropdown version:11.2.20112.1019 and started using that in my application to see whether it functions properly. If it works well, I can go ahead to buy paid license for this control.
It has been around 45 days I downloaded the control and now I am able to see one issue suddenly.
When I use $find("webdropdowninstance"), it retrieves NULL.
Is it because the trial version might have expired or there is some other issue. Please let me know.
Hi Nikolay,
So, you mean to say that I can define "ItemRequested" server-side event in my code-behind .vb file of the aspx page. Can you please give me an example on how to define the server-side event including the delegate and classes that needs to be defined.
Thanks,
Sunil Mehta.
Hi, Sunil Mehta.
Even you are accessing the values in the server-side you also need to bind the drop down with this values on the server. The architecture of the control doesn't allow you to load the items from your response in the client. Or it is possible but again, when you add every item on the client you should have OnItemAdded server-side event handler for every new item. I discussed this in the previous post and I don't think this is good idea.
That's why you need to go through the topic and understand it in details, because I think this is the best way for creating cascading drop downs. To summarize the idea of the topic:
1. You need to bind both drop downs on the server with appropriate data sources.
2. When you change a value in the first drop down, inside the client-side event SelectionChanged of the first drop down, you call client-side loadItems method of the second drop down.
3. This client-side loadItems fires the server-side event ItemRequested for the second drop down and passes the value that comes as selected value from the first drop down.
4. Inside ItemRequested you need to filter the data source by this selected value. This means you need to get the filtered values from the data base, that you need for the second drop down. After that you just bind the second drop down with the filtered data.
I hope this will help you.
Best regards, Nikolay
I am not accessing database from javascript. I am accessing database in a vb file and then by using AJAX in javascript, i am getting the values in javascript file. The variable "oXMLHTTP.responseText" contains all the values for a particular webdropdown in the .js file. I just want the items in "oXMLHTTP.responseText" variable to be loaded into the webdropdown.
Also, I am not able to understand exactly what I need to do in the server side in the "topic" link that you have shared above.
First of all I suggest you to read this topic and if you think it's proper, use the approach that is proposed.
In your sample you are using AJAX to take the data for the second drop down and I suppose you want to bind that data on the client. As far as I know this is not possible to happen only on the client-side, because the WebDropDown has only server-side data source, and if you want to add a item on the client it also should be added on the server. Even there is a client-side method for adding an item, if you want to use it you will need to add handler for the server-side OnItemAdded event and inside that handler you will need to add this new item to the drop down data source:
<script type="text/javascript">
function WebDropDown1_client_SelectionChanged(sender, args) {
var newItem = sender.get_items().getItem(0);
sender.get_items().add(newItem);
}
</script>
<ig:WebDropDown ID="WebDropDown1" runat="server" OnItemAdded="WebDropDown1_server_OnItemAdded">
<ClientEvents SelectionChanged="WebDropDown1_client_SelectionChanged"/>
</ig:WebDropDown>
So here you have one other problem. To add a new item to the drop down, it should be from type Infragistics.Web.UI.DropDownItem, which you can hardly create(In the code above, I'm just duplicating the first drop down item). And second - you are using AJAX, but again you need postback to add the new item, which I don't think it's good for the performance. Again I will suggest to to use the approach from the this topic.
If you want client-side binding you can use igCobmo, but it's part from our jQuery product.
Here is the explanation as what is happening in the above function. We would like to achieve the same functionality with the webdropdown.
There are 2 categories of webdropdown we have, one is a group webdropdown with values like 0100, 0200, 0300, 0400 and so on. All these values are retrieved from tables. Other is a sub webdropdown which loads value based upon the value in the group webdropdown. For example, if 0100 is being selected in group webdropdown, then the sub webdropdown will load all items starting with "01" and not any other values. Similarly for "0200", all values starting with "02". These values are also being retrieved from tables and sent to javascript under "oXMLHTTP.responseText". This object includes all the values to be loaded into sub webdropdown based upon the value selected in group webdropdown.
Now where I am getting the problem is: how to load these values into the sub webdropdown.
1. If (oXMLHTTP.responseText !='') // means sub webdropdown values have been fetched from tables
then, load all these values in the sub webdropdown. // We would like to know how to achieve this.
if 10 values have to be loaded in the sub webdropdown, then the cursor should be on the first one. The, from the 10 values, user can select any value if required.
2. If (oXMLHTTP.responseText = '') // means no values have been fetched from the tables.
then sub webdropdown should be empty. // We would like to know how to achieve this.
This entire functionality will be executed when the value in the group webdropdown changes. We are calling a function that executes these functionality on "valueChanged" client-side event of group webdropdown.