Hi
I have a RadListView with a RadComboBox in the fieldset itemtemplate, and the RadComboBox has a CheckBox ItemTemplate.
What I’m need to do is to change the text of the first item in my combobox and hide the checkbox.
It works fine if I have only one combobox but I need this in a ListView.
Thanks,
Nicole
protected void RadListView1_ItemDataBound(object sender, RadListViewItemEventArgs e) |
{ |
RadComboBox cmbColores = (RadComboBox)e.Item.FindControl("cbmColores1"); |
DataTable dt = CargarCombos(); |
//Add Item |
dt.Rows.Add(-1, ""); |
DataView dv = new DataView(); |
dv = dt.DefaultView; |
dv.Sort = "NombreCompleto"; |
DataTable dt1 = dv.ToTable(); |
cmbColores.DataSource = dt1; |
cmbColores.DataTextField = "NombreCompleto"; |
cmbColores.DataValueField = "SKUID"; |
cmbColores.DataBind(); |
//change text: first item combobox |
cmbColores.FindItemByValue("-1").Text = " -- Seleccione --"; |
RadComboBoxItem item = cmbColores.FindItemByValue("-1"); |
CheckBox chk = (CheckBox)item.FindControl("chk1"); |
//first item combobox |
chk.Visible = false; |
} |
<telerik:RadListView ID="RadListView1" Width="100%" AllowPaging="true" runat="server" |
ItemPlaceholderID="ProductsHolder" DataKeyNames="SKUID" OnNeedDataSource="RadListView1_NeedDataSource" |
OnItemDataBound="RadListView1_ItemDataBound" OnItemCommand="RadListView1_ItemCommand"> |
<ItemTemplate> |
<fieldset> |
<telerik:RadComboBox ID="cbmColores1" runat="server" Skin="Windows7" Width="180px" |
EmptyMessage="Color..." LoadingMessage="Cargando..." OnClientDropDownClosed="onDropDownClosing" |
AutoPostBack="False"> |
<ItemTemplate> |
<div onclick="StopPropagation(event)"> |
<asp:CheckBox runat="server" ID="chk1" Checked="false" /> |
<asp:Label runat="server" ID="Label1" AssociatedControlID="chk1"> |
<%# DataBinder.Eval(Container.DataItem, "NombreCompleto")%> |
</asp:Label> |
</div> |
</ItemTemplate> |
</telerik:RadComboBox> |
</fieldset> |
</ItemTemplate> |
<LayoutTemplate> |
<fieldset id="RadListView1" > |
</fieldset> |
</LayoutTemplate> |
</telerik:RadListView> |