| <telerik:RadComboBox ID="radCombo5" |
| runat="server" |
| Width="250px" |
| Height="150px" |
| DropDownWidth="298px" |
| EnableLoadOnDemand="true" |
| EnableVirtualScrolling="true" |
| MarkFirstMatch="false" |
| HighlightTemplatedItems="true" |
| EmptyMessage="Digitare il comune da ricercare" |
| OnClientItemsRequesting="radCombo5_OnClientItemsRequesting" > |
| <WebServiceSettings Method="GetCity5" Path="_Selection.aspx" /> |
| </telerik:RadComboBox> |
| [WebMethod] |
| public static RadComboBoxData GetCity5(RadComboBoxContext context) |
| { |
| RadComboBoxData comboData = new RadComboBoxData(); |
| List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(); |
| if (context.Text != "") |
| { |
| try |
| { |
| ComuneCollection comuneCollection = new ComuneCollection(); |
| string[] values; |
| values = context.Text.Trim().Split(' '); |
| Where w; |
| foreach (string item in values) |
| { |
| if (item != null && item.Trim() != string.Empty) |
| { |
| w = new Where(); |
| w.Comparison = Comparison.Like; |
| w.ColumnName = Comune.Columns.Descrizione; |
| w.ParameterValue = "%" + item + "%"; |
| if ((bool)context["checked"]) |
| w.Condition = Where.WhereCondition.OR; |
| else |
| w.Condition = Where.WhereCondition.AND; |
| comuneCollection.Where(w); |
| } |
| } |
| comuneCollection.Load(); |
| if (comuneCollection.Count <= 1000) |
| { |
| foreach (Comune comune in comuneCollection) |
| { |
| RadComboBoxItemData itemData = new RadComboBoxItemData(); |
| itemData.Text = comune.Descrizione; |
| itemData.Value = comune.Codprovincia + comune.Codcomune; |
| if (comune.Codcatastale.Trim() == string.Empty) |
| comune.Codcatastale = "ZZZ"; |
| itemData.Attributes.Add("Codcatastale", comune.Codcatastale); |
| result.Add(itemData); |
| } |
| comboData.Message = String.Format("Trovati <b>{0}</b> elementi per <b>'{1}'</b>", |
| comuneCollection.Count.ToString(), |
| context.Text); |
| } |
| else |
| { |
| comboData.Message = String.Format("Trovati più di <b>1000</b> elementi. Affinare la ricerca"); |
| } |
| } |
| catch (Exception ex) |
| { |
| comboData.Message = String.Format("<b>{0}</b>", ex.Message); |
| } |
| } |
| comboData.Items = result.ToArray(); |
| return comboData; |
| } |
This code is OK!!!
But if I insert ItemTemplate I have a problem.
| <telerik:RadComboBox ID="radCombo5" |
| runat="server" |
| Width="250px" |
| Height="150px" |
| DropDownWidth="298px" |
| EnableLoadOnDemand="true" |
| EnableVirtualScrolling="true" |
| MarkFirstMatch="false" |
| HighlightTemplatedItems="true" |
| EmptyMessage="Digitare il comune da ricercare" |
| OnClientItemsRequesting="radCombo5_OnClientItemsRequesting" > |
| <WebServiceSettings Method="GetCity5" Path="_Selection.aspx" /> |
| <HeaderTemplate> |
| <table style="width: 275px" cellspacing="0" cellpadding="0"> |
| <tr> |
| <td style="width: 177px;"> |
| Comune</td> |
| <td style="width: 60px;"> |
| CodIstat</td> |
| <td style="width: 40px;"> |
| CodCatasto</td> |
| </tr> |
| </table> |
| </HeaderTemplate> |
| <ItemTemplate> |
| <table style="width: 275px" cellspacing="0" cellpadding="0"> |
| <tr> |
| <td style="width: 177px;"> |
| <%# DataBinder.Eval(Container, "Text")%> |
| </td> |
| <td style="width: 60px;"> |
| <%# DataBinder.Eval(Container, "Value")%> |
| </td> |
| <td style="width: 40px;"> |
| <%# DataBinder.Eval(Container, "Attributes['Codcatastale']")%> |
| </td> |
| </tr> |
| </table> |
| </ItemTemplate> |
| </telerik:RadComboBox> |
The HeaderTemplate is ok.
But the ItemTemplate isn't apply, the Items are displayed in defualt mode.
Is It possibile apply Template on Item On ajax binding?
Thanx