protected void BindGridview() { /* * SqlConnection con = new SqlConnection("Data Source=SureshDasari;Integrated Security=true;Initial Catalog=MySampleDB"); * con.Open(); * SqlCommand cmd = new SqlCommand("select * from UserDetails", con); * * SqlDataAdapter da = new SqlDataAdapter(cmd); * con.Close(); * DataSet ds = new DataSet(); * da.Fill(ds); * gvHistory.DataSource = ds; * gvHistory.DataBind(); */ try { if (UDIRSHelper.PersonDetails != null) { oDV = AdoUDIRS.GET_IncidentsForPerson(UDIRSHelper.PersonDetails.Id.ToString()); } else { //redirect to logon page } if (AdoUDIRS.BlnError) { //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError; return; } else if (oDV.Count == 0) { //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError; lblMsg.Text = "No Incident Reported."; lblMsg.Attributes.Add("style", "font-size:40px; color:Red; font-weight:bold;"); return; } else if (oDV.Count > 0) { gvHistory.DataSource = oDV; gvHistory.DataBind(); } } catch (Exception ex) { //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError; } }