473,800 Members | 2,930 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dispalying data in a cell in gridview

Hi,
I've bind a grdiview to a database and it's working fine. but what I want
to do is if the data in certain cell exceed the cell width the that cell will
only show the words with some dots implying to the user that is more data
that should be seen.
meaning that if the data to be shown in a cell is e.g: "This is my data an
it's very long that why I'm showing it all" I would like cell just showing
the first words followed by dots like "This is my data an it's very long...."
is there some property or something to be set in my gridview allowing my
cells to do that?

Thanks


--
Regards,
M.Rochdi
Aug 28 '07 #1
2 1456
Hi,
You can do it by handling ItemDataBound event if it is asp.net 1.1 or
RowDataBound event if it is asp.net 2.0.Google for "itemdatabo und
rowdatabound event asp.net" and you will get exact syntax for ItemDataBound
or rowdatabound
Also http://gridviewguy.com is good site to visit if you any query regarding
asp.net 2.0 gridview
--
Hope this helps.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.

"Mike" wrote:
Hi,
I've bind a grdiview to a database and it's working fine. but what I want
to do is if the data in certain cell exceed the cell width the that cell will
only show the words with some dots implying to the user that is more data
that should be seen.
meaning that if the data to be shown in a cell is e.g: "This is my data an
it's very long that why I'm showing it all" I would like cell just showing
the first words followed by dots like "This is my data an it's very long...."
is there some property or something to be set in my gridview allowing my
cells to do that?

Thanks


--
Regards,
M.Rochdi
Aug 28 '07 #2
The easiest method is to do this in your SQL statement by using the
SUBSTRING method. Have a look at how to use this method here:

http://msdn2.microsoft.com/en-us/library/ms187748.aspx

--
Mark Smith
http://aspnetlibrary.com

Aug 28 '07 #3

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

Similar topics

4
35620
by: Neil | last post by:
I have a gridview which is being populated with no problems. I want to be able to reference the data from the cells in the row but having followed an example on MSDN cannot get any data to be displayed in a text box no matter which cell index I provide. I tried a row of code that successfully displays the rowindex of the selected row. The code with comments is below:
3
2343
by: kevinpublic | last post by:
I have an item list for ordered products on a data grid in VS 2003. It's an ASP page running VB behind it. All detail lines display as well as all shipping charges. On the edit screen, we allow them to cancel individual line items. We have the 'Cancel' button enabled for the line items of the datagrid. However, I would like to hide that button for the shipping charges. We don't want them cancelling their shipping fees, after all. ...
1
27505
by: K B | last post by:
I would like to create a gridview as below: Project Name 1-1 1-2 1-3 1-4 1-5 1-6 Project 1 BLUE BLUE BLUE BLUE GREEN GREEN more projects I would like to fill the cell with a solid color based on the value of the cell (e.g., documents that are complete (blue) or not complete (green). In effect have a solid bar indicator going across each row. I know how to color the cell based on the value, but not the click...
4
2543
by: Mark Olbert | last post by:
I'm running into a well-described issue in the ASPNET model that I haven't found a good work around for. I have a GridView to which I dynamically add data-bound TemplateFields at run-time. The specific fields that are added depend on the state of the application. The contents of these fields displays properly after they are first initialized, but not after postback (e.g., just a simple button control that doesn't do anything except...
3
3312
by: Bill Gower | last post by:
I have an cell which contains a field member which is filled with String.Empty. When I retrieve the value in the cell with Cells.Text.ToString() and try to compare it to String.Empty, I can't because it contains "&nbsp". I really don't want to compare the value to that so how can I retrieve an empty cell so that it is String.Empty. Bill
1
2032
by: DanThMan | last post by:
Hi All, Here's how my data looks. Two tables. The first has all the data in "expanded" form, the second has just "ID" data in "pivoted" form. Here's the "expanded" table: DataID | RowID | ColumnID | Label | Color --------------------------------------------- 1 | 1 | 1 | Warning | Red
1
1717
by: oladele | last post by:
Hello All, I want to be able to edit a cell data in a gridview when I double click it. I also want to be able to invoke update on the cell i edit when i click away from the cell.can this be possible on a Gridview using c#. Thanks.
4
5866
by: foolmelon | last post by:
Before AJAX, we were able to focus a cell in a gridview during a fullpage postback. After putting the gridview inside an UpdatePanel, we cannot focus a cell in this gridview anymore. Does anybody know if it is possible to make such focus? Thanks! Bill
0
1263
by: teressa | last post by:
Hi, I am new to Grid view Control. I have a page with many icons on it for different purposes. I want to add a Grid View where I want to load data with different columns. Below is my code(xyz.aspx).Where i need to add the aspx page to my original page.(I tried adding to my HTML page but it returns with an error(We’re sorry, the application is currently unavailable. If you need any assistance, please contact ...)instead of loading data. I...
0
9689
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
9550
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
10269
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
10248
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
10032
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
6811
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
5469
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
5597
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
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.