示例#1
0
 //��ʼ�����Կ�Ŀ
 protected void InitDDLData()
 {
     Coursemr course = new Coursemr();       //�������Կ�Ŀ����
     DataSet ds = course.QueryCourse();  //��ѯ���Կ�Ŀ��Ϣ
     ddlCourse.DataSource = ds;          //ָ�����Կ�Ŀ�б������Դ
     ddlCourse.DataTextField = "Name";   //DataTextField��ʾName�ֶ�ֵ
     ddlCourse.DataValueField = "ID";    //DataValueField��ʾID�ֶ�ֵ
     ddlCourse.DataBind();               //������
 }
示例#2
0
 //ɾ�����Կ�Ŀ�¼�
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     Coursemr course = new Coursemr();           //����Coursemr����
     int ID = int.Parse(GridView1.DataKeys[e.RowIndex].Values[0].ToString()); //ȡ��Ҫɾ����¼������ֵ
     if (course.DeleteByStr(ID))
     {
         Response.Write("<script language=javascript>alert('�ɹ�ɾ�����Կ�Ŀ��')</script>");
     }
     else
     {
         Response.Write("<script language=javascript>alert('ɾ�����Կ�Ŀʧ�ܣ�')</script>");
     }
     GridView1.EditIndex = -1;
     InitData();
 }
示例#3
0
 //GridView�ؼ�RowUpdating�¼�
 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     int ID = int.Parse(GridView1.DataKeys[e.RowIndex].Values[0].ToString()); //ȡ��Ҫɾ����¼������ֵ
     Coursemr course = new Coursemr();           //����Coursemr����
     course.Name = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtName")).Text;
     if (course.UpdateByStr(ID))//ʹ��Usersmr��UpdateByProc�����޸��û���Ϣ
     {
         Response.Write("<script language=javascript>alert('�޸ijɹ�!')</script>");
     }
     else
     {
         Response.Write("<script language=javascript>alert('�޸�ʧ��!')</script>");
     }
     GridView1.EditIndex = -1;
     InitData();
 }
示例#4
0
    protected void imgBtnSave_Click(object sender, ImageClickEventArgs e)
    {
        if (Page.IsValid)
        {
            Coursemr course = new Coursemr();               //�������Կ�Ŀ����
            course.Name = txtName.Text;                 //���ÿ��Կ�Ŀ��������
            if (course.InsertByStr())                  //������ӿ��Կ�Ŀ������ӿ��Կ�Ŀ
            {
                lblMessage.Text = "�ɹ���Ӹÿ��Կ�Ŀ��";
                txtName.Text = "";

            }
            else
            {
                lblMessage.Text = "��Ӹÿ��Կ�Ŀʧ�ܣ�";
            }

        }
    }
示例#5
0
 //��ʼ�����Կ�Ŀ
 protected void PaperData()
 {
     //ʵ�������Կ�Ŀ����Coursemr
     Coursemr papercs = new Coursemr();
     //����Coursemr��������SqlQueryCourse()����ѯ���Կ�Ŀ��Ϣ�������ڴ���һ��DataSet����ds��
     DataSet ds = papercs.QueryCourse();
     //���ÿ��Կ�Ŀ�б�������Դ
     MyddlCourse.DataSource = ds;
     //DataTextField��ʾName�ֶ�ֵ
     MyddlCourse.DataTextField = "Name";
     //DataValueField��ʾID�ֶ�ֵ
     MyddlCourse.DataValueField = "ID";
     //������
     MyddlCourse.DataBind();
 }
示例#6
0
 //��ʼ�����Կ�Ŀ
 protected void InitData()
 {
     Coursemr course = new Coursemr();       //�������Կ�Ŀ����
     DataSet ds = course.QueryCourse();  //��ѯ���Կ�Ŀ��Ϣ
     GridView1.DataSource = ds;          //ΪGridView�ؼ���������Դ
     GridView1.DataBind();               //������
 }