total newbie: row height in datagrid

J

Jeff

OS : winXP pro (sp2)
IDE: VS .NET 2003

This is my code for adding data to my datagrid (DataGrid1)

MySqlConnection conn = new
MySqlConnection(ConfigurationSettings.AppSettings["DB_Connection_string"]);
conn.Open();
MySqlDataAdapter adapter = new MySqlDataAdapter();
adapter.SelectCommand = new MySqlCommand("select Mem_id, Mem_Type,
Mem_Forename from Member", conn);
DataSet dataset = new DataSet();
adapter.Fill(dataset, "member");
DataGrid1.DataSource = dataset;
DataGrid1.DataMember = "member";
DataGrid1.DataBind();

This is the datagrid code in HTML:

<asp:DataGrid
id="DataGrid1"
style="Z-INDEX: 106; LEFT: 136px; POSITION: absolute; TOP: 80px"
runat="server"
Width="736px"
Height="448px"
BorderColor="#999999"
BackColor="Transparent"
BorderStyle="Groove"
BorderWidth="1px"
CellPadding="3"
GridLines="Vertical"
AutoGenerateColumns="False">
<FooterStyle ForeColor="Black" BackColor="#CCCCCC"></FooterStyle>
<SelectedItemStyle Font-Bold="True" ForeColor="White"
BackColor="#008A8C"></SelectedItemStyle>
<AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle>
<ItemStyle Font-Size="Medium" HorizontalAlign="Left"
ForeColor="Black" BackColor="#EEEEEE"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White"
BackColor="#000084"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="Mem_id" HeaderText="ID"
FooterText="qtet">
<HeaderStyle Font-Size="Medium" Font-Names="Arial
Black"></HeaderStyle>
<ItemStyle HorizontalAlign="Left"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="Mem_Type" HeaderText="TYPE"
FooterText="qtet"></asp:BoundColumn>
<asp:BoundColumn DataField="Mem_Forename" HeaderText="For Name"
FooterText="qtet"></asp:BoundColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="Black"
BackColor="#999999" Mode="NumericPages"></PagerStyle>
</asp:DataGrid

I got only 1 record in the member table, and when running this script that
row takes up 50% of the datagrid height and the other 50% of datagrid height
is used on the header..... and that doesn't look good..... I want the rows
to have a specific height.... how should I do that, please give me a link,
hint or something that can set me the track to find a solution to my
problem, please!

Best Regards

Jeff
 
B

Bruce Barker

a grid generates a table. in your case 2 tweo row grid, one for the header
and one for the data. becuase you specified a height for the table, it most
split anmong the rows. just take the height off and let it be as small or
large as needed. put a sized div with a border around it:

also you should not use grid layout, as this will not work if the user has
different font sizes or screen resolution.


try

<div style="height:448px;">
<asp:DataGrid
id="DataGrid1"
runat="server"
Width="736px"
BorderColor="#999999"
BackColor="Transparent"
BorderStyle="Groove"
BorderWidth="1px"
CellPadding="3"
GridLines="Vertical"
AutoGenerateColumns="False">
<FooterStyle ForeColor="Black" BackColor="#CCCCCC"></FooterStyle>
<SelectedItemStyle Font-Bold="True" ForeColor="White"
BackColor="#008A8C"></SelectedItemStyle>
<AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle>
<ItemStyle Font-Size="Medium" HorizontalAlign="Left"
ForeColor="Black" BackColor="#EEEEEE"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White"
BackColor="#000084"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="Mem_id" HeaderText="ID"
FooterText="qtet">
<HeaderStyle Font-Size="Medium" Font-Names="Arial
Black"></HeaderStyle>
<ItemStyle HorizontalAlign="Left"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="Mem_Type" HeaderText="TYPE"
FooterText="qtet"></asp:BoundColumn>
<asp:BoundColumn DataField="Mem_Forename" HeaderText="For Name"
FooterText="qtet"></asp:BoundColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="Black"
BackColor="#999999" Mode="NumericPages"></PagerStyle>
</asp:DataGrid

</div>


Jeff said:
OS : winXP pro (sp2)
IDE: VS .NET 2003

This is my code for adding data to my datagrid (DataGrid1)

MySqlConnection conn = new
MySqlConnection(ConfigurationSettings.AppSettings["DB_Connection_string"]);
conn.Open();
MySqlDataAdapter adapter = new MySqlDataAdapter();
adapter.SelectCommand = new MySqlCommand("select Mem_id, Mem_Type,
Mem_Forename from Member", conn);
DataSet dataset = new DataSet();
adapter.Fill(dataset, "member");
DataGrid1.DataSource = dataset;
DataGrid1.DataMember = "member";
DataGrid1.DataBind();

This is the datagrid code in HTML:

<asp:DataGrid
id="DataGrid1"
style="Z-INDEX: 106; LEFT: 136px; POSITION: absolute; TOP: 80px"
runat="server"
Width="736px"
Height="448px"
BorderColor="#999999"
BackColor="Transparent"
BorderStyle="Groove"
BorderWidth="1px"
CellPadding="3"
GridLines="Vertical"
AutoGenerateColumns="False">
<FooterStyle ForeColor="Black" BackColor="#CCCCCC"></FooterStyle>
<SelectedItemStyle Font-Bold="True" ForeColor="White"
BackColor="#008A8C"></SelectedItemStyle>
<AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle>
<ItemStyle Font-Size="Medium" HorizontalAlign="Left"
ForeColor="Black" BackColor="#EEEEEE"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White"
BackColor="#000084"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="Mem_id" HeaderText="ID"
FooterText="qtet">
<HeaderStyle Font-Size="Medium" Font-Names="Arial
Black"></HeaderStyle>
<ItemStyle HorizontalAlign="Left"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="Mem_Type" HeaderText="TYPE"
FooterText="qtet"></asp:BoundColumn>
<asp:BoundColumn DataField="Mem_Forename" HeaderText="For
Name" FooterText="qtet"></asp:BoundColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="Black"
BackColor="#999999" Mode="NumericPages"></PagerStyle>
</asp:DataGrid

I got only 1 record in the member table, and when running this script that
row takes up 50% of the datagrid height and the other 50% of datagrid
height is used on the header..... and that doesn't look good..... I want
the rows to have a specific height.... how should I do that, please give
me a link, hint or something that can set me the track to find a solution
to my problem, please!

Best Regards

Jeff
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top