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

RadGrid FilterTemplate - RadComboBox Empty Line

4 Answers 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sunny
Top achievements
Rank 1
Sunny asked on 07 Oct 2009, 05:37 PM
HI,

I want to display an empty line in the RadComboBox as a first element without checkbox in it. see the code below,

<Telerik:GridBoundColumn HeaderText="DEmo" DataField="DEmo">
<FilterTemplate>
<Telerik:RadComboBox ID="RadCombo1" runat="server" DataTextField="CMBITEM" DataValueField="CMBITEM" DataSourceID="SQLDS" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("DEmo").CurrentFilterValue %>' AppendDataBoundItems="true" Width="100" OnClientDropDownClosing="mouseouts" EmptyMessage="">
<ItemTemplate>
<div  id="div1" onclick="StopPropagation(event)" />
<asp:CheckBox runat="server" ID="CheckBox1" Text='<%# Eval("CMBITEM") %>' onClick="onCheckBoxClick(this);" />
</ItemTemplate>
</Telerik:RadComboBox>

Withthis Combobox is displaying like

Combo: 
CheckBox with Item1
CheckBox with Item2
CheckBox with Item3

I want
Combo: 
[Empty Line]
CheckBox with Item1
CheckBox with Item2
CheckBox with Item3

If I use this code below,

    Protected Sub RadCombo1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim RAB As RadComboBox = DirectCast(sender, RadComboBox)
        RAB.Items.Insert(0, New RadComboBoxItem(""))
    End Sub

I am getting,

Combo: 
Checkbox [Empty Line]
CheckBox with Item1
CheckBox with Item2
CheckBox with Item3

4 Answers, 1 is accepted

Sort by
0
Sunny
Top achievements
Rank 1
answered on 08 Oct 2009, 01:25 PM
Any one?
0
Shinu
Top achievements
Rank 2
answered on 09 Oct 2009, 05:10 AM
Hello,

Try adding HeaderTemplate for RadComboBox for showing an empty line in the RadComboBox as first item.

aspx:
 
<telerik:RadComboBox ID="RadCombo1" runat="server" DataTextField="CMBITEM" DataValueField="CMBITEM" 
    DataSourceID="SQLDS" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("DEmo").CurrentFilterValue %>' 
    AppendDataBoundItems="true" Width="100" OnClientDropDownClosing="mouseouts" EmptyMessage=""
    <HeaderTemplate> 
        <div id="div1" style="height: 15px;"</div> 
    </HeaderTemplate> 
    <ItemTemplate> 
       . . . 
    </ItemTemplate> 
</telerik:RadComboBox> 

-Shinu.
0
Sunny
Top achievements
Rank 1
answered on 09 Oct 2009, 12:34 PM
Thanks. But the radcombo shows the first item in the itemtemplate as default selected item!!
0
Sebastian
Telerik team
answered on 15 Oct 2009, 12:01 PM
Hello TelNew,

Using the code implementation from your first post, try the following modification of the ItemTemplate of the combobox instance:

<ItemTemplate>
  <div  id="div1" onclick="StopPropagation(event)" />
  <asp:CheckBox runat="server" ID="CheckBox1" Text='<%# Eval("CMBITEM") %>' Visible='<%# IIF(Eval("CMBITEM") Is String.Empty, False, True) %>'  onClick="onCheckBoxClick(this);" />
</ItemTemplate>

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Sunny
Top achievements
Rank 1
Answers by
Sunny
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Sebastian
Telerik team
Share this question
or