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

[Solved] multicolumn in combobox

2 Answers 168 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
abhay
Top achievements
Rank 1
abhay asked on 07 May 2009, 05:39 AM
Is it possible that i have items in combobox in two column like this
on column have text and another have value.

plz help me.

Actinic Keratosis

702.1

Seborrheic Keratosis, Inflamed

702.0

Dermatitis, Stasis

504.9

Basal Cell Carcinoma, Face

173.9

 

 

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 07 May 2009, 06:03 AM
Hello Abhay,

You acn build multi-column menu by using templates in RadMenu. Checkout the online demo which shows how to embed HTML elements in the first level child items to build multi column items.
Multi-column Menu

Thanks,
Princy.
0
abhay
Top achievements
Rank 1
answered on 07 May 2009, 06:19 AM
The above example is static but i want it dynamically


here is the code

<

 

telerik:RadComboBox ID="RadComboBoxDiagnosis" runat="server" Height="170px" ShowMoreResultsBox="True"

 

 

Width="100%" EnableLoadOnDemand="True" OnItemsRequested="RadComboBoxDiagnosis_ItemsRequested"

 

 

Style="margin: 0 auto 0 0px; display: block !important;" EmptyMessage="Select a Diagnosis Description.."

 

 

AllowCustomText="false" ToolTip="Select Diagnosis" AutoPostBack="true" ExpandAnimation-Type="InCubic"

 

 

Skin="Hay" BackColor="#EDFBE1"

 

 

>

 

 

 

</telerik:RadComboBox>

 

 

private DataTable GetData(string text)

 

{

 

string app = string.Empty;

 

 

if (text.Length > 0)

 

{

app =

"DESCRIPTION LIKE '" + text.Replace("'", "''") + '%' + "' AND";

 

}

 

string diagnosisData = "select DESCRIPTION,FK_CODE_VALUE,PK_ALL_CODE_DESC_ID from M_ALL_CODES_DESC WHERE " + app + " STATUS=1 order by DESCRIPTION ";

 

 

DataTable dtData = SqlHelper.ExecuteDataset(new Connection().GetCon, CommandType.Text, diagnosisData).Tables[0];

 

 

return dtData;

 

}

 

protected void RadComboBoxDiagnosis_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)

 

{

 

DataTable data = GetData(e.Text);

 

RadComboBoxDiagnosis.Items.Clear();

 

string text = e.Text;

 

 

DataRow[] rows = data.Select();

 

 

int itemsPerRequest = 10;

 

 

int itemOffset = e.NumberOfItems;

 

 

int endOffset = itemOffset + itemsPerRequest;

 

 

if (endOffset > rows.Length)

 

{

endOffset = rows.Length;

}

 

for (int i = itemOffset; i < endOffset; i++)

 

{

RadComboBoxDiagnosis.Items.Add(

new RadComboBoxItem(data.Rows[i]["DESCRIPTION"].ToString(), data.Rows[i]["FK_CODE_VALUE"].ToString()));

 

}

 

// e.Message = String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset, rows.Length);

 

 

 

 

e.Message = GetStatusMessage(endOffset, data.Rows.Count);

}

 

private static string GetStatusMessage(int offset, int total)

 

{

 

if (total <= 0)

 

 

return "No matches";

 

 

return String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", offset, total);

 

}


if i wll add itemtemplate

 

 

<ItemTemplate>

 

 

 

 

 

 

<table border="1px"><tr><td><asp:Label ID="lblDig" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "DESCRIPTION") %>'></asp:Label></td>

 

 

 

 

 

 

<td><asp:Label ID="lblCode" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "FK_CODE_VALUE") %>'></asp:Label></td></tr></table>

 

 

 

 

 

 

</ItemTemplate>

 

 

 



it doesn't work

plz help me.

 

 

 


 

Tags
ComboBox
Asked by
abhay
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
abhay
Top achievements
Rank 1
Share this question
or