Link to home
Start Free TrialLog in
Avatar of introlux
introluxFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Gridview Display

Hi,

I have a gridview that is displayed, but the problem is some of the fields have too much content in them and would like prefer if it is possible to only show a small description of the data, and when user clicks on the row, it expands the data and displays it in full. As from normal load it is taking up to much of the browser screen.

Any help will be appreciated.

Regards,

introlux
Avatar of Pra4444
Pra4444
Flag of United States of America image

This example is probably what you are looking for...

http://aspnet.4guysfromrolla.com/articles/071107-1.aspx
Avatar of introlux

ASKER

I am looking more for the following example:

Name Description
Dave  He is a person and has....

When clicking on lets say a + icon will extend the info from ... to the full description in the field.

Does that make sense?

introlux
hi,

I have been told to do the following by other sources but do not understand.

- on the label for short description, just do something like... txtSource.Substring(0,50)+"..."
 - add the Bind("Column Name") to the label
As the data is dynamic (sql statements) the user will pick a redfined SQL statement but before doing this, the following check will need to be done:
- you'll need to check whether the column is there before binding

I hope this makes sense to anyone.

Regards,

introlux
Avatar of Bob Learned
There is a way to show text with an ellipsis, but you have to do some trickery to get this done.  I am looking back at some of might old ASP.NET stuff to find that way.
Any luck??
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have looked at this, but I cant seem to make any relevants to what im looking for.
1) Apply CSS style to the cell:

cell.Style["overflow"] = "hidden";
cell.Style["text-overflow"] = "ellipsis";

2) Set the table layout to fixed:
gv1.Style["TABLE-LAYOUT"] = "fixed";

3) Turn off word-wrap:
cell.Wrap = false;

Hi TheLearnedOne,

You have lost me! I am not sure how I will embed this with a standard gridview that is created on front code. Soz but very confused!

Regards,

introlux
My friend, the article shows you the code that you need to use, and I was trying to show you the important pieces of that code, so how can I help remove your confusion.

You should be able to copy the code from your, and make it fit pretty easily into your project, or a sample project (so that you can make sure the effect works before adding it to your project).
Yes! Got it working - Just needed to break it down slowly lol - Was rushing for the an end result :-)

The thing is when hovering over the text, it will show all the txt via tooltip text. I would prefer to have + button on the side to expand and display the extra text.

Is this possible?
Also on the tooltip text displays breaks like (20%) which is not clear for a novice user to what this is meant.

Regards,

introlux