473,727 Members | 1,993 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 10403
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
1979
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
7106
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
8890
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,...
0
9259
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9182
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
9120
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8101
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...
0
4521
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4785
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2639
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.