This is a migrated thread and some comments may be shown as answers.

How to combine two fields to DataTextField

4 Answers 1932 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Zheng
Top achievements
Rank 1
Zheng asked on 23 Jun 2011, 05:33 AM
Hi,
the code I am using like this:  <telerik:RadComboBox ID="RadComboBox1" runat="server" Width="300px" DataSourceID="SqlDataSource1"
        DataTextField="ProdName" DataValueField="ProdID" AutoPostBack="True"  AppendDataBoundItems="true">

How can I combine two fields ProdID and ProdName in DataTextField, I just want to display ProdID & " " & ProdName in combox list
Many Thanks

Zheng

4 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 23 Jun 2011, 08:22 AM
Hi,

use below link for multi column combobox.
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multicolumncombo/defaultcs.aspx

or

Create one other column /field in your Business logic / in your SP for "ID & Name".

Thanks,
Jayesh Goyani
0
Zheng
Top achievements
Rank 1
answered on 24 Jun 2011, 12:12 AM
Hi
My Code was this

<

telerik:RadComboBox ID="RadComboBox1" runat="server" Width="300px" DataSourceID="SqlDataSource5"

 DataTextField="ProdName" DataValueField="ProdID" AutoPostBack="True" AppendDataBoundItems="true">

 <CollapseAnimation Type="OutQuint" Duration="200"> </CollapseAnimation

 

 <Items >
<telerik:RadComboBoxItem Value ="0" Text="ALL" Selected="true"/>

<telerik:RadComboBoxItem Value ="1" Text="NOT NULL ONLY" />

</Items>

It display first Line in combox is "All", then "Not Null Only", then all product name list
After I Add next code
 

<ItemTemplate>

<%# DataBinder.Eval(Container.DataItem, "ProdID") %> <%# DataBinder.Eval(Container.DataItem, "ProdName") %>

 </ItemTemplate>

 
It's works, It can display Items Id & Name, But first two lines is empty
How to make the first two lines still can display ALL and Not Null Only?
many thanks

Zheng Xu

    

0
Zheng
Top achievements
Rank 1
answered on 27 Jun 2011, 06:36 AM
Please help me about this question
0
Jayesh Goyani
Top achievements
Rank 2
answered on 27 Jun 2011, 06:46 AM
Hi,

get this data which was come from SqlDataSource5 and store in to Dataset /  linq / DataTable.
then add this two row at index 0 and 1.
then give  Dataset /  linq / DataTable to the radcombo's datasource.

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Zheng
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Zheng
Top achievements
Rank 1
Share this question
or