• λ我爱Aspx >> Asp.Net >> 求助:DataGrid加行号的问题
  • 求助:DataGrid加行号的问题

  • :aspxer  Դ:csdn  :2007-7-6 2:50:12  ؼ:
  • 我的数据是fname,lname

    google_ad_width = 250; google_ad_height = 250; google_ad_format = "250x250_as"; google_color_url = "000000";

    private void Page_Load(object sender, System.EventArgs e)

    {

    if(!IsPostBack)

    {

    myConnection=new SqlConnection("server=127.0.0.1;uid=sa;pwd=sa;database=qqq;");

    strSQL="SELECT fname AS [First Name], lname AS [Last Name FROM Employee";

    myCommand=new SqlDataAdapter(strSQL,myConnection);

    myCommand.Fill(ds,"Employee");

    ds.Tables[0].Columns.Add("No");

    DataGrid1.DataSource=ds.Tables["Employee"].DataSet;

    for (int i=0;i<ds.Tables[0].Rows.Count;i++)

    {

    ds.Tables[0].Rows[i]["No"]=i+1;

    }

    DataGrid1.DataBind();

    }

    }但是显示时候结构是No,First Name,Last Name,No,最后这个No怎么去掉,请指导下,谢谢!

    第2楼. 由 KidAn 于 2007-7-1 18:07:05 发表

    加个模版列

    <asp:TemplateField>

    <ItemTemplate>

    <%# Container.DataItemIndex+1%>

    </ItemTemplate>

    </asp:TemplateField>

    第3楼. 由 yb130225 于 2007-7-1 18:45:02 发表

    谢了

    Ҷƪл˵?
  • һƪ想问一下王长上的一些效果都是怎么实现的
    һƪ有什么方法可以一次性的撤销所有的对Text的修改操作?