473,666 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ItemStyle from DataGrid

Hi there,

Im trying to setup an ASP DataGrid to format my results in a clear manner.

I have 3 fields to bring back into the grid, these are Date, Venue and
Comments.

However I would like to restrict the width of the comments records to a
certain value - can this be done?

Regards
Paul
Nov 18 '05 #1
4 1328
"Paul King" <ki******@hotma il.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Hi there,

Im trying to setup an ASP DataGrid to format my results in a clear manner.

I have 3 fields to bring back into the grid, these are Date, Venue and
Comments.

However I would like to restrict the width of the comments records to a
certain value - can this be done?


If you mean the width on the screen, yes, you can set the column widths.

If you want to limit the number of characters which a user can enter into
the Comments field, you'll have to do that yourself before writing to the
database.
--
John Saunders
johnwsaundersii i at hotmail
Nov 18 '05 #2
Yes ok, but how do you set the Width on the screen?

For example I want the whole ASP Form only to be a certain size.

Regards
Paul.

"John Saunders" <jo************ **@notcoldmail. com> wrote in message
news:ed******** ******@TK2MSFTN GP09.phx.gbl...
"Paul King" <ki******@hotma il.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Hi there,

Im trying to setup an ASP DataGrid to format my results in a clear manner.
I have 3 fields to bring back into the grid, these are Date, Venue and
Comments.

However I would like to restrict the width of the comments records to a
certain value - can this be done?


If you mean the width on the screen, yes, you can set the column widths.

If you want to limit the number of characters which a user can enter into
the Comments field, you'll have to do that yourself before writing to the
database.
--
John Saunders
johnwsaundersii i at hotmail

Nov 18 '05 #3
"Paul King" <ki******@hotma il.com> wrote in message
news:u5******** ******@TK2MSFTN GP12.phx.gbl...
Yes ok, but how do you set the Width on the screen?

For example I want the whole ASP Form only to be a certain size.


Paul,

This sort of thing is typically done through styles - either inline styles
or by using CSS classes. For instance, if you wanted to design for an
800x600 screen, you could start off your design by adding a Panel control to
the form and setting the Panel's Height and Width properties. You can then
drag controls into the Panel, and, for instance, set their width to 100%:

<%@ Page language="c#" Codebehind="Web Form1.aspx.cs" AutoEventWireup ="false"
Inherits="WebAp plication1.WebF orm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<body>
<form id="Form1" method="post" runat="server">
<asp:Panel Runat="server" Height="600px" Width="800px"
id="Panel1">
<asp:DataGrid id="DataGrid1" runat="server"
Width="100%"></asp:DataGrid>
</asp:Panel>
</form>
</body>
</HTML>

You can lay out the space within the Panel by using tables, and again you
can set the width and/or height to 100%. This way you only have to change
width and/or height in one place.
--
John Saunders
johnwsaundersii i at hotmail
Nov 18 '05 #4
Thanks - thats works a gem

Cheers
Paul.
"John Saunders" <jo************ **@notcoldmail. com> wrote in message
news:ua******** ******@TK2MSFTN GP09.phx.gbl...
"Paul King" <ki******@hotma il.com> wrote in message
news:u5******** ******@TK2MSFTN GP12.phx.gbl...
Yes ok, but how do you set the Width on the screen?

For example I want the whole ASP Form only to be a certain size.
Paul,

This sort of thing is typically done through styles - either inline styles
or by using CSS classes. For instance, if you wanted to design for an
800x600 screen, you could start off your design by adding a Panel control

to the form and setting the Panel's Height and Width properties. You can then
drag controls into the Panel, and, for instance, set their width to 100%:

<%@ Page language="c#" Codebehind="Web Form1.aspx.cs" AutoEventWireup ="false" Inherits="WebAp plication1.WebF orm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<body>
<form id="Form1" method="post" runat="server">
<asp:Panel Runat="server" Height="600px" Width="800px"
id="Panel1">
<asp:DataGrid id="DataGrid1" runat="server"
Width="100%"></asp:DataGrid>
</asp:Panel>
</form>
</body>
</HTML>

You can lay out the space within the Panel by using tables, and again you
can set the width and/or height to 100%. This way you only have to change
width and/or height in one place.
--
John Saunders
johnwsaundersii i at hotmail

Nov 18 '05 #5

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

Similar topics

0
1153
by: Clive | last post by:
Hi, I have a datagrid whereby I specify the ForeColor for my ItemStyle to be #ff6600. However this does not change the color of the font to be above. If I change the backcolor, it changes fine but he ForeColor does not.
3
1632
by: matthew schouppe | last post by:
I have a datagrid with two columns, the first a normal bound column, the second is a template column created from a bound column. For the ItemTemplate of the Template Column, I removed the label and replaced it with a textbox. Displaying the data from the datasource is not a problem, however when I change the data in the textbox and click on an update button (the thought being that multiple rows will have been changed and I can simply...
0
1158
by: Diego | last post by:
Does the Wrap="False" feature work for a datagrid with autocolums or it's just a joke? Regards, Diego.
0
865
by: leodippolito | last post by:
Hello sirs, In my aspx file I have a datagrid with some BoundColumn's. When a format has been defined for a column (for colors, horizontal alignment, etc), it adds an ItemStyle element inside the bound column element, as in this example:
1
1108
by: leodippolito | last post by:
Hello sirs, In my aspx file I have a datagrid with some BoundColumn's. When a format has been defined for a column (for colors, horizontal alignment, etc), it adds an ItemStyle element inside the bound column element, as in this example: <asp:BoundColumn DataField="DEEMAIL" SortExpression="DEEMAIL"
0
1051
by: Smith | last post by:
I have used literal and datagrid control in my application. For literal text I have used the font size as 1. What should I select (Larger,xx-small....) for the itemStyle.Font.Size property to make sure both the font size looks same. Thanks, Smith
0
2981
by: .Net Sports | last post by:
I'm trying to display a figure in my datagrid as a currency ($100.00), but I can't use DataFormatString inside templatecolumn, itemstyle, or itemtemplate (as they imply that no attribute named DataFormatString is available for them). But I can use DataFormatString in BoundColumn. Wondering how I would use TemplateColumn, ItemStyle, or ItemTemplate to format a displayable field to currency/price {0:C} Thanks in advance NetSports
1
5809
by: Dick | last post by:
Is it possible to include in a theme, the ItemStyle that belongs to the BoundField of a GridView's column? i.e. the BorderColor property from the control defined below? <asp:GridView ID="GridView1" runat="server"> <Columns> <asp:BoundField DataField="ID" HeaderText="ID"> <ItemStyle BorderColor="ButtonShadow"/> </asp:BoundField> </Columns>
1
8024
by: tshad | last post by:
I have columns with text and radio buttons that I would like to center or put to the right of the cell, but the attribute ItemStyle-HorizontalAlign="right" doesn't seem to work. <asp:TemplateColumn HeaderText="Job Board" Visible="true" ItemStyle-Width="150px" HeaderStyle-Width="150px" ItemStyle-VerticalAlign="middle" ItemStyle-HorizontalAlign="right"> <itemtemplate> asp:Label ID="JobBoardName" Text='<%#
0
8356
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
8866
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
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
8550
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
8639
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...
1
6192
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
4198
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
4366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2011
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.