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

Cardview display problem

14 Answers 180 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Remi
Top achievements
Rank 1
Remi asked on 29 Apr 2008, 07:10 PM
Hi,

I'm binding my grid on an object collection.  I'm trying to display the information like in the cardview example.  However, even if my code is the same, it keep telling me that i have no record.

<telerik:RadGrid ID="grdReglements" runat="server" GridLines="None" AutoGenerateColumns="False" 
        Width="732px"
        <MasterTableView TableLayout="Fixed"
            <NoRecordsTemplate> 
                <asp:Label ID="lblGrdNoRecord" runat="server" Text="Il n'y a présentement aucun nouveau règlement ajoutés à votre acte de copropriété."></asp:Label> 
            </NoRecordsTemplate> 
            <ItemTemplate> 
                <div style="float: left; width: 231px;"
                    <asp:Label ID="lblNoReglement" runat="server" Text="Numéro de règlement :"></asp:Label> 
                    <br /> 
                    <%# Eval("NoReglement") %> 
                    <br /> 
                    <br /> 
                    <asp:Label ID="lblDateAdoption" runat="server" Text="Date d'adoption :"></asp:Label> 
                    <br /> 
                    <%# Eval("DateAdoption") %> 
                    <br /> 
                    <br /> 
                    <asp:Label ID="lblDateVigueur" runat="server" Text="Date applicable :"></asp:Label> 
                    <br /> 
                    <%# Eval("DateVigueur") %> 
                </div> 
                <div style="width: 500px;"
                    <%# Eval("Titre") %> 
                    <br /> 
                    <%# Eval("Description") %> 
                </div> 
            </ItemTemplate> 
</MasterTableView> 
    </telerik:RadGrid> 

private void RefreshReglements() 
    { 
        grdReglements.DataSource = MyReglementBLL.ReglementCollection; 
        grdReglements.DataBind(); 
    } 


If i use bounded columns, my information is displayed correctly.

14 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 30 Apr 2008, 12:16 PM
Hi,

Try binding the Grid using AdvanceDataBinding technique.
Advanced data-binding

Shinu.
0
Remi
Top achievements
Rank 1
answered on 30 Apr 2008, 01:05 PM
I've just try to bind my grid with the NeedDataSource event

protected void grdReglements_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
    { 
        grdReglements.DataSource = MyReglementBLL.ReglementCollection; 
    } 

It is called but the data is never displayed.  I still have the no record feedback even if i have data.
0
Remi
Top achievements
Rank 1
answered on 02 May 2008, 12:04 AM
can someone help me?


0
Yavor
Telerik team
answered on 02 May 2008, 06:43 AM
Hi Remi ,

Based on the supplied information, it is hard to determine the cause of the problem that you described. It would be best if you open a formal support ticket, and send us the problematic code, in the form of a small working project. We will review it locally, and get back to you with our findings.

Sincerely yours,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Steve Newbery
Top achievements
Rank 1
answered on 22 May 2008, 08:22 PM
Remi, I had the same problem, and fixed it by having at least one column defined, just before the <ItemTemplate> part:

<Columns> 
  <telerik:GridBoundColumn UniqueName="dummy" DataField="Title" HeaderText="" Visible="False" /> 
</Columns> 
 

You of course would use a different field to "Title".
0
John
Top achievements
Rank 1
answered on 28 Jun 2008, 10:04 PM
I'm having the same issue.

I don't think the the Bind event is ever triggered by rad grid unless there is an GridBoundColumn in the grid when using the OnNeedDataSource.


0
Sebastian
Telerik team
answered on 30 Jun 2008, 10:53 AM
Hello guys,

I tried to recreate the issue (using global item template for the grid and NeedDataSource handling) in a test project but my attempts were not successful. You will find the demo web site enclosed to this forum post.

I will appreciate if you outline the differences between my grid configuration and yours or modify it to reproduce the erroneous behavior. Thus I will do my best to give you straight-to-the-point answer solution.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
SonicImaging
Top achievements
Rank 1
answered on 30 Jun 2008, 01:54 PM
Hi,  I just ran into the same problem trying to create a product listing with card view.  If there arent any Columns defined then you get no records found even tho my linq datasource should be returning records.  I'm assuming that if you have group by columns it will work like in the demo's/docs for card view

If I create just one Column then I get my records and my item template, but I don't want any columns since this is a product listing.  I don't want any groupby columns either.  I just want a pager. then the products listed.

Any thought on how to use the cardview without any columns defined? here is my code

    <telerik:RadGrid ID="RG1" runat="server" AllowPaging="True" DataSourceID="LD1" Skin="Hay"
        <PagerStyle Mode="NextPrevAndNumeric" /> 
        <MasterTableView TableLayout="Fixed" AutoGenerateColumns="false"
            <Columns> 
                <!-- If I remove this I get no records template --> 
                <telerik:GridBoundColumn Visible="true" UniqueName="price" DataField="price" HeaderText="Price ($)" /> 
            </Columns> 
            <ItemTemplate> 
                <asp:Image ID="Image1" ImageUrl="~/images/sm_tmt88iv.jpg" runat="server" /><br /> 
                <br /> 
                <%# Eval("name")%><br /> 
                <br /> 
                <%# Eval("description")%> 
            </ItemTemplate> 
        </MasterTableView> 
        <ClientSettings AllowDragToGroup="false"
            <Scrolling AllowScroll="true" UseStaticHeaders="true" /> 
        </ClientSettings> 
    </telerik:RadGrid> 
    <asp:LinqDataSource ID="LD1" runat="server" ContextTypeName="SonicImagingDBDataContext" TableName="hecTest_items" OrderBy="manufacturer" Where="manufacturer == @manufacturer"
        <WhereParameters> 
            <asp:QueryStringParameter DefaultValue="Epson" Name="manufacturer" QueryStringField="mfg" Type="String" /> 
        </WhereParameters> 
    </asp:LinqDataSource> 


Thanks
-Keith
0
Sebastian
Telerik team
answered on 30 Jun 2008, 02:04 PM
Hi Keith,

Can you replicate the issue in the sample project enclosed to my previous reply/modify it to exhibit the erratic behavior? It has no group expressions defined and operates normally on my machine without any column definitions included. Thus I will do my best to provide an accurate resolution.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
John
Top achievements
Rank 1
answered on 30 Jun 2008, 02:12 PM
I figured out the cause.  if you have no databound columns and have AutoGenerateColumns="false" the itemtemplate rows will not show up.

So take out autogeneratecolumns="false" from the radgrid tag and then the itemtemlate rows gets displayed.
0
SonicImaging
Top achievements
Rank 1
answered on 30 Jun 2008, 02:36 PM
Thanks John,  I just tried that but then it generates all of the header columns which i don't want.  I just downloaded that project so ill mess with that and see if I can reproduce it

thanks
-Keith
0
John
Top achievements
Rank 1
answered on 30 Jun 2008, 02:55 PM
 ShowHeader="false" in the RadGrid tag should take care of that for you.
0
SonicImaging
Top achievements
Rank 1
answered on 30 Jun 2008, 03:00 PM
Hi,  I couldn't get that project working but I think its just machine specific stuff.  Looking at the code the difference is that im using a LinqDataSource in the aspx page and you using the code behind.

I just added that dummy column and that worked the way I need it to for now.  This is just a mock up for the client.

Later ill need to use NeedDataSource since im generating my own grouping and filtering functions so ill see if that allow me to get rid of the dummy column

Thanks,  ill report on anything new later...
-Keith
0
Albert Shenker
Top achievements
Rank 1
Veteran
answered on 29 Dec 2008, 07:38 AM
I have run into this issue as well. I solved it by using the suggested method of setting AutoGenerateColumns= "True" and ShowHeader="False". This is ok, though tit does create some limitations. It would be nice if, in a fuiture update, telerik comes up with a property to set or some other way around the problem.
Tags
Grid
Asked by
Remi
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Remi
Top achievements
Rank 1
Yavor
Telerik team
Steve Newbery
Top achievements
Rank 1
John
Top achievements
Rank 1
Sebastian
Telerik team
SonicImaging
Top achievements
Rank 1
Albert Shenker
Top achievements
Rank 1
Veteran
Share this question
or