da = new SqlDataAdapter("select * from tblleavemaster", cn);
ds.Reset();
da.Fill(ds, "tblleavemaster");
if (ds.Tables[0].Rows.Count > 0)
{
foreach (GridViewRow gr1 in gvclasslist.Rows)
{
foreach (DataTable myTable in ds.Tables)
{
foreach (DataRow myRow in myTable.Rows)
{
leavesid = Convert.ToInt32(myRow["studentid"].ToString());
DateTime fromdate = Convert.ToDateTime(myRow["fromdate"].ToString());
DateTime Todate = Convert.ToDateTime(myRow["todate"].ToString());
DateTime todaydate = DateTime.Now;
System.Web.UI.WebControls.Label lbl = new System.Web.UI.WebControls.Label();
lbl = (System.Web.UI.WebControls.Label)gr1.FindControl("Label1");
attendancesid = Convert.ToInt32(lbl.Text);
if (leavesid == attendancesid)
{
if (Todate <= todaydate)
{
gr1.Enabled = true;
}
else
{
gr1.Enabled = false;
}
}
}
}
Saturday, May 22, 2010
upload image and save binary format show image in picture box
if (fileuploadlogo.PostedFile.ContentLength == 0)
{
lblerrordesc.Visible = true;
lblerrordesc.Text = "Please Upload Photo !!!";
}
else
{
Stream imgStream = fileuploadlogo.PostedFile.InputStream;
int imgLen = fileuploadlogo.PostedFile.ContentLength;
string imgContentType = fileuploadlogo.PostedFile.ContentType;
byte[] imgBinaryData = new byte[imgLen];
int n = imgStream.Read(imgBinaryData, 0, imgLen);
photodata = imgBinaryData;
phototype = imgContentType;
Session["photodata"] = imgBinaryData;
Session["phototype"] = imgContentType;
Image3.ImageUrl = "studentphoto.aspx?type=" + imgContentType + "";
}
{
lblerrordesc.Visible = true;
lblerrordesc.Text = "Please Upload Photo !!!";
}
else
{
Stream imgStream = fileuploadlogo.PostedFile.InputStream;
int imgLen = fileuploadlogo.PostedFile.ContentLength;
string imgContentType = fileuploadlogo.PostedFile.ContentType;
byte[] imgBinaryData = new byte[imgLen];
int n = imgStream.Read(imgBinaryData, 0, imgLen);
photodata = imgBinaryData;
phototype = imgContentType;
Session["photodata"] = imgBinaryData;
Session["phototype"] = imgContentType;
Image3.ImageUrl = "studentphoto.aspx?type=" + imgContentType + "";
}
Subscribe to:
Posts (Atom)