<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div id="head_right_1" >
      欢迎您  <asp:Label ID="lab_name" runat="server" ForeColor="Red" ></asp:Label>  来到评教系统,请您对各科教师进行评分!
        &nbsp; &nbsp;<asp:Button ID="btn_back" runat="server" CssClass="btn"
            Text="退出重新登陆" OnClick="btn_back_Click" CausesValidation="False" />
            
            </div>
            <div id="head_right_2">
              
<asp:GridView id="dvt" runat="server" Width="790px" AutoGenerateColumns="False" 
OnRowEditing="dvt_RowEditing" BorderWidth="2px" CellPadding="3" CellSpacing="1" BorderStyle="Ridge"><Columns>
<asp:BoundField DataField="teaNum" HeaderText="教师编号"></asp:BoundField>
<asp:BoundField DataField="teaName" HeaderText="教师姓名"></asp:BoundField>
<asp:BoundField DataField="teaItem" HeaderText="所授课程"></asp:BoundField>
<asp:BoundField DataField="teaClass" HeaderText="所教班级"></asp:BoundField>
<asp:CommandField EditText="点击进行评教" ShowEditButton="True"></asp:CommandField>
</Columns>
</asp:GridView>    
            </div>
    
            
</asp:Content>
<asp:Content ID="Content3" runat="server" ContentPlaceHolderID="ContentPlaceHolder2">
    <uc1:stuLeft ID="StuLeft1" runat="server" />    </asp:Content>
教师编号教师姓名不显示 求解释

解决方案 »

  1.   

    你确定你的DataField所要查询的字段都正确
      

  2.   

    div id="head_right_1" 显示了 
    div id="head_right_2  不显示
      

  3.   

    在VS中也没有显示出来么?   
    不应该把。  把DIV去掉 然后看下。   
      

  4.   

    你是怎么绑定gridview的?是在cs页面中动态绑定的还是用了数据源控件绑定的?如果是在cs页面中动态绑定的,贴绑定的代码上来,看看是不是代码出问题了
      

  5.   

    public partial class stu_stupj : System.Web.UI.Page
    {
        Comsone com = new Comsone();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["stuNum"] != null)
            {
                if(!IsPostBack)
                {
                    databin();
                }
            }
            else
            {
                Response.Redirect("../index.aspx");
            }
        }
        protected void databin()
        {
            string stuNum = Request.QueryString["stuNum"].ToString();
            string sqlsel = "select * from stu where stuNum='" + stuNum + "'";
            DataTable dt = com.GetDataTable(sqlsel);
            lab_name.Text = dt.Rows[0]["stuName"].ToString();
            string str = dt.Rows[0]["stuClass"].ToString();
            string sqlsel1 = "select teaNum,teaName,teaItem,teaClass from tea,stu where teaNum in (select teaNum from flag where flag='0'and stuNum='" + stuNum + "') and stuClass='" + str + "'and stuNum='" + stuNum + "'";
            dvt.DataSource = com.GetDataTable(sqlsel1);        dvt.DataBind();    }    protected void btn_back_Click(object sender, EventArgs e)
        {
            Response.Redirect("../index.aspx");
        }
        protected void dvt_RowEditing(object sender, GridViewEditEventArgs e)
        {
            System.Threading.Thread.Sleep(3000);
            string teaNum = dvt.DataKeys[e.NewEditIndex].Value.ToString();
            Session["tea"] = teaNum;
            Response.Redirect("pjtea.aspx?teaNum=" + teaNum);
        }
    }
    后天代码