473,417 Members | 1,530 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,417 software developers and data experts.

help with datagrid

I have a datagrid inside a table and I want to fix both (table and databrid)
width to 700, but when the content of datagrid is too large the width
increases automatically sometimes and sometimes not. Please need help with
that.
Thanks,
Alejandro.
Nov 19 '05 #1
8 1772
"Alejandro Penate-Diaz" <al*******@apenate.com> wrote in message
news:eI****************@TK2MSFTNGP10.phx.gbl...
I have a datagrid inside a table and I want to fix both (table and
databrid) width to 700, but when the content of datagrid is too large the
width increases automatically sometimes and sometimes not. Please need help
with that.


Have you tried setting Width="700px" on the DataGrid? Or Width="100%"?

John Saunders
Nov 19 '05 #2
yes I tried width="700px" for the datagrid and each column (5 columns) are
width="140px" and property "wrap" set to true to each column and <td>. but
this is just not working, sometimes it does but sometimes not, it dependes
on the text on the column, for example if the text is "Microsoft Certified
Application Developer" it works ok and text is wraped, but if the text is
"ASP.NET.Unleashed.2nd.Edition"it doesnt work.

Alejandro.
"John Saunders" <johnwsaundersiii at hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
"Alejandro Penate-Diaz" <al*******@apenate.com> wrote in message
news:eI****************@TK2MSFTNGP10.phx.gbl...
I have a datagrid inside a table and I want to fix both (table and
databrid) width to 700, but when the content of datagrid is too large the
width increases automatically sometimes and sometimes not. Please need
help with that.


Have you tried setting Width="700px" on the DataGrid? Or Width="100%"?

John Saunders

Nov 19 '05 #3
"Alejandro Penate-Diaz" <al*******@apenate.com> skrev i en meddelelse
news:eV****************@TK2MSFTNGP09.phx.gbl...
yes I tried width="700px" for the datagrid and each column (5 columns) are
width="140px" and property "wrap" set to true to each column and <td>. but
this is just not working, sometimes it does but sometimes not, it dependes
on the text on the column, for example if the text is "Microsoft Certified
Application Developer" it works ok and text is wraped, but if the text is
"ASP.NET.Unleashed.2nd.Edition"it doesnt work.


Your problem is that you need some kin of wordspliting utillity. When you
have serval words the browser can wrap the contents like you want but with
very long words it has to take a decission. Hide the overflown text or
expand the table....The browser does the last.

You could set CSS overflow: hidden to hide the text but do you really want
that? You can´t make the browser split words and insert "-"..

Anders
Nov 19 '05 #4
thans, that's exactly my problem. I have seen log words with "-" been
splited automaticaly but with "." doesnt work. Can I hide the extra text
without using CSS? I dont mind hiding the extra text because there is an
Edit button that can be used to see the whole text.

Thanks,
Alejandro.
"Anders K. Jacobsen [DK]" <no**@at.all> wrote in message
news:e%****************@TK2MSFTNGP12.phx.gbl...
"Alejandro Penate-Diaz" <al*******@apenate.com> skrev i en meddelelse
news:eV****************@TK2MSFTNGP09.phx.gbl...
yes I tried width="700px" for the datagrid and each column (5 columns)
are width="140px" and property "wrap" set to true to each column and
<td>. but this is just not working, sometimes it does but sometimes not,
it dependes on the text on the column, for example if the text is
"Microsoft Certified Application Developer" it works ok and text is
wraped, but if the text is "ASP.NET.Unleashed.2nd.Edition"it doesnt work.


Your problem is that you need some kin of wordspliting utillity. When you
have serval words the browser can wrap the contents like you want but with
very long words it has to take a decission. Hide the overflown text or
expand the table....The browser does the last.

You could set CSS overflow: hidden to hide the text but do you really want
that? You can´t make the browser split words and insert "-"..

Anders

Nov 19 '05 #5
> thans, that's exactly my problem. I have seen log words with "-" been
splited automaticaly but with "." doesnt work. Can I hide the extra text
without using CSS? I dont mind hiding the extra text because there is an
Edit button that can be used to see the whole text.


Why wouldnt you use CSS? Target IE 3+? Anyway if you choose css look eg
here; http://www.quirksmode.org/css/overflow.html

If you dont want css you are on you own eg with javascript to pass the
innerHtml in the TD and eg. cut off all leters where innerHTML.legth > eg
20 letters. Dont know. Go for css if possible.

Anders
Nov 19 '05 #6
I will try css but I just dont know how to do it. if you want to take a look
below is my code:

<TABLE id="Table1" style="WIDTH: 700px; overflow: scroll" height="100%"
cellSpacing="1" cellPadding="1" width="700"
border="0">
<TR>
<TD style="HEIGHT: 4px"><uc1:header id="Header1"
runat="server"></uc1:header></TD>
</TR>
<TR>
<TD height="10">
<uc1:subheader id="Subheader1" runat="server"></uc1:subheader></TD>
</TR>
<TR style="BACKGROUND-COLOR: white; overflow: scroll">
<TD style="overflow: scroll" vAlign="top" align="left" width="700"
bgColor="#000000"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<P>
<asp:HyperLink id="HyperLink1" runat="server"
NavigateUrl="logs.aspx" ForeColor="#FFFF80">Logs</asp:HyperLink></P>
<P><asp:dropdownlist id="sectionDDL" runat="server"
AutoPostBack="True">
<asp:ListItem Value="Sections"
Selected="True">Sections</asp:ListItem>
</asp:dropdownlist><asp:dropdownlist id="subsectionsDDL"
runat="server" AutoPostBack="True" Visible="False"></asp:dropdownlist></P>
</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<asp:DataGrid id="DataGrid1" runat="server" Visible="False"
HorizontalAlign="Left" Width="700px"
AutoGenerateColumns="False" ItemStyle-Wrap="true"
ItemStyle-Width="140px">
<ItemStyle Font-Size="Smaller" Width="140px"
BackColor="#FFFFC0"></ItemStyle>
<HeaderStyle BorderStyle="Solid" BackColor="#C0C0FF"></HeaderStyle>
<Columns>
<asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update"
CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
<asp:ButtonColumn Text="Delete" ButtonType="PushButton"
CommandName="Delete"></asp:ButtonColumn>
<asp:BoundColumn DataField="id" ReadOnly="True"
HeaderText="ID"></asp:BoundColumn>
<asp:BoundColumn DataField="url" HeaderText="Url"
ItemStyle-Wrap="true" ItemStyle-Width="140px"></asp:BoundColumn>
<asp:BoundColumn DataField="text" HeaderText="Text"
ItemStyle-Wrap="true" ItemStyle-Width="140px"></asp:BoundColumn>
</Columns>
</asp:DataGrid>
<P align="center">&nbsp;</P>
</SPAN>
</TD>
</TR>
</TABLE>
"Anders K. Jacobsen [DK]" <no**@at.all> wrote in message
news:er**************@TK2MSFTNGP15.phx.gbl...
thans, that's exactly my problem. I have seen log words with "-" been
splited automaticaly but with "." doesnt work. Can I hide the extra text
without using CSS? I dont mind hiding the extra text because there is an
Edit button that can be used to see the whole text.


Why wouldnt you use CSS? Target IE 3+? Anyway if you choose css look eg
here; http://www.quirksmode.org/css/overflow.html

If you dont want css you are on you own eg with javascript to pass the
innerHtml in the TD and eg. cut off all leters where innerHTML.legth > eg
20 letters. Dont know. Go for css if possible.

Anders

Nov 19 '05 #7
I made it, thanks. just wrapped te datagrid between <div></div> and set
overflow:auto

Thanks,
Alejandro

"Anders K. Jacobsen [DK]" <no**@at.all> wrote in message
news:er**************@TK2MSFTNGP15.phx.gbl...
thans, that's exactly my problem. I have seen log words with "-" been
splited automaticaly but with "." doesnt work. Can I hide the extra text
without using CSS? I dont mind hiding the extra text because there is an
Edit button that can be used to see the whole text.


Why wouldnt you use CSS? Target IE 3+? Anyway if you choose css look eg
here; http://www.quirksmode.org/css/overflow.html

If you dont want css you are on you own eg with javascript to pass the
innerHtml in the TD and eg. cut off all leters where innerHTML.legth > eg
20 letters. Dont know. Go for css if possible.

Anders

Nov 19 '05 #8
>I made it, thanks. just wrapped te datagrid between <div></div> and set
overflow:auto


Yes sorry for not been more precise. The overflow applies to div as you
noticed.

Happy programming
Anders Jacobsen, Denmark
Nov 19 '05 #9

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

Similar topics

4
by: Bruce Pullum | last post by:
I have a datagrid that I am using a DataView with. All works great for the sorting of the columns. However, after I sort the column, and then try and select a data row to edit, the row selected...
2
by: Anita C | last post by:
Hi, How do I associate or map a specific column in a datatable to a particular element present in an xml document - to read into a datatable as well as write from the datatable to the xml element?...
8
by: pei_world | last post by:
Hi, there; I have a problem with my datagrid control. I declared it in one of my form, set with DataGridTalbeStyle as well, and when I click on button, I would like to retrive Data from Database...
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
1
by: Michael Gorbach | last post by:
Iv got a StatisticsContainer object that contains an arraylist of objects of different types, all inherited from class Statistic. The statistics class has 2 string public properties, name and...
14
by: Brett Sinclair | last post by:
Hello everybody I'm still on the learning curve here...and from what I read, I created inherited datagrid class so I could have icons, combobox...etc in the columns of my datagrid. The grid...
6
by: Coleen | last post by:
Hi All :-) Thanks for all of your help Cor :-) I can not get the code you sent me to work in my application. I'm using an aspx datagrid in a web form. I'm getting the following error message...
2
by: Brad Shook | last post by:
First of all thinks to Cor Ligthert for helping me with this last week. If you wild like to read Cor's comments please refer to the posting from 10/14/2004 and 8:48AM "Help with Advanced...
3
by: Datatable Dataset Datagrid help | last post by:
Hi I am somewhat confused, I am new at VB.net I use XML data, I have a datagrid, I created a datatable so that I can create a custom format like true is this graphic false is this graphic and...
4
by: Jeff User | last post by:
Hi I tryed to solve this problem over in the framework.asp group, but still am having trouble. Hope someone here can help. using .net 1.1, VS 2003 and C# I have an asp.DataGrid control with a...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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...
0
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...
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,...

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.