GridTemplateColumn

This is an example of how to use the GridTemplateColumn                       

 Simple example. Note the formatting in the HyperLink NavigateURL:

 

<telerik:GridTemplateColumn
    <ItemTemplate
        <asp:Label ID="lblProjectName" runat="server" Text='<%# Bind("ProjectName") %>'></asp:Label><br />
        <asp:HyperLink ID="HyperLink1" runat="server"
            NavigateUrl='<%# string.format("ScanSand2.aspx?SOPNUMBE={0}&soptype={1}",Eval("sopnumbe"),Eval("soptype")) %>'
            Text='<%# Bind("sopnumbe") %>' /> 
    </ItemTemplate
    <EditItemTemplate
            <asp:TextBox ID="txtProjectName" runat="server" Text='<%# Bind("ProjectName") %>' /> 
    </EditItemTemplate>
  </telerik:GridTemplateColumn>

 

Example with a formatted date:

 

<telerik:GridTemplateColumn>
    <ItemTemplate>
        <asp:Label ID="lblPostDate" Text='<%# String.Format("{0:MM/dd/yyyy}", DataBinder.Eval(Container.DataItem, "PostDate"))%>'  runat="server"></asp:Label><br />
        <asp:Label ID="lblUserName" Text='<%# Bind("UserName")%>' runat="server"></asp:Label>
    </ItemTemplate>
</telerik:GridTemplateColumn>
 

 

 

 

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences