grid view problem

Posted by Smash_amit under ASP.NET on 2/15/2009 | Views : 2000 | Status : [Member] | Replies : 1

i hav a problem ...

i hav a with c# web which i display data from database in grid view........

the this...if the data for a perticular entry and field is more than one line....or the statment is long in single line..........then my gridviiew...expand in width due to.....the lengthy data in perticular entry..and grid view expands horizontally..........this gives very ugly look to gridview view.......

is there any way by which i can fix the size of the cell in the grid view....and if data in perticular cell is more....then it becomes multiline data....and as a result the size of grid view remains fixed.

pzzz help mee..


Posted by: Poster on: 2/16/2009 [Member] Starter

You can write a Replace function or just use <%# Eval("MyData").ToString().Replace("\n", "<br />") %>. This should help.

Otherwise, write the .css code like this under the ItemTemplate

<div style="overflow:scroll;width:300px;"><%# Eval("MyData")%></div>

This will create a scroll bar if the width of the data increases more than 300 pixels.

These are just a work around.


Smash_amit, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response