472,959 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,959 software developers and data experts.

Re Fixed Columns in DataGrid

thanks for the answer
but I need it for windows forms. I have a desktop application where I need
to implement this.

--
Regards,
Lalit Bhatia
"Mona" <mo**@discussions.microsoft.com> wrote in message
news:OQ**************@TK2MSFTNGP14.phx.gbl...
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="True"
AutoGenerateColumns="False" CellPadding="0" CellSpacing="0" BorderWidth="1"> <Columns>
<asp:BoundColumn DataField="EmployeeName" Visible="False"
HeaderText="EmpName">
<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.DataItem, "EmployeeName") %>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
<tr>
<td height="1px">&nbsp;</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%****************@TK2MSFTNGP10.phx.gbl...
how can we fix first column in DataGrid?
Regards,
Lalit Bhatia


Jul 21 '05 #1
0 1403

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: TPSreport | last post by:
ASP.NET 2003. Two DataGrids, six columns each, one grid atop the other. I need to have the columns line up, i.e., DataGrid1 Col(1) lined up w/ DataGrid2 Col(1) - each the same width on the...
1
by: Lalit Bhatia | last post by:
how can we fix first column in DataGrid? Regards, Lalit Bhatia
1
by: Napo | last post by:
Hi i have about twenty columns displayed in a datagrid,and the first column is "EmployeeID" column.Now,i want to display the "EmployeeID" column awalys when i drag the datagrid's scrollbar.What can...
0
by: Khalid Ashraf | last post by:
Hi, Can somebody point to a code example that shows how to create fixed columns (instead of the 1st left most column) in DataGrid. Thanks in advance.
1
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems...
0
by: CW | last post by:
I didn't have If !Page.IsPostBack //bind data source in the code "CW" <a> wrote in message news:um9MTUzFEHA.2560@TK2MSFTNGP12.phx.gbl... > I am taking the Commerce Starter Kit sample from...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
10
by: Aaron Smith | last post by:
If I have a datagrid and the bound data file only have 4 rows in it, the grid will show the 4 rows. However, there is blank space below that until it reaches the bottom of the grid. Is there a way...
0
by: Lalit Bhatia | last post by:
thanks for the answer but I need it for windows forms. I have a desktop application where I need to implement this. -- Regards, Lalit Bhatia "Mona" <mona@discussions.microsoft.com> wrote in...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.