Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Datagrid row height changes depending on number of items?

Reply
Thread Tools

Datagrid row height changes depending on number of items?

 
 
Andre Ranieri
Guest
Posts: n/a
 
      12-02-2003
I'm fairly new to datagrids, I hope folks bear with me. . .

I've added several bound datagrids to a web application I'm creating; I added the datagrids themselves in design view with the columns as part a collection in the datagrid control properties. The datagrid is bound to a dataset in run-time, using the following code.

I've noticed that the height of the header, footer and individual rows in the datagrid is variable depending on how many rows are in my dataset table. If there's only a couple rows the header and rows are ridiculously tall; if there are 5-10 rows they're much shorter. Is there anything I can do to make the height of the individual rows uniform regardless of how many rows appear in the datagrid?

Thanks,

Andre



DataTable SchedServices = ds.Tables["SchedServices"];
DataColumn dcDateScheduledString = new DataColumn ("DateScheduledString", typeof(string));
SchedServices.Columns.Add(dcDateScheduledString);
SchedServices = ds.Tables["SchedServices]"];
dgSchedServices.DataSource=ds.Tables["SchedServices"];
if( ds.Tables["SchedServices"].Rows.Count!=0)
{
//Format null Date Scheduled to read "Not Scheduled"
foreach (DataRow dsRow in ds.Tables["SchedServices"].Rows)
{
dsRow["DateScheduledString"] = dsRow["DateScheduled"] + "";
if (dsRow["DateScheduledString"].ToString() == "")
{
dsRow["DateScheduledString"]="Schedule Pending";
}
if (dsRow["Service"].ToString().Substring(0,2) == "43")
{
dsRow["DateScheduledString"]= "Weather dependant";
}
}

DataView source = new DataView(ds.Tables["SchedServices"]);
dgSchedServices.DataSource = ds.Tables["SchedServices"] ;
dgSchedServices.DataBind();
 
Reply With Quote
 
 
 
 
Andre Ranieri
Guest
Posts: n/a
 
      12-03-2003
I finally figured this one out, and wanted to share. If you clear the height from the datagrid's properties, the row height is the same regardless of number of rows.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom row styling in a datagrid depending on certain data in ASP. =?Utf-8?B?Y2RiaWdncw==?= ASP .Net 0 03-12-2006 06:23 AM
ok I can do a totals row but how about a percentage row after each data row D ASP .Net Datagrid Control 0 05-23-2005 04:10 PM
1em height row in IE (spanned row) W@cek HTML 0 03-31-2005 11:23 AM
Datagrid not sized for number of items. Trying to use Flow Layout, affecting row height. Kat ASP .Net 5 10-21-2004 08:13 PM
CSS-changes depending on document.refferer Daniel Javascript 1 01-20-2004 03:35 AM



Advertisments