1jaws
asked on
selected value problem
I have this codes below.. On this foreach (ddTo.Items) gives me all the customers inside the combobox, all I want whatever value is selected.. How can I get that? If I have more than one item SelectedValue is not working...by just saying .selectedValue = ..
<telerik:RadComboBox ID="ddTo" runat="server" Width="99%" Skin="Windows7" AutoCompleteSeparator=";"
DataSourceID="dsSelectCust omers" DataTextField="Name" DataValueField="custID"
EmptyMessage="Enter Name(s)" MarkFirstMatch="true" AllowCustomText="true"
ShowDropDownOnTextboxClick ="false" ShowToggleImage="false" />
string comboBoxValue="" ;
foreach (RadComboBoxItem item in ddTo.Items)
{
comboBoxValue = comboBoxValue + ((comboBoxValue == "") ? "" : ",") + item.Value;
}
<telerik:RadComboBox ID="ddTo" runat="server" Width="99%" Skin="Windows7" AutoCompleteSeparator=";"
DataSourceID="dsSelectCust
EmptyMessage="Enter Name(s)" MarkFirstMatch="true" AllowCustomText="true"
ShowDropDownOnTextboxClick
string comboBoxValue="" ;
foreach (RadComboBoxItem item in ddTo.Items)
{
comboBoxValue = comboBoxValue + ((comboBoxValue == "") ? "" : ",") + item.Value;
}
ASKER
no this didnt work.... item.Selected shows false all the time because this combobox is shows like a textbox, it is not pulls down like regular dropdown... because of this property makes combobox looks like text box...ShowDropDownOnTextbo xClick="fa lse"
I think the following thread addresses your problem:
problem in get selectedItems when use AutoCompleteSeparator
http://www.telerik.com/community/forums/aspnet-ajax/combobox/problem-in-get-selecteditems-when-use-autocompleteseparator.aspx
If that's the case, the following code should work for you:
problem in get selectedItems when use AutoCompleteSeparator
http://www.telerik.com/community/forums/aspnet-ajax/combobox/problem-in-get-selecteditems-when-use-autocompleteseparator.aspx
If that's the case, the following code should work for you:
string comboBoxValue="" ;
string[] selectedItemsText = ddTo.Text.ToString().Split(";");
foreach (string text in selectedItemsText)
{
RadComboBoxItem item = ddTo.FindItemByText(text) as RadComboBoxItem;
if (item != null)
{
comboBoxValue = comboBoxValue + ((comboBoxValue == "") ? "" : ",") + item.Value;
}
}
ASKER
I got those errors..
Error 10 The best overloaded method match for 'string.Split(params char[])' has some invalid arguments
Error 11 Argument 1: cannot convert from 'string' to 'char[]'
Error 10 The best overloaded method match for 'string.Split(params char[])' has some invalid arguments
Error 11 Argument 1: cannot convert from 'string' to 'char[]'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you so much it works perfect!!
Open in new window