Hi,
I'm having an asp dropdownlist with selectedindexchanged event.. I'm having around 4-5 infragistics webddropdown multi select boxes, Whenever user selects options in multidropdown list and again selects the above normal asp dropdownlist, the items selected in the multidropdown should be cleared and initial value should be set to "Please Select"..
How can i implement this in asp dropdownlist selectedindexchanged event??
Can anyone please help me out as its bit urgent..
Thanks,
Any solution for deselecting the infragistics multidropdown list items whenever asp drodownlist selectedindex is changed??
Please share any scripts for this
Hi pavanpuligandla,
Thank you for posting in the community.
A very similar scenario has been discussed at:
http://community.infragistics.com/forums/p/30177/161244.aspx
Below is some sample code illustrating a sample clientside handler for the ASP dropdownlist's onchange event.
Alternatively, the dropdown selection may be cleared on the server by calling the ClearSelection() method.
Hope this helps.
Petar Ivanov"] //unselect and inactivate the selected items while (dropdown.get_selectedItems().length > 0) { dropdown.get_selectedItems()[0].inactivate(); dropdown.get_selectedItems()[0].unselect(); } //set some default value in the dropdown's input field ig_controls.WebDropDown1._elements["Input"].value = "Default value";
//unselect and inactivate the selected items while (dropdown.get_selectedItems().length > 0) { dropdown.get_selectedItems()[0].inactivate(); dropdown.get_selectedItems()[0].unselect(); } //set some default value in the dropdown's input field ig_controls.WebDropDown1._elements["Input"].value = "Default value";
//unselect and inactivate the selected items while (dropdown.get_selectedItems().length > 0) { dropdown.get_selectedItems()[0].inactivate(); dropdown.get_selectedItems()[0].unselect(); }
//set some default value in the dropdown's input field ig_controls.WebDropDown1._elements["Input"].value = "Default value";
Where should i include this script? In InputKeyDown event or what? Please let me know..
Thanks
Hi pavanpilugandla,
Thank you for your reply.
The above code may be used in the SelectionChanged function previously used as the handler for the clienside onchange event of the ASP dropdownlist.
Please let me know if this helps.
This worked fine, But i dont want to give any clickable functionality on the dropdown, When i used the above script, and pressed HOME and END keys in the keyboard, Eventhough there are values selected in the dropdown were set to Please Select.
I'm using this function in InputKeyDown function..
<script language="javascript" type="text/javascript"> function ddlCBT_InputKeyDown(sender, eventArgs) { var dropdown = $find('<%=ddlCBT.ClientID %>'); //unselect and inactivate the selected items// while (dropdown.get_selectedItems().length > 0) {// dropdown.get_selectedItems()[0].inactivate();// dropdown.get_selectedItems()[0].unselect();// } //set some default value in the dropdown's input field dropdown._elements["Input"].value = "-Please Select-"; } </script>
Apologies for the delayed response.
I am unsure of the issue your are describing in your last, however after examining the matter further, in your scenario it may be more convenient to set the input element of the dropdown to be readonly upon initializing the WebDropDown. This may be done using something similar to:
function WebDropDown1_Initialize(sender, eventArgs){ sender._elements["Input"].readOnly = true;}
Hope this is helpful.
Thanks for the comeback..
This is working fine, But the items which are being selected are now deselected.. I got an idea here like,
after initialization event, we also need to write inputkeydown event like below as an example
function ddlSerLine_InputKeyDown(sender, eventArgs)
{ var dropdown = $find('<%=ddlSerLine.ClientID %>'); while (dropdown.get_selectedItems().length > 0) { dropdown.get_selectedItems()[0].inactivate(); //dropdown.get_selectedItems()[0].unselect(); } //set some default value in the dropdown's input field dropdown._elements["Input"].value = "-Please Select-"; }
function ddlSerLine_Initialize(sender, eventArgs) { sender._elements["Input"].readOnly = true; }
Once when the dropdown has been initialized, then the input box will be read only, when user tries to press the key then in InputKeyDown event we need to hold the selection, But in the above code, if the items are selected we are deselecting and deactiviting 'em, Instead of that i need to hold the selected values..
I hope you are clear on my issue..
Petar Ivanov"]After consulting with our developers regarding this matter it was determined that the behavior is most likely related to a development issue (as your requirement should be achievable by only setting EnableCustomValues to false which currently still allows editing through the delete and backspace buttons). In order to ensure that the matter will receive attention I have logged this behaviors in our internal tracking system with a Development IDs 111865. The next step would be for a developer to research the issues and confirm my findings or offer some resolution.
Dear Petar,
Many thanks for you concern on the issue we are facing, Sure will update if i get any breakthrough.. Again thanks for the support, Good work and keep going Infragistics!!
Thank you for your reply and apologies for the delayed response.
After consulting with our developers regarding this matter it was determined that the behavior is most likely related to a development issue (as your requirement should be achievable by only setting EnableCustomValues to false which currently still allows editing through the delete and backspace buttons). In order to ensure that the matter will receive attention I have logged this behaviors in our internal tracking system with a Development IDs 111865. The next step would be for a developer to research the issues and confirm my findings or offer some resolution.
Your support ticket number regarding this matter is CAS-90055-MJ2XF6 . Please feel free to send us any updates in the meantime. You can view the status of the development issue connected to this case by going to the “My IG” tab on our website, hovering to the "My Support Activity" dropdown and selecting the "Development Issues" tab.
Feel free to contact me if you have any questions.