麻烦再帮我看一下,cs页面里提到再次绑定,不知在哪里绑定,还有帮我看一下页面有其它什么错误没有,我初学,谢谢楼上两位了,再麻烦一下
!!
exceltest.aspx.cs页面:
protected void Page_Load(object sender, EventArgs e)
{
string strConn;
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=F:\\xinnet\\e\\User.xls;" + "Extended Properties=Excel 8.0;";
String sql = "SELECT *FROM [user$]";
OleDbDataAdapter da = new OleDbDataAdapter(sql,strConn);
DataSet myDataSet = new DataSet();
da.Fill(myDataSet);
DataGrid1.DataSource = myDataSet;
DataGrid1.DataBind();
}
protected void DataGrid1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
//this.DataGrid1.CurrentPageIndex = e.NewPageIndex;
this.DataGrid1.PageIndex = e.NewSelectedIndex;
dataShow();//
在去邦定一次数据 }
/////////////////////////////////////////////////////////////////////////////
exceltest.aspx页面:
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Label">EXCEL表单内容:</asp:Label><br />
<asp:GridView ID="DataGrid1" runat="server" AllowPaging="True" CellPadding="4" ForeColor="#333333" GridLines="None" OnSelectedIndexChanging="DataGrid1_SelectedIndexChanging">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</div>
</form>