各位大哥大姐 帮忙看看那里有错啊
我怎么一点 ButtonSort_Click datagrid怎么就不显示拉
我是做一个自动生成datagrid, ButtonSort_Click从新排序datagrid里的数据
页面代码
<form id= "Form1 " method= "post " runat= "server ">
<asp:button id= "ButtonCSV " style= "Z-INDEX: 101; LEFT: 288px; POSITION: absolute; TOP: 272px "
runat= "server " Text= "CSV "> </asp:button> <asp:datagrid id= "DataGrid1 " style= "Z-INDEX: 105; LEFT: 184px; POSITION: absolute; TOP: 72px "
runat= "server " AutoGenerateColumns= "False " PageSize= "2 ">
<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
<FONT face= "MS UI Gothic "> NO </FONT>
</HeaderTemplate>
<ItemTemplate>
<asp:Button id= "Button1 " runat= "server " Text= " <%#((DataGridItem)Container).ItemIndex+1%> " CommandName= "Select ">
</asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid> <asp:button id= "ButtonReturn " style= "Z-INDEX: 102; LEFT: 352px; POSITION: absolute; TOP: 272px "
runat= "server " Text= "Return "> </asp:button> <asp:dropdownlist id= "DropDownList1 " style= "Z-INDEX: 103; LEFT: 128px; POSITION: absolute; TOP: 272px "
runat= "server "> </asp:dropdownlist> <asp:button id= "ButtonSort " style= "Z-INDEX: 104; LEFT: 224px; POSITION: absolute; TOP: 272px "
runat= "server " Text= "Sort "> </asp:button> </form>
页面后台代码
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using WebDSP.common;
namespace WebDSP
{
/// <summary>
/// Summary description for frmShowTable.
/// </summary>
public class frmShowTable : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DropDownList DropDownList1;
protected System.Web.UI.WebControls.Button ButtonCSV;
protected System.Web.UI.WebControls.Button ButtonReturn;
protected System.Web.UI.WebControls.Button ButtonSort;
protected String sql;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected DataSet Dt = new DataSet();
protected ArrayList arrayList = new ArrayList();
private void Page_Load(object sender, System.EventArgs e)
{
MakeGrid();
if(!Page.IsPostBack)
{
BindGridData();
DropDownListDataBind();
}
}
protected void BindGridData()