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, Sunil Mehta.
I'm not familiar with the old ComboBox and I'm not sure if I understood the right purpose of the options method. I found a method set_props() but I'm not sure if it's proper for your case. If not, you can describe me exactly what you want to achieve.
$find("webdropdown").set_props(value);
Best regards, Nikolay
Thanks Nikolay. We are very near to closure now. Here is another issue.
I have a function that fills a combobox with values based upon the value changed in another combobox control.The below function does that requirement:
function FillCombobox(Code,strValue) {var NextCombo;var appPath;var getFile;var countall;appPath = location.href;getFile = appPath.split("/");countall = getFile.length - 1;appPath = appPath.replace(getFile[countall], "FillSubCombo.aspx");
if (strValue !='') { var oXMLHTTP = new ActiveXObject( "Microsoft.XMLHTTP" ); var sURL = appPath + '?Code=' + Code + '&Value=' + strValue; oXMLHTTP.open( "POST", sURL, false ); oXMLHTTP.send(); if(oXMLHTTP.responseText!=''){
if (document.all.combobox.popup.length > 0) { var combolen = document.all.combobox.popup.length; for (var j=(combolen - 1); j >= 0 ; j--) { document.all.combobox.popup.options[j] = null; } } var opt0 = new Option("",""); document.all.combobox.popup.options[document.all.combobox.popup.length] = opt0; var sXMLReturn=oXMLHTTP.responseText; var MList = sXMLReturn.split('^'); for (var i=0; i < MList.length;i++) { var SList = MList[i].split('~'); var opt = new Option(SList[0],SList[1]); document.all.combobox.popup.options[document.all.combobox.popup.length] = opt; } document.all.combobox.popup.item(0).selected = true; document.all.combobox.popup.textfield.value = document.all.combobox.popup.item(0).text; } else { var opt0 = new Option("",""); document.all.combobox.popup.length=0; document.all.combobox.popup.options[NextCombo.length] = opt0; document.all.combobox.popup.item(0).selected = true; document.all.combobox.popup.textfield.value = document.all.combobox.popup.item(0).text; } } else { document.all.combobox.popup.item(0).selected = true; document.all.combobox.popup.textfield.value = document.all.combobox.popup.item(0).text; } }
Currently, the combobox that I am using in my application uses the below code snippet:document.all.combobox.popup.optionsDo we have any property/method in the webdropdown with the same functionality as options? I want to replacethe above lines in Bold with the code snippet for infragistics webdropdown.
The right method for you is not get_currentValue() but get_selectedItemIndex(). To get the value, use:
function wdd_SelectionChanged(sender, args) {
// use this line of code if you are inside WDD client-side event handler (now in SelectionChanged event).
var wddObject = sender, // in your case $find("webdropdown")
selectedIndex = wddObject.get_selectedItemIndex(),
value;
value = wddObject.get_items().getItem(selectedIndex).get_value();
}
Hi Nikolay,
Thanks for the reply.
value0 = wddObject.get_items().getItem(0).get_value(); works if we know the index of the item. My requirement is to retrieve value of selected item and not by index. I can find the index of the selected item and then use the above code snippet but that will be extra calculation for me. Can you please let me know the method to get the above kind of values like "0901|0" for a selected item.
FYI, I tried using
var value1 = $find("webdropdown").get_currentValue();
but this gives the text of the current item and not the value.
Here you can find the list of all WebDropDown client-side events. All of them accept 2 parameters: sender, which is reference to the WebDropDown client-side object; args - specific arguments for all the events. In this list you can find the different types of event arguments. The other option is if you have IntelliSence in your Visual Studio, it will show you all the possible values for the client-side events and you don't need the help.
In the second of your posts, the items that are in bold, I suppose are the values of any drop down item. So you can take them using the following code:
function wdd_Initialize(sender, args) {
// use this line of code if you are inside WDD client-side event handler.
var wddObject = sender;
// use this line of code if you are referencing the WDD from exteranl function.
// var wddObject = $find("<%=wdd.ClientID %>");
// get the value of the first item - "0901|0"
value0 = wddObject.get_items().getItem(0).get_value();
// get the text of the first item "ADR"
text0 = wddObject.get_items().getItem(0).get_text();
I have also one other suggestions for you. When you want to understand what methods are supported by the client-side WDD object, just put a breakpoint in you browser at the wddObject variable. Then, at runtime, you can inspect all the properties and methods of the control and find the most appropriate for you. This is what I'm doing. So finally if you want to focus on an element you need again to use the JavaScript method focus(). You just need to know which element you want to focus and to find it using the WDD client API. If it's the whole drop down I suppose it will be fine to use wddObject.focus(). But you need to investigate and check this.