解决方案 »

  1.   

    <asp:TemplateField HeaderText="用户编号" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <asp:HyperLink ID="hlkTitle" Text='<%# Bind("StaffNo") %>' runat="server"></asp:HyperLink>
                                    </ItemTemplate>
                                </asp:TemplateField>看看吧。不知道能不能解决你的问题
      

  2.   


    # Eval 是数据绑定控件用来从 ItemContainer 中取值的表达式,不是用来直接从页面变量里取值的。直接从变量里取值,只要声明<%# TID %>就行了。在你的代码中要注意调用 DataBind() 方法,例如protected string TID;protected void Page_Load(object sender, EventArgs e)
    {
        TID = Request.QueryString["TID"];
        this.Label1.DataBind();
    }
      

  3.   


    你贴的太多,反而误导了别人。你只要贴后一部分,说明“从 tiezi.aspx?TID=123456"这里进入的页面不知道如何绑定数据,就行了。不用贴前半部分。
      

  4.   

    嗯,Sorry,代码 this.Label1.DataBind(); 是错误的,因为 Label1 是在模板中定义的。应该改为
     
    protected void Page_Load(object sender, EventArgs e)
    {
        if(IsPostback)
            return;    string TID = Request.QueryString["TID"];
        this.FormView1.DataSource = 查询数据库(TID);
        this.FormView1.DataBind();   //如果你使用 ObjectDataSource控件之类的就使用 SelectParameter 中直接声明绑定 QueryString
    }
    关键是需要“绑定数据”给控件。
      

  5.   


    后台不用写什么吗
    后台肯定得把数据源绑定给Gridview
      

  6.   

    Gridview 除了要绑定name  还要绑定数据库表里数据所对应的编号
      

  7.   

    参考下面两个网址:
    http://www.cnblogs.com/insus/archive/2013/04/26/3045046.htmlhttp://www.cnblogs.com/insus/p/3227267.html