show your .cs and .aspx file

解决方案 »

  1.   

    我已解决:
    1、看看在生成与浏览中是否能显示web组件,若不能则执行:aspnet_regiis _i
    2、在Page_load的事件中加入
         oleDbDataAdapter1.Fill(dataSet11);
         DataGrid1.DataBind();
      

  2.   

    code:  form1.aspxusing 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;namespace WebApplication1
    {
    /// <summary>
    /// WebForm1 的摘要说明。
    /// </summary>
    public class WebForm1 : System.Web.UI.Page
    {
    protected WebApplication1.DataSet1 dataSet11;
    protected System.Web.UI.WebControls.DataGrid DataGrid1;

    // Add the following line:
    protected Component1 myComponent = new Component1(); private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    // Add the following code:
    if (! IsPostBack)
    {
    myComponent.FillDataSet(dataSet11);
    DataGrid1.DataBind();      // Add this line }
    // End of the new code. } #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
    this.dataSet11 = new WebApplication1.DataSet1();
    ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
    // 
    // dataSet11
    // 
    this.dataSet11.DataSetName = "DataSet1";
    this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
    this.dataSet11.Namespace = "http://www.tempuri.org/DataSet1.xsd";
    this.Load += new System.EventHandler(this.Page_Load);
    ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit(); }
    #endregion
    }
    }
      

  3.   

    形成的html:<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm1" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <title>WebForm1</title>
    <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <FONT face="宋体">
    <asp:DataGrid id=DataGrid1 style="Z-INDEX: 101; LEFT: 81px; POSITION: absolute; TOP: 37px" runat="server" Width="304px" Height="181px" DataSource="<%# dataSet11 %>" DataKeyField="title_id" AllowSorting="True" ShowFooter="True" AutoGenerateColumns="False">
    <Columns>
    <asp:BoundColumn DataField="title_id" SortExpression="title_id" HeaderText="序号"></asp:BoundColumn>
    <asp:BoundColumn DataField="price" SortExpression="title_id" HeaderText="价格" DataFormatString="{0:C}"></asp:BoundColumn>
    </Columns>
    </asp:DataGrid></FONT>
    </form>
    </body>
    </HTML>
      

  4.   

    .csusing System;
    using System.ComponentModel;
    using System.Collections;
    using System.Diagnostics;namespace WebApplication1
    {
    /// <summary>
    /// Component1 的摘要说明。
    /// </summary>
    public class Component1 : System.ComponentModel.Component
    {
    private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
    private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
    private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
    private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
    private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
    private System.Data.SqlClient.SqlConnection sqlConnection1;
    private WebApplication1.DataSet1 dataSet11;
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null;

    // Add the following code:
    public void FillDataSet(DataSet1 dSet)
    {
    sqlDataAdapter1.Fill(dSet);
    }
    // End of the new code. public Component1(System.ComponentModel.IContainer container)
    {
    /// <summary>
    /// Windows.Forms 类撰写设计器支持所必需的
    /// </summary>
    container.Add(this);
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } public Component1()
    {
    /// <summary>
    /// Windows.Forms 类撰写设计器支持所必需的
    /// </summary>
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } #region Component Designer generated code
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
    this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
    this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
    this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
    this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
    this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
    this.dataSet11 = new WebApplication1.DataSet1();
    ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
    // 
    // sqlDataAdapter1
    // 
    this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
    this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
    this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
    this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
      new System.Data.Common.DataTableMapping("Table", "titles", new System.Data.Common.DataColumnMapping[] {
    new System.Data.Common.DataColumnMapping("title_id", "title_id"),
    new System.Data.Common.DataColumnMapping("title", "title"),
    new System.Data.Common.DataColumnMapping("price", "price"),
    new System.Data.Common.DataColumnMapping("notes", "notes"),
      

  5.   

    是不是IIS有问题?
    你在IE看看页面的源代码,看看有没有<asp:...>这些代码,如果有的话,那更新IIS先:
    aspnet_regiis -i
      

  6.   

    老兄
       你的.net SDK框架没有安装正确。请找到第5张光盘。找到其中的dotnetfx.exe
    在开始-〉运行中输入下列命令进行修复:
      <第5张所在CD>:\dotNetFramework\DOTNETFX.EXE /t:c:\temp /c:"msiexec.exe /fvecms c:\temp\netfx.msi"