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

Radgrid + image + Master page footer problem

3 Answers 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ksk
Top achievements
Rank 1
ksk asked on 21 Nov 2008, 01:04 PM
Hi,

i have footer control in master page,after the content placeholder.Then i am having radgrid with gridtemplatecolumn for creating image gallery.Now i am setting pagesize=6,but i am having 7 images .At grid-first page 6 images are dispalying,in second page 1-image is displaying,now what happen is,my footer control will comes within the grid.There is nothing problem in my other Radgrids.Because that grids retrieving datas only.This is the design source for my grid which is haiving problem.and not only footer control,whatever the control placing after the rad grid,it shows the same issues as i mentioned above.

<telerik:RadGrid ID="rgridProduct" runat="server" DataSourceID="dsProduct" GridLines="None"
                        AllowPaging="true" AllowSorting="true" OnItemDataBound="rgridProduct_ItemDataBound"
                        Skin="Office2007" Width="900px" EnableEmbeddedSkins="false">
                        <HeaderContextMenu EnableTheming="True">
                            <CollapseAnimation Duration="200" Type="OutQuint" />
                        </HeaderContextMenu>
                        <PagerStyle Mode="NextPrevAndNumeric" />
                        <MasterTableView DataSourceID="dsProduct" AutoGenerateColumns="False" DataKeyNames="ProductId"
                            TableLayout="Fixed" PageSize="6">
                            <Columns>
                                <telerik:GridBoundColumn DataField="ProductID" Display="false" DataType="System.Int32"
                                    HeaderText="ProductID" ReadOnly="True" SortExpression="ProductID" UniqueName="ProductID">
                                </telerik:GridBoundColumn>
                                <telerik:GridTemplateColumn UniqueName="ImageColumn">
                                    <ItemTemplate>
                                        <%# (((GridItem)Container).ItemIndex != 0)? "</td></tr></table>" : "" %>
                                        <asp:Panel ID="ItemContainer" CssClass='<%# (((GridItem)Container).ItemType == GridItemType.Item)? "item" : "alternatingItem" %>'
                                            runat="server" Width="250px" Height="150px">
                                            <div class="view_rightgrid">
                                                <br />
                                                <asp:Label ID="lblName" runat="server"><%# Eval("ProductName")%></asp:Label>
                                                <br />
                                                <asp:HyperLink ID="hlPreview" runat="server" ToolTip="View" Text="Preview" NavigateUrl='<%# "MarketerViewProduct.aspx?ProductID="+Eval("ProductID")%>'></asp:HyperLink>
                                                <br />
                                                <asp:HyperLink ID="HyperLink1" runat="server" ToolTip="View" Text="Edit" NavigateUrl='<%# "Product.aspx?ProductID="+Eval("ProductID")+"&mode=edit" %>'></asp:HyperLink>
                                            </div>
                                            <asp:Image ImageUrl='<%# String.Format(System.Configuration.ConfigurationManager.AppSettings["virtualPath"].ToString() + "{0}", DataBinder.Eval(Container.DataItem, "PrimaryImage")) %>'
                                                ID="smallImage" runat="server" AlternateText="" Height="100px" />
                                            <asp:HyperLink ID="targetControl" runat="server" NavigateUrl="#" Text="Details"></asp:HyperLink>
                                        </asp:Panel>
                                        <%# (((GridItem)Container).ItemIndex != (((GridItem)Container).OwnerTableView.PageSize - 1))? "<table style='display:none;'><tr><td>" : "" %>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                            </Columns>
                        </MasterTableView>
                        <FilterMenu EnableTheming="True">
                            <CollapseAnimation Duration="200" Type="OutQuint" />
                        </FilterMenu>
                    </telerik:RadGrid>

Thanks
santhose

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 21 Nov 2008, 01:22 PM
Hello Santhose,

It looks as if the logic of opening and closing the table tags does not work correctly in all scenarios. For example - if there are fewer items on the page than the PageSize value, the last table tag is never opened and you end up with double closing table tags. Please double check and validate the rendered HTML output.


Best wishes,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
ksk
Top achievements
Rank 1
answered on 24 Nov 2008, 06:23 AM
Hi,

Let me know how to finish the table tag again,i just did like the below url  example.
http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/Programming/ListView/DefaultCS.aspx

"
 if there are fewer items on the page than the PageSize value, the last table tag is never opened and you end up with double closing table tags. Please double check and validate the rendered HTML output. "

dont understand exactly.please send me a sample.


Thanks in advance,
k.santhose kumar



0
Dimo
Telerik team
answered on 25 Nov 2008, 07:06 AM
Hello,

Here is a sample page, which works as expected:


<%@ Page Language="C#" %>  
<%@ Import Namespace="System.Data" %>  
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>  
  
<script runat="server"
  
    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)  
    {  
        DataTable dt = new DataTable();  
        DataRow dr;  
        int colsNum = 30;  
        int rowsNum = 7;  
        string colName = "";  
  
        for (int j = 1; j <= colsNum; j++)  
        {  
            dt.Columns.Add(String.Format("Column{0}", j));  
        }  
  
        for (int i = 1; i <= rowsNum; i++)  
        {  
            dr = dt.NewRow();  
  
            for (int k = 1; k <= colsNum; k++)  
            {  
                colName = String.Format("Column{0}", k);  
                dr[colName] = String.Format("{0} Row{1}", colName, i);  
            }  
            dt.Rows.Add(dr);  
        }  
  
        (sender as RadGrid).DataSource = dt;  
    } 
 
    protected void RadGrid1_DataBound(object sender, EventArgs e) 
    { 
        int itemCount = (sender as RadGrid).MasterTableView.GetItems(GridItemType.Item).Length + (sender as RadGrid).MasterTableView.GetItems(GridItemType.AlternatingItem).Length; 
        foreach (GridItem item in (sender as RadGrid).Items) 
        { 
            if (item is GridDataItem && item.ItemIndex < itemCount - 1) 
            { 
                ((item as GridDataItem)["ImageColumn"] as TableCell).Controls.Add(new LiteralControl("<table style='display:none;'><tr><td>")); 
            } 
        } 
    } 
     
</script> 
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  
<html xmlns="http://www.w3.org/1999/xhtml" >  
<head runat="server">  
<meta http-equiv="content-type" content="text/html; charset=utf-8" />  
<title>RadGrid for ASP.NET AJAX</title>  
<style type="text/css"
 
.block{float:left;width:100px;height:100px;border:1px solid red;margin:5px 0 0 5px;} 
 
</style> 
</head>  
<body>  
<form id="form1" runat="server">  
<asp:ScriptManager ID="ScriptManager1" runat="server" />  
  
<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" 
    AllowPaging="true" Skin="Office2007" Width="900px" OnDataBound="RadGrid1_DataBound"
    <MasterTableView AutoGenerateColumns="False" TableLayout="Fixed" PageSize="6"
        <Columns> 
            <telerik:GridBoundColumn DataField="ProductID" Display="false" DataType="System.Int32" 
                HeaderText="ProductID" ReadOnly="True" SortExpression="ProductID" UniqueName="ProductID"
            </telerik:GridBoundColumn> 
            <telerik:GridTemplateColumn UniqueName="ImageColumn"
                <ItemTemplate> 
                    <%# (((GridItem)Container).ItemIndex != 0)? "</td></tr></table>" : "" %> 
                    <asp:Panel ID="ItemContainer" CssClass="block" runat="server" Width="250px" Height="150px"
                            <asp:Label ID="Label1" runat="server"><%# Eval("Column1")%></asp:Label> 
                    </asp:Panel> 
                </ItemTemplate> 
            </telerik:GridTemplateColumn> 
        </Columns> 
    </MasterTableView> 
</telerik:RadGrid> 
 
<p>Content below RadGrid</p> 
   
</form>  
</body>  
</html> 



Greetings,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
ksk
Top achievements
Rank 1
Answers by
Dimo
Telerik team
ksk
Top achievements
Rank 1
Share this question
or