You have to change the DataSet.
Look at this link:
http://msdn.microsoft.com/
[melack]
Main Topics
Browse All TopicsHi, I have two datagrids on a page:
System.Web.UI.WebControls.
System.Web.UI.WebControls.
myGrid2 Will always have a single row in it - how can I "copy" this row into myGrid in the code?
thanks!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You have to change the DataSet.
Look at this link:
http://msdn.microsoft.com/
[melack]
<asp:datagrid id="totalsDataGrid" runat="server" HeaderStyle-CssClass="Norm
ItemStyle-CssClass="Normal
EnableViewState="False" BorderColor="Gray" AlternatingItemStyle-BackC
<ItemStyle CssClass="Normal "></ItemStyle>
<HeaderStyle Font-Bold="True" CssClass="Normal "></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="Criteria"></asp
<asp:BoundColumn DataField="2000"></asp:Bou
<asp:BoundColumn DataField="2001" SortExpression="2001"></as
<asp:BoundColumn DataField="2002" SortExpression="2002"></as
<asp:BoundColumn DataField="Total" SortExpression="Total"></a
</Columns>
</asp:datagrid>
They are just "normal" databound columns.
Maddog - If I understand you correctly, I don't think I want to do this.
My problem is this:
I want to be able to sort on the columns (by year for example 2000)
But I have another row of data that totals up each column - and I don't want to include this in the sorting.
That is the only reason that I have the second datagrid - I couldn't figure out how to create the SQL to not sort that last row (the totals)
But now when the data is exported to Excel, I want to just do this, as I have done in the past:
myGrid.RenderControl(htmlW
Response.Write(stringWrite
Response.End();
So before I do this, I thought that I would just add that row into the other datagrid, and the user would never know the difference...
Thanks for the help. I found this code through maddog's link to help me:
I just had to convert the Function to c#
Sample code:
{
myDataGrid.DataSource = myDataTable;
myDataGrid.DataBind();
Response.Write(ConvertDtTo
Response.End();
}
private String ConvertDtToTDF(DataTable dt)
{
StringBuilder sb = new StringBuilder();
DataRow dr = dt.NewRow();
Object[] ary ;
int i = 0;
int iCol = 0;
//Output Column Headers
for (iCol=0; iCol < dt.Columns.Count; iCol ++)
{
sb.Append(dt.Columns[iCol]
}
sb.Append("\r\n");
//Output Data
foreach (DataRow r in dt.Rows)
{
ary = r.ItemArray;
for (i=0; i < ary.Length; i++)
{
sb.Append(ary[i].ToString(
}
sb.Append("\r\n");
}
return sb.ToString();
}
Business Accounts
Answer for Membership
by: TheLearnedOnePosted on 2005-12-09 at 10:38:12ID: 15454567
How is the DataGrid bound to the data?
Bob