8 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 14 Jul 2011, 10:29 AM
Hello Bhanu,
Try the following approach to achieve your requirement.
C#:
Thanks,
Shinu.
Try the following approach to achieve your requirement.
C#:
protected
void
Page_Load(
object
sender, EventArgs e)
{
RadComboBox1.DataSource = CreateDataSource();
RadComboBox1.DataTextField =
"Name"
;
RadComboBox1.DataValueField =
"ID"
;
RadComboBox1.DataBind();
}
protected
DataTable CreateDataSource()
{
DataTable dataTable =
new
DataTable();
dataTable.Columns.Add(
new
DataColumn(
"ID"
,
typeof
(
string
)));
dataTable.Columns.Add(
new
DataColumn(
"Name"
,
typeof
(
string
)));
DataRow dr = dataTable.NewRow();
dr[
"ID"
] =
"1"
;
dr[
"Name"
] =
"<b>FirstName1</b>LastName1"
;
dataTable.Rows.Add(dr);
DataRow dr2 = dataTable.NewRow();
dr2[
"ID"
] =
"2"
;
dr2[
"Name"
] =
"<b>FirstName2</b>LastName2"
;
dataTable.Rows.Add(dr2);
return
dataTable;
}
}
Thanks,
Shinu.
0

Bhanu
Top achievements
Rank 1
answered on 14 Jul 2011, 11:42 AM
Thanks for the quick response. Please see the attached output for the code. First name is not displayed in bold.
Please help. Here is the code I have used.
Please help. Here is the code I have used.
<
telerik:RadComboBox
ID
=
"RadComboBox1"
AutoPostBack
=
"true"
runat
=
"server"
Height
=
"120px"
Width
=
"500px"
>
</
telerik:RadComboBox
>
protected void Page_Load(object sender, EventArgs e)
{
RadComboBox1.DataSource = CreateDataSource();
RadComboBox1.DataTextField = "Name";
RadComboBox1.DataValueField = "ID";
RadComboBox1.DataBind();
}
protected DataTable CreateDataSource()
{
DataTable dataTable = new DataTable();
dataTable.Columns.Add(new DataColumn("ID", typeof(string)));
dataTable.Columns.Add(new DataColumn("Name", typeof(string)));
DataRow dr = dataTable.NewRow();
dr["ID"] = "1";
dr["Name"] = "<
b
>FirstName1</
b
>LastName1";
dataTable.Rows.Add(dr);
DataRow dr2 = dataTable.NewRow();
dr2["ID"] = "2";
dr2["Name"] = "<
b
>FirstName2</
b
>LastName2";
dataTable.Rows.Add(dr2);
return dataTable;
}
0

Bhanu
Top achievements
Rank 1
answered on 15 Jul 2011, 08:54 AM
Any update on this please ?
0

Shinu
Top achievements
Rank 2
answered on 15 Jul 2011, 09:51 AM
Hello Bhanu,
Change the mark up as follows.
aspx:
Thanks,
Shinu.
Change the mark up as follows.
aspx:
<
telerik:RadComboBox
runat
=
"server"
ID
=
"RadComboBox1"
AppendDataBoundItems
=
"true"
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"Select"
Value
=
"-1"
/>
</
Items
>
<
ItemTemplate
>
<%# Eval("Name") %>
</
ItemTemplate
>
</
telerik:RadComboBox
>
Thanks,
Shinu.
0

Bhanu
Top achievements
Rank 1
answered on 15 Jul 2011, 12:59 PM
Thanks. I followed your instructions. The dropdown is populated with bold text. But when the cursor is placed on any of the listed items those are not highlighted / selectable. When we click on any the items we got the attached error.
Please provide the solution.
Thanks
Bhanu.
Please provide the solution.
Thanks
Bhanu.
0

Bhanu
Top achievements
Rank 1
answered on 15 Jul 2011, 02:16 PM
Also please note that this RadComboBox is part of Site.Master page, not in .aspx page.
Please provide your update at the earliest. Thank you.
Please provide your update at the earliest. Thank you.
0

Bhanu
Top achievements
Rank 1
answered on 18 Jul 2011, 08:04 AM
Any update please.
0
Hello Bhanu,
One way to go around the error that you encounter is to turn off the request validation which is done at page level:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default14.aspx.cs" Inherits="Default14" ValidateRequest="false" %>
However, you should be aware that allowing the users to type html in the inputs is not safe nor secure. So you should be careful. Please take a look at the following forum thread where the same issue is being discussed.
Best wishes,
Kate
the Telerik team
One way to go around the error that you encounter is to turn off the request validation which is done at page level:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default14.aspx.cs" Inherits="Default14" ValidateRequest="false" %>
However, you should be aware that allowing the users to type html in the inputs is not safe nor secure. So you should be careful. Please take a look at the following forum thread where the same issue is being discussed.
Best wishes,
Kate
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!