Datagrid row height changes depending on number of items?

Discussion in 'ASP .Net Datagrid Control' started by Andre Ranieri, Dec 2, 2003.

  1. 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();
    Andre Ranieri, Dec 2, 2003
    #1
    1. Advertising

  2. 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.
    Andre Ranieri, Dec 3, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kat
    Replies:
    5
    Views:
    1,788
  2. =?Utf-8?B?Y2RiaWdncw==?=
    Replies:
    0
    Views:
    362
    =?Utf-8?B?Y2RiaWdncw==?=
    Mar 12, 2006
  3. W@cek
    Replies:
    0
    Views:
    1,612
    W@cek
    Mar 31, 2005
  4. M. Clift
    Replies:
    18
    Views:
    485
    M. Clift
    Oct 5, 2004
  5. Daniel
    Replies:
    1
    Views:
    91
    Randy Webb
    Jan 20, 2004
Loading...

Share This Page