473,830 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1793
"Alejandro Penate-Diaz" <al*******@apen ate.com> wrote in message
news:eI******** ********@TK2MSF TNGP10.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.Unleas hed.2nd.Edition "it doesnt work.

Alejandro.
"John Saunders" <johnwsaundersi ii at hotmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
"Alejandro Penate-Diaz" <al*******@apen ate.com> wrote in message
news:eI******** ********@TK2MSF TNGP10.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*******@apen ate.com> skrev i en meddelelse
news:eV******** ********@TK2MSF TNGP09.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.Unleas hed.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%******** ********@TK2MSF TNGP12.phx.gbl. ..
"Alejandro Penate-Diaz" <al*******@apen ate.com> skrev i en meddelelse
news:eV******** ********@TK2MSF TNGP09.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.Unleas hed.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:heade r id="Header1"
runat="server"> </uc1:header></TD>
</TR>
<TR>
<TD height="10">
<uc1:subheade r id="Subheader1 " runat="server"> </uc1:subheader></TD>
</TR>
<TR style="BACKGROU ND-COLOR: white; overflow: scroll">
<TD style="overflow : scroll" vAlign="top" align="left" width="700"
bgColor="#00000 0"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<P>
<asp:HyperLin k id="HyperLink1 " runat="server"
NavigateUrl="lo gs.aspx" ForeColor="#FFF F80">Logs</asp:HyperLink></P>
<P><asp:dropdow nlist id="sectionDDL " runat="server"
AutoPostBack="T rue">
<asp:ListItem Value="Sections "
Selected="True" >Sections</asp:ListItem>
</asp:dropdownlis t><asp:dropdown list id="subsections DDL"
runat="server" AutoPostBack="T rue" Visible="False" ></asp:dropdownlis t></P>
</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<asp:DataGrid id="DataGrid1" runat="server" Visible="False"
HorizontalAlign ="Left" Width="700px"
AutoGenerateCol umns="False" ItemStyle-Wrap="true"
ItemStyle-Width="140px">
<ItemStyle Font-Size="Smaller" Width="140px"
BackColor="#FFF FC0"></ItemStyle>
<HeaderStyle BorderStyle="So lid" BackColor="#C0C 0FF"></HeaderStyle>
<Columns>
<asp:EditComman dColumn ButtonType="Pus hButton" UpdateText="Upd ate"
CancelText="Can cel" EditText="Edit" ></asp:EditCommand Column>
<asp:ButtonColu mn Text="Delete" ButtonType="Pus hButton"
CommandName="De lete"></asp:ButtonColum n>
<asp:BoundColum n DataField="id" ReadOnly="True"
HeaderText="ID" ></asp:BoundColumn >
<asp:BoundColum n DataField="url" HeaderText="Url "
ItemStyle-Wrap="true" ItemStyle-Width="140px"></asp:BoundColumn >
<asp:BoundColum n DataField="text " HeaderText="Tex t"
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******** ******@TK2MSFTN GP15.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******** ******@TK2MSFTN GP15.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:aut o


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
2451
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 represents the indes of the actual DataGrid and not the DataView. For example.. Lets say I have 4 rows of data.. In the 4 rows I have an Appt Num of 1,2,3,4... Each representing a data row... I sort DESC so the rows display 4,3,2,1... If I...
2
5144
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? Also, how can I associate all the attributes and their values of a particular element to the Name & Value columns of a datatable - to read into a datatable as well as write from the datatable to the xml element? Any help will be greatly...
8
3132
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 and bind these data to my datagrid in the form, when I click the button first time, it work fine. but when I click the second button. it report belowing error, I guess it is because it already set up the column name at first time, so cann't do...
0
3650
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 datagrid on the left side that lists names and perhaps a couple of other key fields. The user can click on a record in the datagrid, which should automatically pull up details on that record in the various text boxes and other controls on the right...
1
1519
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 stringValue. The classes that inherit from it use those two properties, plus several properties of their own of types double and vector. I need to display this StatisticsContainer class on a datagrid, but I'm having problems because each of the...
14
1847
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 will be used to populate information coming from a Webservice. (No datasets - No datareaders). So, I do not know see how to use the "datasource".
6
4689
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 when I try this code: "Syntax error in aggregate argument: Expecting a single column argument with possible 'Child' qualifier." Dim dr2 As DataRow = dt_stat_report_3b.NewRow Dim sum As Double =...
2
1324
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 Datagrid" I am trying to bind one column of a datagrid to a seperate textbox and the rest of the fields to a datagrid. the comments are too large to fit in a datagrid so I created a textbox below the datagrid and need it to hold the data for the...
3
2523
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 others. One of the custom format is as follows: dsmessages_dt.Columns.Add("Image", GetType(Image)) I had a problem of when I used a checkbox in the grid that was bound to the datatable that it would not update my dataset. So I created another...
4
2142
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 Delete button on the end of each row. I am unable to gain access to the event when the button is clicked. I don't fully understand how the click gets connected to the C# code,
0
9641
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
10769
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
10476
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
10520
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
9310
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
6940
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
5615
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...
2
3956
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3070
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.