Ejemplo n.º 1
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";
            }
        }
    }
Ejemplo n.º 2
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";
            }
        }
    }