Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
660
Client side selection of the WebDropDown value and updating of the control text.
posted

I must be doing something wrong since for the asp.net DropDownList, I only needed 1 line of code.

ddlX.options[i].selected = true;

 

 

  Converting over to an ig control has been a lot of work.  1st my DropDowns are in a WebDialogWindow that starts off hidden which messes up the z-axis so I run the following:

 

 

 

 

 

function ddlInitialize(sender, args) {

 

 

try

{

sender.behavior.set_zIndex(200000);

}

 

 

catch

(err) {

alert(

'unable to initialize drop down' + err.description);

}

Then, in order to change the current selection I have to run the following routines:

 

 

 

 

 

 

 

 

function ddlClearSelection(ddl) {

 

for (var ix = 0; ix < ddl.get_items().get_length(); ix++) {

 

var item = ddl.get_items().getItem(ix);

 

if (item != null) {

item.unselect();

item.inactivate();

}

}

 

return false;

}

 

 

 

 

 

function ddlSelect(ddl, indx) {

ddlClearSelection(ddl);

ddl.set_selectedItemIndex(indx);

ddl.set_activeItemIndex(indx);

ddl.set_currentValue(ddl.get_items().getItem(indx).get_text(),

true);

ddl.get_items().getItem(indx).select();

ddl.get_items().getItem(indx).activate();

ddl._elements.Input.value = ddl.get_items().getItem(indx).get_text();

}

The markup for one of the WebDropDowns is as follows:

<

 

ig:WebDropDown ID="DropDownListAccountGroup2" runat="server" Width="200px" DropDownAnimationDuration="100" DisplayMode="DropDownList" EnableDropDownAsChild="False">

 

<ClientEvents Initialize="ddlInitialize" />

 

<ClientEvents SelectionChanged="ddlAcctGrpChng2" />

 

</ig:WebDropDown>

Parents Reply Children
No Data