A
Andre Ranieri
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();
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();