Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to keep the gridview's column of specific height

Status
Not open for further replies.

venuchalla

Programmer
May 30, 2006
29
FR
Hello,
I am retrieving the data from the database into the drigview, one of the columns in the grid view is a text column which can take maximum of characters ,
Now my problem is the column height is increasing depending on the charcters length.
How can I make the column of fixed height without increasing. I could change the width by using
ItemStyle-Width="400"
ItemStyle-Wrap="true"
ItemStyle-Height="5"
Using this I could see that the height and width are changed but when I run the application and see the page, i dont find that height , the height is increased to the size of the text which is retreived from the database.

Any help to my problem please...
Thanks,
 
What are you expecting to happen? Either the width or the height have to adjust to show all of the text retrieved.

Jim
 
Now the height is getting adjusted to show all the text retrieved , but when that is happening the size of the record is increasing and the page is full with all the big sized records only.

So I want to keep the height without adjusting automatically so that , all the text retrieved in that column should be scrolled to be read and not that the height be increased.

Thanks,
 
You want the height to stay fixed, but have the width adjust? Is that correct?
 
I want to keep the width and height fixed.

Thanks,
 
In that case, you are not going to get scroll bars since a datagrid renders as a table. What you an do, is place a textbox in a templat column, and set the height and width you want. Set the mode to multiline propery to true. Then you bind to that textbox, and you will get scroll bars.

Jim
 
I could do that in the Edit template but I am not able to display like that.

Is there a way instead for me to show only few characters (40 characters ) instead of the complete text in the column and give a link to show the complete text in another aspx page or so,

Can you please suggest me how to do it??

Thanks,
 
Why can't you display it like that?

To show only 40 characters, change the sql you are running to pull back only the first 40 chars.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top