我的问题与ASP.NET中的网格视图有关 [英] My Question is related to grid view in ASP.NET

查看:74
本文介绍了我的问题与ASP.NET中的网格视图有关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  private   void  LoadDesignCourseQuizez()
{
string semester = Semester.Text.ToString();
string coursename = Course_Name.Text.ToString();
DataTable dt = new DataTable();
dt = IITBAL.FacultyCourses.GetDesignCourseQuizez(SessionId,coursename,semester);
int quizez = Convert.ToInt32(dt.Rows [ 0 ] [ Quizez]。ToString());
for int i = 1 ; i < = quizez; i ++)
{
TemplateField tf = new TemplateField();
tf.HeaderText = Q + i;
GridView1.DataSource = tf;
GridView1.DataBind();


}

}





我写了这段代码动态地创建带有标题文本和文本框的Gridview ......可能出现问题...任何解决方案????

解决方案

 gvReportingStockComp。 Columns [0] .HeaderText =第一列的新标题; 





这是从c#中添加网格视图标题的简单方法/ BLOCKQUOTE>

private void LoadDesignCourseQuizez()
    {
         string semester = Semester.Text.ToString();
        string coursename = Course_Name.Text.ToString();
        DataTable dt = new DataTable();
        dt = IITBAL.FacultyCourses.GetDesignCourseQuizez(SessionId,coursename,semester);
        int quizez = Convert.ToInt32(dt.Rows[0]["Quizez"].ToString());
        for (int i = 1; i <= quizez; i++)
        {
            TemplateField tf = new TemplateField();
            tf.HeaderText = "Q" + i;
            GridView1.DataSource = tf;
            GridView1.DataBind();
          

        }

    }



I have Write this code to create Gridview with header text and textboxes Dynamically ...By problem can occur...any solution ????

解决方案

gvReportingStockComp.Columns[0].HeaderText = "New Header for First Column";



this is simple way to add grid view header from c#


这篇关于我的问题与ASP.NET中的网格视图有关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆