I have a Gridview that returns its data perfectly and I want to attach
soame of the data to web page header. Other data follows, but this is
in the opening summary. Just cant seem to get it to work, and I've
tried many googles to find the answer. HELP!
<form id="form1" runat="server">
<p>Department of
<asp:Label ID="DeptName" Text="name" runat="server" />
has
<asp:Label ID="Count" Text="count" runat="server" />
personel</p>
<br />
<br />
<div id="content">
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False"
CssClass="DeptGrid"
OnRowDataBound="GridView1_RowDataBound" Width="840">
<Columns>
<asp:boundfield headertext="As of" HeaderStyle-Width="120"
ItemStyle-HorizontalAlign="center"
datafield="lastupdatedate />
<asp:boundfield headertext="Manager" HeaderStyle-Width="120"
ItemStyle-HorizontalAlign="center"
datafield="manager" />
<asp:boundfield headertext="IP" HeaderStyle-Width="100"
ItemStyle-HorizontalAlign="center"
datafield="Budget" />
</Columns>
</asp:GridView>
-------------------------------------------------------
protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DeptName.Text = GridView.Rows[0].Cells[6].Text.ToString;
Count.Text = GridView.Rows[0].Cells[7].Text.ToString;
}
}