Hello:
I am trying to get a grid to show as a listview using your demo http://demos.telerik.com/aspnet-ajax/grid/examples/programming/listview/defaultcs.aspx.
The only way I can get anything to display on the screen is to comment out the lines showing in the following prerender statement.
The data that shows up is all over the place, not in a nice tabular form. Some will be in the grid, some appear to be outside etc.
If I uncomment the lines of code in the prerender I get nothing to display in the grid at all. It will iterate through the grid.items etc. as it should but nothing will display. I have verified that the data is in the datasource when bound.
My Radgrid code is below
Thanks for your time.
I am trying to get a grid to show as a listview using your demo http://demos.telerik.com/aspnet-ajax/grid/examples/programming/listview/defaultcs.aspx.
The only way I can get anything to display on the screen is to comment out the lines showing in the following prerender statement.
protected void rgdImg_PreRender(object sender, EventArgs e) |
{ |
int itemCount = rgdImg.MasterTableView.GetItems(GridItemType.Item).Length + rgdImg.MasterTableView.GetItems(GridItemType.AlternatingItem).Length; |
foreach (GridItem item in rgdImg.Items) |
{ |
//if (item is GridDataItem && item.ItemIndex < itemCount) |
//{ |
// ((item as GridDataItem)["ImageID"] as TableCell).Controls.Add(new LiteralControl("<table><tr><td>")); |
//} |
} |
} |
The data that shows up is all over the place, not in a nice tabular form. Some will be in the grid, some appear to be outside etc.
If I uncomment the lines of code in the prerender I get nothing to display in the grid at all. It will iterate through the grid.items etc. as it should but nothing will display. I have verified that the data is in the datasource when bound.
My Radgrid code is below
<telerik:RadGrid ID="rgdImg" runat="server" |
AllowPaging="true" |
PageSize="4" |
EnableHeaderContextMenu="false" |
OnNeedDataSource="rgdImg_NeedDataSource" |
ShowFooter="false" |
AutoGenerateColumns="false" |
OnItemCommand="rgdImg_ItemCommand" |
OnItemDataBound="rgdImg_ItemDataBound" |
OnPreRender="rgdImg_PreRender"> |
<MasterTableView TableLayout="Fixed" |
EnableHeaderContextMenu="false" |
DataMember="Image"> |
<Columns> |
<telerik:GridBoundColumn UniqueName="ImageID" ReadOnly="true" Display="false" DataField="ImageID" /> |
<telerik:GridTemplateColumn> |
<ItemTemplate> |
<%# (((GridItem)Container).ItemIndex != 0)? "</td></tr></table>" : "" %> |
<asp:Panel ID="pnlGrid" runat="server" CssClass='<%# (((GridItem)Container).ItemType == GridItemType.Item)? "item" : "alternatingItem" %>'> |
<asp:Label ID="ImageID" runat="server" Visible="false" /> |
<%# DataBinder.Eval(Container.DataItem, "ImageID") %> |
<asp:CheckBox ID="ckImage" runat="server" Checked="false" AutoPostBack="true" OnCheckedChanged="rgdImg_OnCheckedChanged" /> |
<asp:Image ID="image" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "RelPath") %>' /> |
<br /> |
<asp:Label ID="lblImageName" runat="server" Text="Image Name: "></asp:Label> |
<%# DataBinder.Eval(Container.DataItem, "Name") %> |
<br /> |
<asp:Label ID="lblArtType" runat="server" Text="Type: "></asp:Label> |
<%# DataBinder.Eval(Container.DataItem, "Type") %> |
<br /> |
<asp:Label ID="lblImageTag" runat="server" Text="Tags: "></asp:Label> |
<%# DataBinder.Eval(Container.DataItem, "Tag") %> |
<br /> |
<asp:Label ID="lblAltName" runat="server" Text="Alt. Name: "></asp:Label> |
<%# DataBinder.Eval(Container.DataItem, "AltName") %> |
<br /> |
<asp:Label ID="lblImageDescription" runat="server" Text="Description: "></asp:Label> |
<%# DataBinder.Eval(Container.DataItem, "Description") %> |
</asp:Panel> |
<%-- <%# (((GridItem)Container).ItemIndex != (((GridItem)Container).OwnerTableView.PageSize - 1))? "<table style='display:none;'><tr><td>" : "" %> |
--%> </ItemTemplate> |
</telerik:GridTemplateColumn> |
</Columns> |
</MasterTableView> |
<ClientSettings> |
<Selecting AllowRowSelect="true" /> |
</ClientSettings> |
</telerik:RadGrid> |
Thanks for your time.