Hi,
I am new to the javascript side of Infragistics. I'm struggling with a few things. Take this simple example that I found on the forum.
var dropDown = $find("WebDropDown1");
dropDown.set_enabled(false);
If I use the "find" code like above, I get a null; however, if I use this:
var dropdown = document.getElementById('<%=ddlJobClassification.ClientID %>');
I get an object back, but no real properties for determining the selected value or text as if it doesn't recognize it as a dropdown. Am I missing something in order to get the basic "find" to work?
My next question, is there a resource or help section somewhere that shows what my options are clientside? Not the events, but things like the .set_enabled options? I know there is now javascript intellisense for 10.2 and the 4.0 framework, but we are not on 4.0.
Thanks,
Tami
Hi Tami,
I have put together a sample to demonstrate how to get the current selected value of WebDropDown from client side.
Please run the sample on your machine and after selecting some value in the dropdown click on the button, it will show you the alert box with the selected value.
Please review the sample to see if this approach meets your needs.
I hope this will help you.
NehaDeveloper Support EngineerInfragisticswww.infragistics.com/support
Let me know if you have any further questions with this matter.
Hi Angel,Why the Following code is not working ,It gives ctl as null.where Cityval is the WebDropDown in the form.the Same code works on Some Textbox Change Event.
$(document).ready(function ()
{
alert(ctl.get_value());
});
var ctl = $find('<%# Cityval.ClientId%>');
Hi guys,
$find will give you the object of the control, that's what you probably want. It uses the server side ID of the control as an argument, keep in mind this could be different if the control is in any kind of placeholders.
getDocumentbyID will give you the DOM element, you cannot invoke any specific functions on it, since it is just a HTML DOM element, in most cases - a DIV.
To select an item at the client side:
var dd = $find('the id of the control"); // look at "View Source" for the actual ID, if you're in doubt - where the add_init MS AJAX statements are
dd.get_items().getItem(0).select(true);
or even shorter:
dd.selectItemByIndex(0);
to change the item text/value:
item.set_text(newText);
item.set_value(newValue);
Hope it helps,
Angel
Sorry, I meant set the values at client side.
Thanks.
Hi tami,
I can get the selectedvalue of webdropdown, but I cannot select at client side the selected values in a multiselect combo, it works at server side but not at client side. any help would be appreciated.
Regards,