示例#1
0
 protected void btnDownloadTech_Click(object sender, EventArgs e)
 {
     try
     {
         Response.Clear();
         Response.AddHeader("content-disposition", "attachment;filename=Report.xls");
         Response.ContentType = "application/vnd.xls";
         System.IO.StringWriter       stringWrite = new System.IO.StringWriter();
         System.Web.UI.HtmlTextWriter htmlWrite   = new HtmlTextWriter(stringWrite);
         GvHM.RenderControl(htmlWrite);
         Response.Write(stringWrite.ToString());
         Response.End();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#2
0
    protected void btnShowTeacher_Click(object sender, EventArgs e)
    {
        try
        {
            string Sql = "SELECT Top(25) usrMobileNo,EntryDate,RegMale,RegFemale,Present_M,Present_F,ModifyDate FROM UDISE_TeacherPresenty" +
                         " UDISE_TeacherPresenty inner join UserMaster on UDISE_TeacherPresenty.usrUserId=UserMaster.usrUserId  where SchoolCode = " +
                         Convert.ToString(SchoolCode) + " order by TeacherID desc ";//'" + Convert.ToString(DateFormat) + "'";
            if (ddlMonthteacher.SelectedIndex != ddlMonthteacher.Items.Count - 1)
            {
                Sql = Sql + " and datePart(month,UDISE_TeacherPresenty.EntryDate)=" + ddlmonth.SelectedValue.ToString() + " ";
            }
            else if (txtDateTeacher.Text != "")
            {
                Sql = Sql + " and UDISE_TeacherPresenty.EntryDate='" + txtDateTeacher.Text + "'";
            }
            DataSet ds = cc.ExecuteDataset(Sql);

            gvTeacher.DataSource = ds.Tables[0];
            gvTeacher.DataBind();
            foreach (GridViewRow row in gvTeacher.Rows)
            {
                string Data = row.Cells[6].Text.ToString();
                Data = DateSplit(Data);
                row.Cells[6].Text = Data;
            }
            foreach (GridViewRow row in gvTeacher.Rows)
            {
                string Data = row.Cells[1].Text.ToString();
                Data = DateSplit(Data);
                row.Cells[1].Text = Data;
            }
            GvHM.DataSource = ds.Tables[0];
            GvHM.DataBind();
        }
        catch (Exception ex)
        { }
    }