MultiSelectionDropDown

Is there a way to set both the datatextfield and datavaluefield and get the datatextfield in the to display in the text field?

The default behavior appears to use the datatextfield unless a the datavaluefield is populated.

I need the datavaluefield for updates but want the users to see just the datatextfield in the textbox.

3 Replies

MA Maheswari Syncfusion Team May 31, 2007 02:12 PM UTC


Hi Richard,

I am afraid that there is no property to display the datatextfield value in the textbox when both fields are set.

I have created a feature request and notified our development team on this regard.

Please let me know if you have any other questions.

Thank you for using Syncfusion products.

Regards,
Maheswari


RS Richard Slauenwhite May 31, 2007 02:21 PM UTC

I guess the obvious next question is "If we have the source code, should I be able to make the change?"


MA Maheswari Syncfusion Team June 1, 2007 08:35 AM UTC


Hi Richard,

I regret for the inconvenience caused. On further investigation we have found that to use datatextfield value in the textbox when both datatextfield and datavaluefield are set can be achieved by using the below code :

[Code]
function OnItemChecked(Odata)
{
// Get Text separator symbol from Controls attribute collection.
var TextSepearator=document.getElementById("MultiSelectionDropDown1").getAttribute('TextSeparator');
var sText = "";
// Get the number of Checked Items in the Control's Popup
var nSelItemsCount = Odata.Instance.SelectedItems.length;
if( 0 < nSelItemsCount )
{
//Iterate and form the string with CheckedItems Text and Text separator
for( var i = 0; i < nSelItemsCount - 1; i++ )
{
var oItemData = Odata.Instance.SelectedItems[ i ];
sText += oItemData.Text + TextSepearator;
}
sText += Odata.Instance.SelectedItems[ nSelItemsCount - 1 ].Text;
}
//In the attached sample, I have displayed the Value field by an Div Tag, ' Value '. Client Objects 'NewText ' property have Checked Items Value field.
document.getElementById("Value").innerText=Odata.NewText;
//Return the string
return sText;
}

Please refer the attached sample which illustrates the above :
Forum_61679.zip

I hope this helps you.

Thank you for using Syncfusion products.

Regards,
Maheswari


Loader.
Up arrow icon