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

Accessing Template Columns from server side

1 Answer 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Abdul
Top achievements
Rank 2
Abdul asked on 17 Feb 2011, 11:56 AM
Dear Telerik Team, 

I have created a template column in RadGrid (code attached) . Now I want to insert constant data in this template column from server side.  Also I want to reuse this column multiple times... Please answer if it is possible ? Following are description of the problems

Like in this grid I have created table, now I want to insert data in the column of that table. I have no SQL data base to bind with... is there a way to insert data in this table from server side. How I can access the columns and rows of that inner table. 

2nd thing is I want to use this entire structure (template column) in each column of the grid. and number of columns of grid are unknown say I need to repeat this structure to unknown number of times.

Abdul Ahad 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="extrapage.aspx.cs" Inherits="ERM.Sales_Mix.extrapage" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <div>
        <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None">
<MasterTableView>
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
 
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
 
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
    <Columns>
        <telerik:GridTemplateColumn UniqueName="TemplateColumn">
            <ItemTemplate>
                <table ID="Table_01" border="0" cellpadding="0" cellspacing="0" width="400">
                    <tr>
                        <td align="center" background="images/TABLE_01.gif" colspan="5" height="29">
                            <font color="#FFFFFF" face="Arial" size="+1">Month Title</font></td>
                    </tr>
                    <tr>
                        <td background="images/TABLE_02.gif" height="27" width="156">
                        </td>
                        <td background="images/TABLE_03.gif" height="27" width="62">
                        </td>
                        <td background="images/TABLE_04.gif" height="27" width="60">
                        </td>
                        <td background="images/TABLE_05.gif" height="27" width="62">
                        </td>
                        <td background="images/TABLE_06.gif" height="27" width="60">
                        </td>
                    </tr>
                    <tr>
                        <td height="19" width="156">
                        </td>
                        <td height="19" width="62">
                        </td>
                        <td height="19" width="60">
                        </td>
                        <td height="19" width="62">
                        </td>
                        <td height="19" width="60">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="5" height="19" width="60">
                        </td>
                    </tr>
                </table>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
    </Columns>
</MasterTableView>
        </telerik:RadGrid>
    </div>
    </form>
 
</body>
</html>
 

1 Answer, 1 is accepted

Sort by
0
Johny
Top achievements
Rank 1
answered on 23 Feb 2011, 10:15 AM
Hi,

I hav finded this link very helps:
http://www.telerik.com/help/aspnet-ajax/grdaccessingcellsandrows.html
http://www.telerik.com/help/aspnet-ajax/grdprogrammaticcreation.html#Creating_template_columns_programmatically


for binds to server you can also use expressions:
http://msdn.microsoft.com/en-us/library/ms178135%28vs.80%29.aspx
http://msdn.microsoft.com/en-us/library/6dwsdcf5%28VS.71%29.aspx
http://msdn.microsoft.com/en-us/library/ms178366.aspx

Tanks.

Johny
Tags
Grid
Asked by
Abdul
Top achievements
Rank 2
Answers by
Johny
Top achievements
Rank 1
Share this question
or