473,398 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 1320
"Paul King" <ki******@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.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
johnwsaundersiii 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**************@TK2MSFTNGP09.phx.gbl...
"Paul King" <ki******@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.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
johnwsaundersiii at hotmail

Nov 18 '05 #3
"Paul King" <ki******@hotmail.com> wrote in message
news:u5**************@TK2MSFTNGP12.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="WebForm1.aspx.cs" AutoEventWireup="false"
Inherits="WebApplication1.WebForm1" %>
<!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
johnwsaundersiii at hotmail
Nov 18 '05 #4
Thanks - thats works a gem

Cheers
Paul.
"John Saunders" <jo**************@notcoldmail.com> wrote in message
news:ua**************@TK2MSFTNGP09.phx.gbl...
"Paul King" <ki******@hotmail.com> wrote in message
news:u5**************@TK2MSFTNGP12.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="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm1" %>
<!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
johnwsaundersiii at hotmail

Nov 18 '05 #5

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

Similar topics

0
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...
3
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...
0
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
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...
1
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...
0
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...
0
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...
1
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...
1
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. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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,...
0
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...

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.