示例#1
0
    protected void row_deleting(object sender, GridViewDeleteEventArgs e)
    {
        int id = Convert.ToInt32((grd_list_tutors.DataKeys[e.RowIndex].Value));
        class_list_subjects cls2 = new class_list_subjects();

        int i = cls2.delete(id);

        if (i > 0)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record deleted successfully')", true);
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record not deleted successfully')", true);
        }
        databind1();
    }
示例#2
0
    protected void ddl_reduce_SelectedIndexChanged1(object sender, EventArgs e)
    {
        string u = ddl_reduce.SelectedItem.Value;
        class_list_subjects obj = new class_list_subjects();

        ds = obj.showdata1(u);
        if (ds.Tables[0].Rows.Count > 0)
        {
            grd_list_tutors.DataSource = ds;
            grd_list_tutors.DataBind();
            lbl_error.Visible = false;
        }
        else
        {
            grd_list_tutors.DataSource = null;
            grd_list_tutors.DataBind();
            lbl_error.Visible = true;
        }
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            string a = ds.Tables[0].Rows[i].ItemArray[0].ToString();
            int    o = obj.findtutors(ds.Tables[0].Rows[i].ItemArray[0].ToString());
            if (o > 0)
            {
                grd_list_tutors.Rows[i].Cells[3].Text = "<a href='list_tutors.aspx?sub_id=" + ds.Tables[0].Rows[i].ItemArray[0].ToString() + "'>" + o.ToString() + "</a>";
            }
            else
            {
                grd_list_tutors.Rows[i].Cells[3].Text = "0";
            }
        }
        for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
        {
            string a = ds.Tables[0].Rows[j].ItemArray[0].ToString();
            int    o = obj.findstudents(ds.Tables[0].Rows[j].ItemArray[0].ToString());
            if (o > 0)
            {
                grd_list_tutors.Rows[j].Cells[4].Text = "<a href='list_students.aspx?sub_id=" + ds.Tables[0].Rows[j].ItemArray[0].ToString() + "'>" + o.ToString() + "</a>";
            }
            else
            {
                grd_list_tutors.Rows[j].Cells[4].Text = "0";
            }
        }
    }
示例#3
0
    protected void btn_search_Click1(object sender, EventArgs e)
    {
        string search           = txt_search.Text;
        class_list_subjects obj = new class_list_subjects();

        ds1 = obj.filter(search);
        if (ds1.Tables[0].Rows.Count > 0)
        {
            grd_list_tutors.DataSource = ds1;
            grd_list_tutors.DataBind();
            lbl_error.Visible = false;
        }
        else
        {
            grd_list_tutors.DataSource = null;
            grd_list_tutors.DataBind();
            lbl_error.Visible = true;
        }
        for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
        {
            string a = ds1.Tables[0].Rows[i].ItemArray[0].ToString();
            int    o = obj.findtutors(ds1.Tables[0].Rows[i].ItemArray[0].ToString());
            if (o > 0)
            {
                grd_list_tutors.Rows[i].Cells[3].Text = "<a href='list_tutors.aspx?sub_id=" + ds1.Tables[0].Rows[i].ItemArray[0].ToString() + "'>" + o.ToString() + "</a>";
            }
            else
            {
                grd_list_tutors.Rows[i].Cells[3].Text = "0";
            }
        }
        for (int j = 0; j < ds1.Tables[0].Rows.Count; j++)
        {
            string a = ds1.Tables[0].Rows[j].ItemArray[0].ToString();
            int    o = obj.findstudents(ds1.Tables[0].Rows[j].ItemArray[0].ToString());
            if (o > 0)
            {
                grd_list_tutors.Rows[j].Cells[4].Text = "<a href='list_students.aspx?sub_id=" + ds1.Tables[0].Rows[j].ItemArray[0].ToString() + "'>" + o.ToString() + "</a>";
            }
            else
            {
                grd_list_tutors.Rows[j].Cells[4].Text = "0";
            }
        }
    }
示例#4
0
    protected void row_updating(object sender, GridViewUpdateEventArgs e)
    {
        int         id  = Convert.ToInt32((grd_list_tutors.DataKeys[e.RowIndex].Value));
        GridViewRow row = (GridViewRow)grd_list_tutors.Rows[e.RowIndex];

        TextBox t1 = (TextBox)row.FindControl("txt_name");

        RadioButtonList     t5  = (RadioButtonList)row.FindControl("rbl_status");
        class_list_subjects cls = new class_list_subjects();

        int i = cls.update(t1.Text, t5.SelectedItem.Text.ToString(), id);

        if (i > 0)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record updated successfully')", true);
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record not updated successfully')", true);
        }
        grd_list_tutors.EditIndex = -1;

        databind1();
    }