Hi Lalit,
To make a a column fixed or frozen in a datagrid, you would first need to
have
two tables inside a table. One table would contain the fixed column and the
other
table would contain the rest of the columns.Also, since the first column in
the second
table does not need to show up, you would need to set it's visibility to
False as follows:
<asp:datagrid id="DataGrid1" runat="server" Height="368px" Width="1000px"
ShowHeader="Tru e"
AutoGenerateCol umns="False" CellPadding="0" CellSpacing="0" BorderWidth="1" >
<Columns>
<asp:BoundColum n DataField="Empl oyeeName" Visible="False"
HeaderText="Emp Name">
<HeaderStyle Width="200px" Height="10px"></HeaderStyle>
You can use a Repeater Control with Header Template and Item template to
pouplate
the fixed column.
Following is the code for the same:
<table width="50px" border="1" cellpadding="0" cellspacing="0" >
<asp:Repeater ID="rpt1" Runat="server">
<HeaderTemplate >
<tr>
<td style="height: 1px; padding-left: 5px padding-right: 5px;
padding-top: 6px; padding-bottom: 12px;
border-width: 1px; font-size: 14px;">Employee Name</td>
</tr>
</HeaderTemplate>
<ItemTemplate >
<tr>
<td width="50px" style="height: 1px; padding-left: 5px
padding-right: 5px; padding-top: 6px; padding-bottom: 6px;
border-width: 1px; font-size: 14px;">
<%# DataBinder.Eval (Container.Data Item, "EmployeeNa me") %>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
<tr>
<td height="1px">&n bsp;</td>
</tr>
</table>
HTH
Mona[Grapecity]
You can set the datasource of the Repeater control and then bind it.
"Lalit Bhatia" <xy*@abc.com> wrote in message
news:O%******** ********@TK2MSF TNGP10.phx.gbl. ..
how can we fix first column in DataGrid?
Regards,
Lalit Bhatia