2014年7月13日 星期日

[RESOLVED] Gridview doesnt accept much data


Hi ,


When i bind the data to gridview the look of the gridview is some thing like this ..... in haphazzard manner. i.e. not in aproper way.


one of the xpert given me the code to write in cs file ,so that the gridview doesnt goes out side the

:


protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

{

foreach (TableCell myCell in e.Row.Cells)

{

myCell.Style.Add("word-break", "break-all");

myCell.Width=70;



}

}



but problem is that by this it doesnt look good. all data are in not a proper alignment.



 





Hi,


Do you want to dynamically allign the width of gridview. if not then apply a css to your gridview like 



and define all the width in that cssclass


/* Grids */

.mGrid { width: 100%; background-color: #fff; margin: 5px 0 10px 0; border: solid 1px #525252; border-collapse:collapse;font-family:Verdana; font-size:12px; }

.mGrid td { padding: 2px; border: solid 1px #c1c1c1; color: #003366; }

.mGrid th { padding: 4px 2px; color: #000000;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFF', endColorstr='#99CCFF'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#FFF), to(#9CF)); /* for webkit browsers */
background: -moz-linear-gradient(top, #FFF, #9CF); /* for firefox 3.6+ */
background: #99CCFF; font-size: 0.9em;border: solid 2px #c1c1c1;
}

.mGrid .alt { background: #fcfcfc; }

.mGrid .pgr {background: #FFFFFF; }

.mGrid .pgr table { margin: 5px 0; }

.mGrid .pgr td { border-width: 0px; padding: 0 6px; border-left: solid 1px #666; font-weight: bold; color: #fff; line-height: 12px; }

.mGrid .pgr a { color: #666; text-decoration: none; }

.mGrid .pgr a:hover { color: #000; text-decoration: none; }

.mGrid tr:hover{background-color:#FFFFCC;color:white;}



Thanks,


but my problem is that i had set width property of

in masterpage which suits to all page, but in case of gridCareer.aspx page the width of the gridtable goes out of
.


I wanna solve dat problm.


Thanks plz help asap.


 



You can try  specifying css properties of div to control overflow, like this:





Now, if your GridView exceeds the dimensions of the containing div, the div will remain static in size and any overflow will prompt scrollbars to appear.







沒有留言:

張貼留言