protected void ddl_reduce_SelectedIndexChanged1(object sender, EventArgs e) { string u = ddl_reduce.SelectedItem.Value; class_list_tutors obj = new class_list_tutors(); 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]["tut_id"].ToString(); int o = obj.findleads(ds.Tables[0].Rows[i]["tut_id"].ToString()); if (o > 0) { grd_list_tutors.Rows[i].Cells[6].Text = "<a href='list_students.aspx?tut_id=" + ds.Tables[0].Rows[i]["tut_id"].ToString() + "'>" + o.ToString() + "</a>"; } else { grd_list_tutors.Rows[i].Cells[6].Text = "0"; } } }
private void databind1() { //try //{ class_list_tutors obj = new class_list_tutors(); string str1 = ""; if (Request.QueryString["Loc_id"] != null) { str1 = Request.QueryString["Loc_id"].ToString(); ds = obj.select_from_id(Convert.ToInt32(str1), "select_location_from_id"); 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]["tut_id"].ToString(); int o = obj.findleads(ds.Tables[0].Rows[i]["tut_id"].ToString()); if (o > 0) { grd_list_tutors.Rows[i].Cells[6].Text = "<a href='list_students.aspx?tut_id=" + ds.Tables[0].Rows[i]["tut_id"].ToString() + "'>" + o.ToString() + "</a>"; } else { grd_list_tutors.Rows[i].Cells[6].Text = "0"; } } } else if (Request.QueryString["sub_id"] != null) { str1 = Request.QueryString["sub_id"].ToString(); ds = obj.select_from_id(Convert.ToInt32(str1), "select_subject_from_id"); 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]["tut_id"].ToString(); int o = obj.findleads(ds.Tables[0].Rows[i]["tut_id"].ToString()); if (o > 0) { grd_list_tutors.Rows[i].Cells[6].Text = "<a href='list_students.aspx?tut_id=" + ds.Tables[0].Rows[i]["tut_id"].ToString() + "'>" + o.ToString() + "</a>"; } else { grd_list_tutors.Rows[i].Cells[6].Text = "0"; } } } else if (Request.QueryString["pac_id"] != null) { str1 = Request.QueryString["pac_id"].ToString(); ds = obj.select_from_id(Convert.ToInt32(str1), "select_package_from_id"); 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]["tut_id"].ToString(); int o = obj.findleads(ds.Tables[0].Rows[i]["tut_id"].ToString()); if (o > 0) { grd_list_tutors.Rows[i].Cells[6].Text = "<a href='list_students.aspx?tut_id=" + ds.Tables[0].Rows[i]["tut_id"].ToString() + "'>" + o.ToString() + "</a>"; } else { grd_list_tutors.Rows[i].Cells[6].Text = "0"; } } } else if (ddl_reduce.SelectedItem.Text == "Show Active" || ddl_reduce.SelectedItem.Text == "Show Inactive") { string u = ddl_reduce.SelectedItem.Value; 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]["tut_id"].ToString(); int o = obj.findleads(a); if (o > 0) { grd_list_tutors.Rows[i].Cells[6].Text = "<a href='list_students.aspx?tut_id=" + ds.Tables[0].Rows[i]["tut_id"].ToString() + "'>" + o.ToString() + "</a>"; } else { grd_list_tutors.Rows[i].Cells[6].Text = "0"; } } } else { ds = obj.showdata(); 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]["tut_id"].ToString(); int o = obj.findleads(ds.Tables[0].Rows[i]["tut_id"].ToString()); if (o > 0) { grd_list_tutors.Rows[i].Cells[6].Text = "<a href='list_students.aspx?tut_id=" + ds.Tables[0].Rows[i]["tut_id"].ToString() + "'>" + o.ToString() + "</a>"; } else { grd_list_tutors.Rows[i].Cells[6].Text = "0"; } } } //} //catch (Exception ex) //{ } }