473,569 Members | 2,870 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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**@discussio ns.microsoft.co m> wrote in message
news:OQ******** ******@TK2MSFTN GP14.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="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


Jul 21 '05 #1
0 1446

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

Similar topics

2
5231
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 screen. All columns have the same width assigned via Property Builder, and both DataGrids themselves have the same fixed width. Wrap is OFF for each...
1
2431
by: Lalit Bhatia | last post by:
how can we fix first column in DataGrid? Regards, Lalit Bhatia
1
3765
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 i do Thanks
0
267
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
840
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 controlling the visibility of columns in the DataGrid control. The problem usually comes down to one fact. The DataGrid has a property called...
0
900
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 asp.net and trying to add a > page that allows user to edit product categories.
2
6384
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
8102
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 to have a fixed number of rows regardless of what data is in the bound table? Thanks, Aaron -- --- Aaron Smith
0
314
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 message news:OQ0wkCeZFHA.3220@TK2MSFTNGP14.phx.gbl... > Hi Lalit,
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7665
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.