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

RadGrid/GridTemplateColumn Rendering Issue

1 Answer 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
pmcbride
Top achievements
Rank 1
pmcbride asked on 16 Dec 2013, 06:28 PM
I am having an odd problem when I try to add a GridTemplateColumn with an embedded ASP.Net control to my RadGrid. For some reason, the table is not rendering correctly; the ASP.Net is being renedered at the beginning of the grid instead of the opening table tag for the table.

I am using Q3 2013 ASP.Net for AJAX and VS Express 2013 for Web.

Here is the code (aspx file, then vb file):
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="gridDDLTest.aspx.vb" Inherits="NikkorLinksAdmin.gridDDLTest" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <telerik:RadGrid ID="grdTest" runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None">
            <MasterTableView EnableColumnsViewState="False">
                <Columns>
                    <telerik:GridBoundColumn DataField="ItemId" FilterControlAltText="Filter column column" UniqueName="column">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ItemName" FilterControlAltText="Filter column1 column" UniqueName="column1">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ItemOrder" FilterControlAltText="Filter column2 column" UniqueName="column2">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn>
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lblOrder" Text="12"></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </div>
    </form>
</body>
</html>

vb file:

Public Class gridDDLTest
    Inherits System.Web.UI.Page
 
    Public Class BoundClass
        Private _itemId As Integer
        Property ItemId As Integer
            Get
                Return _itemId
            End Get
            Set(value As Integer)
                _itemId = value
            End Set
        End Property
 
        Private _itemName As String
        Property ItemName As String
            Get
                Return _itemName
            End Get
            Set(value As String)
                _itemName = value
            End Set
        End Property
 
        Private _itemOrder As Integer
        Property ItemOrder As Integer
            Get
                Return _itemOrder
            End Get
            Set(value As Integer)
                _itemOrder = value
            End Set
        End Property
 
        Public Sub New(id As Integer, name As String, order As Integer)
            Me.ItemId = id
            Me.ItemName = name
            Me.ItemOrder = order
        End Sub
    End Class
 
    Private _itemsForBinding As New Generic.List(Of BoundClass)
    Public ReadOnly Property ItemsForBinding As Generic.List(Of BoundClass)
        Get
            If _itemsForBinding.Count = 0 Then
                _itemsForBinding.Add(New BoundClass(1, "Name1", 4))
                _itemsForBinding.Add(New BoundClass(1, "Name2", 2))
                _itemsForBinding.Add(New BoundClass(1, "Name3", 1))
                _itemsForBinding.Add(New BoundClass(1, "Name4", 3))
            End If
            Return _itemsForBinding
        End Get
    End Property
 
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Me.grdTest.DataSource = ItemsForBinding
            Me.grdTest.DataBind()
        End If
    End Sub
 
End Class

Finally, here is a sample of what the output looks like; note the lack of an opening tag.

        <div id="grdTest" class="RadGrid RadGrid_Default">
 
<span id="grdTest_ctl00_ctl04_lblOrder">12</span>
                        </td>
    </tr><tr class="rgAltRow" id="grdTest_ctl00__1">
        <td>1</td><td>Name2</td><td>2</td><td>
                            <span id="grdTest_ctl00_ctl06_lblOrder">12</span>
                        </td>
    </tr><tr class="rgRow" id="grdTest_ctl00__2">
        <td>1</td><td>Name3</td><td>1</td><td>
                            <span id="grdTest_ctl00_ctl08_lblOrder">12</span>
                        </td>
    </tr><tr class="rgAltRow" id="grdTest_ctl00__3">
        <td>1</td><td>Name4</td><td>3</td><td>
                            <span id="grdTest_ctl00_ctl10_lblOrder">12</span>
                        </td>
    </tr>
    </tbody>
 
</table><input id="grdTest_ClientState" name="grdTest_ClientState" type="hidden" />
    </div>

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 19 Dec 2013, 10:15 AM
Hi,

The issue you describe is observed when Visual Studio 2013 is used with an older version of the controls. The IDE is officially supported from Q3 2013 SP1 (2013.3.1114) release.

Try upgrading to that version and RadGrid should be rendered correctly on the page.

Regards,
Viktor Tachev
Telerik
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 the blog feed now.
Tags
Grid
Asked by
pmcbride
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or