using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.IO; using System.Net.Mail; using System.Net; using System.Web.UI.HtmlControls; public partial class school1_page : System.Web.UI.Page { string hostName; int idddd; SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["dbcon"].ConnectionString); protected void Page_Load(object sender, EventArgs e) { Uri myuri = new Uri(System.Web.HttpContext.Current.Request.Url.AbsoluteUri); string pathQuery = myuri.PathAndQuery; hostName = myuri.ToString().Replace(pathQuery, ""); if (hostName.StartsWith("www.", StringComparison.OrdinalIgnoreCase)) hostName = hostName.Replace("www.", string.Empty); Session["dom"] = hostName; string text = Request.Url.ToString(); string lastPart = text.Split('=').Last(); Session["pid"] = lastPart; GLRR(); Label1.Text = lastPart; tpr(); achenn(); getnews22(); getnews22RRR(); } private void tpr() { Label masterLabel = (Label)Master.FindControl("m5"); SqlCommand cmd = new SqlCommand("SELECT * FROM FACC where REM='TOPPERS' and sid='" + Session["sid"] + "' and session='" + Session["pid"] + "'", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { Label3.Text = masterLabel.Text; Repeater3.DataSource = dt; Repeater3.DataBind(); } else { Panel1.Visible = false; } } private void GLRR() { Label masterLabel3 = (Label)Master.FindControl("m6"); SqlCommand cmd = new SqlCommand("SELECT * FROM EIMGG where sid='" + Session["sid"] + "' and spg='" + Session["pid"] + "'", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { Label5.Text = masterLabel3.Text; Repeater5.DataSource = dt; Repeater5.DataBind(); } else { Panel3.Visible = false; } } private void achenn() { Label masterLabel1 = (Label)Master.FindControl("m4"); SqlCommand cmd = new SqlCommand("SELECT * FROM FACC where REM='ACHIEVMENT ' and sid='" + Session["sid"] + "' and session='" + Session["pid"] + "'", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { Label4.Text = masterLabel1.Text; Repeater4.DataSource = dt; Repeater4.DataBind(); } else { Panel2.Visible = false; } } protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { //Image img = (Image)e.Item.FindControl("p1"); //string imagePath = DataBinder.Eval(e.Item.DataItem, "p1").ToString(); //// Check if the image path is empty or null //if (img.ImageUrl == "~/uploads/noimage.jpg") //{ // img.Visible = false; //} } } private void getnews22RRR() { SqlCommand cmd = new SqlCommand("select * from epgs WHERE SPG='" + Session["PID"] + "' and sid='" + Session["sid"] + "'", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); DataRow dr; if (dt.Rows.Count > 0) { dr = dt.Rows[0]; string a = Convert.ToString(dr[0]); Label2.Text = Convert.ToString(dr["HD"]); Repeater2.DataSource = dt; Repeater2.DataBind(); } else { Panel4.Visible = false; } } private void getnews22() { SqlCommand cmd = new SqlCommand("select * from epggs WHERE sPG='" + Session["PID"] + "' and sid='" + Session["sid"] + "'", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { Repeater1.DataSource = dt; Repeater1.DataBind(); } else { Panel5.Visible = false; } } protected void Repeater2_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { // Get image control Image img = (Image)e.Item.FindControl("Image1"); // Get the data item DataRowView drv = (DataRowView)e.Item.DataItem; string imageUrl = drv["P1"].ToString(); // Check if image URL is empty/null/whitespace if (imageUrl == "~/uploads/noimage.jpg") { img.Visible = false; } } } }