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

System.Data.DataRowView displays instead of - SELECT - when row clicked

1 Answer 857 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 23 Jan 2013, 07:00 PM

My Combobox has an ItemTemplate consisting of a label and 2 Radbuttons (Checkbox Toggletype) on each row.  The combox is loaded using a Datatable for now.  Everything works fine, except that when a user clicks on a Row instead of in an ectual checkbox, the dropdown closes gracefully but now says System.Data.DataRowView instead of EmptyMessage="- Select -"

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
        If Not Page.IsPostBack Then
           
            DisplayPrintOptions.DataSource = GetPrintDisplayProfile()
            DisplayPrintOptions.DataBind()
 
        end if
 
Private Function GetPrintDisplayProfile() As DataTable
 
        'Get users Preferred Layout
        Dim dt As New DataTable()
        dt.Columns.Add(New DataColumn("ColumnDisplayName", GetType(String)))
        dt.Columns.Add(New DataColumn("Column", GetType(String)))
        dt.Columns.Add(New DataColumn("Display", GetType(Boolean)))
        dt.Columns.Add(New DataColumn("Print", GetType(Boolean)))
 
etc..



<telerik:RadComboBox ID="DisplayPrintOptions" runat="server" HighlightTemplatedItems="true" Width="100px" AutoPostBack="false"
                        Label="Display & Print Options:"
                        LabelCssClass="DisplayPrint-label" DropDownWidth="400" EmptyMessage="- Select -">
                     <HeaderTemplate>
                           <div style="width:305px;height:15px;">
                               <div style="display:block;float:right;color: rgb(0, 21, 110) !important;">
                                   Show in
                               </div>
                           </div>
                           <div style="width:350px;">
                               <div style="width:210px;float:left;padding:0 11px 0 11px;color: rgb(0, 21, 110) !important;">
                                   Name of Column
                               </div>
                               <div style="width:50px;float:right;margin-right:5px;color: rgb(0, 21, 110) !important;">
                                   Report
                               </div>
                               <div style="width:40px;float:right;color: rgb(0, 21, 110) !important;">
                                   Grid
                               </div>
                           </div>
                     </HeaderTemplate>
                     <ItemTemplate>
                        <ul id="DisplayPrint">
                            <li> <!-- Row -->
                                <ul>
                                    <li id="col1"><%# Eval("ColumnDisplayName")%></li>
                                    <li id="col3">
                                        <telerik:RadButton ID="ColReports" runat="server" ButtonType="ToggleButton" ToggleType="CheckBox"
                                                Checked='<%# DataBinder.Eval(Container.DataItem, "Display").ToString()%>' AutoPostBack="false"
                                                CommandName='<%# DataBinder.Eval(Container.DataItem, "Column").ToString()%>'>
                                        </telerik:RadButton>
                                    </li>
                                    <li id="col2">
                                        <telerik:RadButton ID="ColGrid" runat="server" ButtonType="ToggleButton" ToggleType="CheckBox"
                                                Checked='<%# DataBinder.Eval(Container.DataItem, "Print").ToString()%>' AutoPostBack="false"
                                                CommandName='<%# DataBinder.Eval(Container.DataItem, "Column").ToString()%>'>
                                        </telerik:RadButton>
                                    </li>
                                </ul>
                            </li> <!-- End of row -->                          
                        </ul>
                    </ItemTemplate>
                    <FooterTemplate>
                        <div style="float:right;"><telerik:RadButton ID="SubmitColumns" runat="server" Text="Submit" CausesValidation="false" OnClick="BuildGridColumns" /></div>                    
                    </FooterTemplate>
                    </telerik:RadComboBox>


1 Answer, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 28 Jan 2013, 03:05 PM
Hi Tim,

it seems that you are not specifying the DataTextField and DataValueField. Try to set them and let us know if the issue still persist. If you meet any difficulties, please take a look at this online demo.

 Regards,
Hristo Valyavicharski
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ComboBox
Asked by
Tim
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Share this question
or