473,725 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

setting Column width of Template Column in Datagrid..

Hi all,

I have a DataGrid with Template Columns.....

There are LAbels,Linkbutt ons in the Single Row..

I have to set the Constant Column width for those Template Columns in
Grid...

Wat actually happens is... when the Text size is too big... the column
also expands..

But wat actually should happen is ,

The text should wrap within the Column Width,,

I have set the Wrap and Column width Property of The Template Column of
the Grid ...

But it was not working...

The GRid goes as follows..
<asp:datagrid id="DG_Live" runat="server" CssClass="DataG rid"
Width="100%" Height="100%" ItemStyle-BackColor="#EFF 7FF"
GridLines="None " AutoGenerateCol umns="False" HorizontalAlign ="Left"
CellPadding="0" ItemStyle-Height="100" HeaderStyle-Height="100">
<AlternatingIte mStyle HorizontalAlign ="Left" VerticalAlign=" Middle"
BackColor="Whit e" > </AlternatingItem Style>
<ItemStyle Font-Size="11px" Font-Names="Verdana" HorizontalAlign ="Left"
Height="30px" VerticalAlign=" Middle"
BackColor="#EFF 7FF"></ItemStyle>
<HeaderStyle Font-Size="X-Small" Font-Names="Verdana" Font-Bold="True"
HorizontalAlign ="Center" Height="40px"
BackColor="Whit e"></HeaderStyle>
<Columns>
<asp:TemplateCo lumn>
<HeaderStyle Width="5%"></HeaderStyle>
<ItemStyle Width="5%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr> <td align="left"> <asp:CheckBox ID="check1"
Runat="server"> </asp:CheckBox> <asp:Label ID="UniqueId1"
Runat="server" Visible="False" ></asp:Label>
<asp:Label ID="UrlLink1" Runat="server" Visible="False" ></asp:Label>
</td> </tr> </table> </ItemTemplate> </asp:TemplateCol umn>
<asp:TemplateCo lumn>
<HeaderStyle Width="5%"></HeaderStyle>
<ItemStyle Width="5%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left">
<asp:Label ID="Serial1" Runat="server" Font-Size="11px"
Font-Name="verdana" Font-Bold="False"
Font-Names="verdana" ></asp:Label></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Pos ">
<HeaderStyle Font-Size="11px" Font-Names="verdana" Font-Bold="True"
Width="10%"></HeaderStyle> <ItemStyle Width="10%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left">
<asp:linkbutt on ID="Up" Runat="server"
CssClass="LinkB utton2" CommandName="Up "></asp:linkbutton>
<asp:linkbutt on ID="Down" Runat="server"
CssClass="LinkB utton2" CommandName="Do wn"></asp:linkbutton>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Des cription">
<HeaderStyle Font-Size="11px" Font-Names="verdana"
Font-Bold="True" Width="28%"></HeaderStyle>
<ItemStyle Width="28%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="PADDING-LEFT: 15px" align="left">
<asp:linkbutt on ID="Description 1" Runat="server"
CssClass="LinkB utton3"
CommandName="De scription1"></asp:linkbutton> </td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Ima ge">
<HeaderStyle Font-Size="11px" Font-Names="verdana"
Font-Bold="True" Width="22%"></HeaderStyle>
<ItemStyle Width="22%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left">
<asp:Label ID="Image1" Runat="server"
Font-Size="11px" Font-Name="verdana" Font-Bold="False"
Font-Names="verdana" ></asp:Label></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Tar get">
<HeaderStyle Font-Size="11px" Font-Names="verdana"
Font-Bold="True" Width="10%"></HeaderStyle>
<ItemStyle Width="10%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left">
<asp:Label ID="Target1" Runat="server"
Font-Size="11px" Font-Name="verdana" Font-Bold="False"
Font-Names="verdana" ></asp:Label></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Lin k">
<HeaderStyle Font-Size="11px" Font-Names="verdana"
Font-Bold="True" Width="15%"></HeaderStyle>
<ItemStyle Width="15%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left">
<asp:Label ID="Link1" Runat="server"
Font-Size="11px" Font-Name="verdana" Font-Bold="False"
Font-Names="verdana" ></asp:Label></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Tes tLink">
<HeaderStyle Font-Size="11px" Font-Names="verdana"
Font-Bold="True" Width="5%"></HeaderStyle>
<ItemStyle Width="5%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left">
<asp:linkbutt on ID="TestLink1" Runat="server"
CssClass="LinkB utton2" CommandName="Te stLink1"></asp:linkbutton> </td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
<PagerStyle Visible="False" ></PagerStyle>
</asp:datagrid>
Please Help .. ITs URgent...

With Regards
Sanju.C

Jun 20 '06 #1
2 10402
You can try to make use of css rule table-layout:fixed. Put it in your
DataGrid css class.

Eliyahu

"Charleees" <vc********@gma il.com> wrote in message
news:11******** *************@i 40g2000cwc.goog legroups.com...
Hi all,

I have a DataGrid with Template Columns.....

There are LAbels,Linkbutt ons in the Single Row..

I have to set the Constant Column width for those Template Columns in
Grid...

Wat actually happens is... when the Text size is too big... the column
also expands..

But wat actually should happen is ,

The text should wrap within the Column Width,,

I have set the Wrap and Column width Property of The Template Column of
the Grid ...

But it was not working...

The GRid goes as follows..
<asp:datagrid id="DG_Live" runat="server" CssClass="DataG rid"
Width="100%" Height="100%" ItemStyle-BackColor="#EFF 7FF"
GridLines="None " AutoGenerateCol umns="False" HorizontalAlign ="Left"
CellPadding="0" ItemStyle-Height="100" HeaderStyle-Height="100">
<AlternatingIte mStyle HorizontalAlign ="Left" VerticalAlign=" Middle"
BackColor="Whit e" > </AlternatingItem Style>
<ItemStyle Font-Size="11px" Font-Names="Verdana" HorizontalAlign ="Left"
Height="30px" VerticalAlign=" Middle"
BackColor="#EFF 7FF"></ItemStyle>
<HeaderStyle Font-Size="X-Small" Font-Names="Verdana" Font-Bold="True"
HorizontalAlign ="Center" Height="40px"
BackColor="Whit e"></HeaderStyle>
<Columns>
<asp:TemplateCo lumn>
<HeaderStyle Width="5%"></HeaderStyle>
<ItemStyle Width="5%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr> <td align="left"> <asp:CheckBox ID="check1"
Runat="server"> </asp:CheckBox> <asp:Label ID="UniqueId1"
Runat="server" Visible="False" ></asp:Label>
<asp:Label ID="UrlLink1" Runat="server" Visible="False" ></asp:Label>
</td> </tr> </table> </ItemTemplate> </asp:TemplateCol umn>
<asp:TemplateCo lumn>
<HeaderStyle Width="5%"></HeaderStyle>
<ItemStyle Width="5%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left">
<asp:Label ID="Serial1" Runat="server" Font-Size="11px"
Font-Name="verdana" Font-Bold="False"
Font-Names="verdana" ></asp:Label></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Pos ">
<HeaderStyle Font-Size="11px" Font-Names="verdana" Font-Bold="True"
Width="10%"></HeaderStyle> <ItemStyle Width="10%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left">
<asp:linkbutt on ID="Up" Runat="server"
CssClass="LinkB utton2" CommandName="Up "></asp:linkbutton>
<asp:linkbutt on ID="Down" Runat="server"
CssClass="LinkB utton2" CommandName="Do wn"></asp:linkbutton>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Des cription">
<HeaderStyle Font-Size="11px" Font-Names="verdana"
Font-Bold="True" Width="28%"></HeaderStyle>
<ItemStyle Width="28%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="PADDING-LEFT: 15px" align="left">
<asp:linkbutt on ID="Description 1" Runat="server"
CssClass="LinkB utton3"
CommandName="De scription1"></asp:linkbutton> </td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Ima ge">
<HeaderStyle Font-Size="11px" Font-Names="verdana"
Font-Bold="True" Width="22%"></HeaderStyle>
<ItemStyle Width="22%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left">
<asp:Label ID="Image1" Runat="server"
Font-Size="11px" Font-Name="verdana" Font-Bold="False"
Font-Names="verdana" ></asp:Label></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Tar get">
<HeaderStyle Font-Size="11px" Font-Names="verdana"
Font-Bold="True" Width="10%"></HeaderStyle>
<ItemStyle Width="10%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left">
<asp:Label ID="Target1" Runat="server"
Font-Size="11px" Font-Name="verdana" Font-Bold="False"
Font-Names="verdana" ></asp:Label></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Lin k">
<HeaderStyle Font-Size="11px" Font-Names="verdana"
Font-Bold="True" Width="15%"></HeaderStyle>
<ItemStyle Width="15%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left">
<asp:Label ID="Link1" Runat="server"
Font-Size="11px" Font-Name="verdana" Font-Bold="False"
Font-Names="verdana" ></asp:Label></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Tes tLink">
<HeaderStyle Font-Size="11px" Font-Names="verdana"
Font-Bold="True" Width="5%"></HeaderStyle>
<ItemStyle Width="5%"></ItemStyle>
<ItemTemplate >
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left">
<asp:linkbutt on ID="TestLink1" Runat="server"
CssClass="LinkB utton2" CommandName="Te stLink1"></asp:linkbutton> </td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
<PagerStyle Visible="False" ></PagerStyle>
</asp:datagrid>
Please Help .. ITs URgent...

With Regards
Sanju.C

Jun 20 '06 #2

Thanks Eliyahu ,

I have tried with wat u said.. but could nt..

Is there any other way..
This is a simplw thing but working strange.. I dont know y..

Please Help....

With Regards,
Charles.V

Jun 20 '06 #3

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

Similar topics

2
1978
by: TT (Tom Tempelaere) | last post by:
Hi l&g It's weird but I can't find an easy way to set the width of a column in a DataGrid. It must be hidden somewhere. I searched google but it's all vb-ish and not to the point. Can someone sketch me how I should do this What I actually want to do is to specify the width of a column relative to the width of the DataGrid control so that the columns always span the entire width of the DataGrid. For instance 4 columns, 10%, 20%, 30% and 40%...
1
2218
by: VB Programmer | last post by:
I have a datagrid which is bound to a datatable that I create on the fly. How do I set the width of each column via code? Ex: Column 1 is always 100, Column 2 is always 250, etc... Thanks!
2
3543
by: Yama | last post by:
Hi, How can I make it resizable? For example: <pre> <!-- datagrid Header --> <table class="TableHeader" id="tblHeader" border="1" runat="server">
1
2366
by: Luis Esteban Valencia | last post by:
Hello. I have a datagird with textboxes on a column item template, I also have 2 other columns that are hidden and I want to retrieve his value. But I havent found how to do it. Thanks very much in advance This is the code that loops through all rows. find the textboxes controls Private Sub btnguardarplandesarrollo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnguardarplandesarrollo.Click
1
1677
by: headbig003 | last post by:
Hello I put template column in datagrid. Below is the html code I used. <asp:datagrid id="dgAnswer" runat="server" Width="360px" AutoGenerateColumns="False" DataKeyField="ansID"> <Columns> <asp:TemplateColumn HeaderText="Answer Text"> <ItemTemplate> <asp:TextBox id="txtItem" runat="server" Width="201px" Text='<%#
0
1835
by: Reza Nabi | last post by:
Dear All: Banckgroud: I have a datagrid which lives inside a repeater. Which is working fine. What i need is to dyanamically set the column width of the grid (which lieves inside the repeater). Is there any way, we accomplish this? Any advice on this would be greatly appreciated. Reza. ---BEGIN PART Of ListApp.aspx --->
1
288
by: Shapper | last post by:
Hello, I have a datagrid with one template column and 2 bound columns. I need to set the width of each column. How to do it? I was able to set the width of the entire datagrid but not of each column. Thanks,
6
7105
by: cr113 | last post by:
I'm trying to set the column widths for a datagrid. You'd think it would be easy. I looked it up in google and the first thing I found looked promising: datagrid1.columns(0).width = 2000 datagrid1.columns(1).width = 1000 Except that there is no such things as a columns collection in a datagrid.
4
4193
by: Rich | last post by:
Hello, I have a one datagrid that will be based on different datatables. One datatable may have 7 columns, another 15... With the tables that have more columns, I have been manually dragging column widths to narrow them. I want to record these widths so I can reapply them when I bind the datagrid to the table with 15 columns. I have searched around for articles on this and saw some that talked about...
0
8889
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9179
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8099
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3228
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
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.