0

I have the bellow Gridview that pulls data from a stored procedure that turns the data from vertical to horizontal with a pivot. I want to add a new row at a specific RowNumber 5. This row will be filled only with black color.

<asp:GridView ID="GridView1"  runat="server" OnRowCommand="GridView1_RowCommand" ShowHeader="true" CssClass="style3"  ForeColor="White"
                    OnRowDataBound="GridView1_RowDataBound" DataSourceID="SqlDataSource1">
                    <EditRowStyle BorderColor="Black" ForeColor="Black" />
<Columns>
     <asp:ButtonField CommandName="ColumnClick" Visible="false" />
</Columns>
</asp:GridView>
4

2 回答 2

1

你对这些有类似的问题。看看他们

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/3cc334fb-9da0-48eb-b83e-0bec72c60d16 http://forums.asp.net/t/1670659.aspx/1

DataTable dt = GridView1.tables[0];
DataRow dr = new DataRow();
DataTable.Rows.InsertAt(dr, 5);
DataTable.AcceptChanges();

gv_list.DataSource = dt;
gv_list.DataBind();
于 2013-05-28T09:36:19.610 回答
0

做这样的事情:

DataRow dr = DataTable.NewRow();
DataTable.Rows.InsertAt(dr, 5);
DataTable.AcceptChanges();

gv_list.DataSource = DataTable;
gv_list.DataBind();
于 2013-05-28T09:54:04.153 回答