当前位置: 首页>>代码示例>>C#>>正文


C# DataGrid.DataBind方法代码示例

本文整理汇总了C#中DataGrid.DataBind方法的典型用法代码示例。如果您正苦于以下问题:C# DataGrid.DataBind方法的具体用法?C# DataGrid.DataBind怎么用?C# DataGrid.DataBind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataGrid的用法示例。


在下文中一共展示了DataGrid.DataBind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DataGridBindData

 public static void DataGridBindData(DataGrid g, DataTable dt)
 {
     g.DataSource = dt;
     try
     {
         g.DataBind();
     }
     catch
     {
         g.CurrentPageIndex = 0;
         g.DataBind();
     }
 }
开发者ID:NoobSkie,项目名称:taobao-shop-helper,代码行数:13,代码来源:PageHelper.cs

示例2: ExportDataSetToExcel

    public static void ExportDataSetToExcel(DataSet ds, string filename)
    {
        try
        {
            HttpResponse response = HttpContext.Current.Response;

            // first let's clean up the response.object
            response.Clear();
            response.Charset = "";

            // set the response mime type for excel
            response.ContentType = "application/vnd.ms-excel";
            response.AddHeader("Content-Disposition", "attachment;filename=\"" + filename + "\"");

            // create a string writer
            using (StringWriter sw = new StringWriter())
            {
                using (HtmlTextWriter htw = new HtmlTextWriter(sw))
                {
                    // instantiate a datagrid
                    DataGrid dg = new DataGrid();
                    dg.Font.Size = 9;
                    dg.DataSource = ds.Tables[0];
                    dg.DataBind();
                    dg.RenderControl(htw);
                    response.Write(sw.ToString());
                    response.End();
                }
            }
        }
        catch (Exception)
        {
            throw;
        }
    }
开发者ID:frdharish,项目名称:WhitfieldAPPs,代码行数:35,代码来源:master_materials.aspx.cs

示例3: binddatagrid

    //=================================================
    //功能描述:对DATAGRIG进行数据绑定,无排序
    //输入参数:sql,查询的SQL语句;dg,需要绑定的DATAGRID控件
    //返回值:无
    //时间:2013.08.20
    //=================================================
    public static void binddatagrid(string sql, DataGrid dg)
    {
        DataSet ds = getdataset(sql);
            dg.DataSource = ds.Tables[0].DefaultView;

        closeConnection();
            dg.DataBind();
    }
开发者ID:uwitec,项目名称:baihuibaihui,代码行数:14,代码来源:DB.cs

示例4: Operation

    Operation operation = new Operation(); //业务类对象

    #endregion Fields

    #region Methods

    public void ExportResult(DataSet ds, string excelName)
    {
        HttpContext.Current.Response.Clear();
        HttpContext.Current.Response.Charset = "";
        HttpContext.Current.Response.ContentType = "application/vnd.ms-xls";
        StringWriter stringWrite = new StringWriter();
        HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);

        DataGrid dg = new DataGrid();
        dg.DataSource = ds;
        dg.DataBind();
        dg.RenderControl(htmlWrite);
        HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(excelName));
        HttpContext.Current.Response.Write(stringWrite.ToString());
        HttpContext.Current.Response.End();
    }
开发者ID:sysukww,项目名称:pdms,代码行数:22,代码来源:manageLog.aspx.cs

示例5: ExportarDataTableToExcel3

    public void ExportarDataTableToExcel3(DataTable dt)
    {
        if (dt.Rows.Count > 0)
        {
            string filename = "ReporteBasedatos.xls";
            System.IO.StringWriter tw = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);

            DataGrid dgGrid = new DataGrid();
            dgGrid.DataSource = dt;
            dgGrid.DataBind();

            dgGrid.RenderControl(hw);
            Response.ContentType = "application/vnd.ms-excel";
            Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename + "");
            Response.Charset = "";
            Response.Write(tw.ToString());
            Response.End();
        }
    }
开发者ID:jquirogadesarrollador,项目名称:Varu_Original,代码行数:20,代码来源:baseDatos.aspx.cs

示例6: exportToExcel

    public void exportToExcel(DataTable dt)
    {
        if(dt.Rows.Count>0)
        {
            string filename = "StudentRecord.xls";
            StringWriter tw = new StringWriter();

            System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
            DataGrid dgGrid = new DataGrid();
            dgGrid.DataSource = dt;
            dgGrid.DataBind();

            dgGrid.RenderControl(hw);
            Response.ContentType = "application/vnd.ms-excel";
            Response.AppendHeader("Content-Disposition", "attachment; filename = " + filename + "");
            this.EnableViewState = false;
            Response.Write(tw.ToString());
            Response.End();

        }
    }
开发者ID:rawatadit,项目名称:PlacementPortal,代码行数:21,代码来源:filter-students.aspx.cs

示例7: GetListadoUsuarios

    public void GetListadoUsuarios()
    {
        UsuarioBLL usuariosbll = new UsuarioBLL();

        Response.Clear();
        Response.AddHeader("content-disposition", "attachment;filename=" + "ListadoUsuariosINCI_" + DateTime.Now.ToString() + "_.xls");
        Response.ContentType = "application/vnd.ms-excel";

        StringWriter stringWriter = new StringWriter();
        HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWriter);
        DataGrid dataExportExcel = new DataGrid();
        dataExportExcel.ItemDataBound += new DataGridItemEventHandler(dataExportExcel_ItemDataBound);
        dataExportExcel.DataSource = usuariosbll.SelectAllExcel();
        dataExportExcel.DataBind();
        dataExportExcel.RenderControl(htmlWrite);
        StringBuilder sbResponseString = new StringBuilder();
        sbResponseString.Append("<html xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\"> <head><meta http-equiv=\"Content-Language\" content=\"es\"><meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\"><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>" + "ListadoUsuariosINCI" + "</x:Name><x:WorksheetOptions><x:Panes></x:Panes></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head> <body>");
        sbResponseString.Append(stringWriter + "</body></html>");
        Response.Write(sbResponseString.ToString());
        Response.End();
    }
开发者ID:EasyDenken,项目名称:GrupoINCI,代码行数:21,代码来源:Inmobiliarias.master.cs

示例8: PopulateDataGrid

    public void PopulateDataGrid(DataSet dsGridResults, DataGrid grdpl1)
    {
        Int32 resultCount = 0;
        if (dsGridResults.Tables.Count > 0)
            resultCount = dsGridResults.Tables[0].Rows.Count;
        Int32 maxResultItemInPage = 0;
        Int32 minResultItemInPage = 0;
        try
        {
            if (resultCount > 0)
            {

                DataTable tblInstallments = dsGridResults.Tables[0];
                //Display results in Grid
                if (resultCount > (grdpl1.CurrentPageIndex + 1) * grdpl1.PageSize)
                    maxResultItemInPage = (grdpl1.CurrentPageIndex + 1) * grdpl1.PageSize;

                else
                    maxResultItemInPage = resultCount;
                if (maxResultItemInPage - (grdpl1.PageSize - 1) > 1)
                    minResultItemInPage = maxResultItemInPage - (grdpl1.PageSize - 1);
                else
                    minResultItemInPage = 1;
                grdpl1.Visible = true;
                grdpl1.DataSource = tblInstallments;
                grdpl1.DataBind();
            }
            else
            {
                grdpl1.Visible = false;
            }
        }
        catch (Exception exp)
        {

            Response.Write(exp.Message.ToString());
        }
    }
开发者ID:frdharish,项目名称:WhitfieldAPPs,代码行数:38,代码来源:Whitfield_Payroll_ByProject.ascx.cs

示例9: DataTable2Excel

    /// <summary>
    /// 导出Excel文件,转换为可读模式
    /// </summary>
    public static void DataTable2Excel(System.Data.DataTable dtData)
    {
        DataGrid dgExport = null;
        HttpContext curContext = HttpContext.Current;
        StringWriter strWriter = null;
        HtmlTextWriter htmlWriter = null;

        if (dtData != null)
        {
            curContext.Response.ContentType = "application/vnd.ms-excel";
            curContext.Response.ContentEncoding = System.Text.Encoding.UTF8;
            curContext.Response.Charset = "";
            strWriter = new StringWriter();
            htmlWriter = new HtmlTextWriter(strWriter);
            dgExport = new DataGrid();
            dgExport.DataSource = dtData.DefaultView;
            dgExport.AllowPaging = false;
            dgExport.DataBind();
            dgExport.RenderControl(htmlWriter);
            curContext.Response.Write(strWriter.ToString());
            curContext.Response.End();
        }
    }
开发者ID:RushHang,项目名称:H_DataAssembly,代码行数:26,代码来源:ExcelHelper.cs

示例10: GerarExcel

    private void GerarExcel(string pDataIni, string pDataFim)
    {
        //Conteúdo do Response
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("Windows-1252");
        Response.AddHeader("content-disposition", "attachment; filename=DocumentoExcel.xls");
        Response.Charset = "UTF-8";
        Response.ContentType = "application/vnd.xls";

        //Objetos
        StringWriter stringWrite = new StringWriter();
        HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);

        //Inclui controles
        DataGrid dgDados = new DataGrid();
        this.form1.Controls.Add(dgDados);

        //Definição de cores
        //dgRecord.HeaderStyle.BackColor = System.Drawing.Color.Yellow;
        dgDados.DataSource = AcompanharDo.GetConsultaResumidaNuplan(LocalInstance.ConnectionInfo, pDataIni, pDataFim, Session["_SessionPESF_ID"].ToString());
        dgDados.DataBind();

        //definição das cores das células
        //foreach (DataGridItem dgi in dgRecord.Items)
        //   foreach (TableCell tcGridCells in dgi.Cells)
        //      tcGridCells.Attributes.Add("class", "sborder");

        //Renderiza o DataGrid
        dgDados.RenderControl(htmlWrite);

        //Inluir a classe de estilo
        //Response.Write(@"<style> .sborder { color : Red;border : 1px Solid Balck; } </style> ");
        //Exporta
        Response.Write(stringWrite.ToString());
        //encerra
        Response.End();
    }
开发者ID:andreibaptista,项目名称:DEF_PUB_DEFNET_PORTAL,代码行数:36,代码来源:RelatorioNuplan.aspx.cs

示例11: ExportToExcel

    private void ExportToExcel(DataTable dt, string fileName, string worksheetName)
    {
        Response.Clear();
        //Response.AddHeader("content-disposition", "attachment;filename=" + fileName + ".xls");
        //Response.ContentType = "application/vnd.ms-excel";

        Response.AddHeader("content-disposition", "attachment;filename=" + fileName + ".xls");
        Response.ContentType = "application/vnd.ms-excel";

        StringWriter stringWriter = new StringWriter();
        HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWriter);
        DataGrid dataExportExcel = new DataGrid();
        dataExportExcel.ItemDataBound += new DataGridItemEventHandler(dataExportExcel_ItemDataBound);
        dataExportExcel.DataSource = dt;
        dataExportExcel.DataBind();
        dataExportExcel.RenderControl(htmlWrite);
        StringBuilder sbResponseString = new StringBuilder();
        sbResponseString.Append("<html xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\"> <head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=windows-1252\"><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>" + worksheetName + "</x:Name><x:WorksheetOptions><x:Panes></x:Panes></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head> <body>");
        sbResponseString.Append(stringWriter + "</body></html>");
        Response.Write(sbResponseString.ToString());
        Response.End();
    }
开发者ID:jescudero,项目名称:MiamiAndMiami,代码行数:22,代码来源:Hotels.aspx.cs

示例12: ExportToSpreadsheet

    public static void ExportToSpreadsheet(DataTable table, string reportOIDStr, String reportType)
    {
        try
        {
            Reports report = null;
            if (!string.IsNullOrEmpty(reportOIDStr))
            {
                report = new Reports().GetReportByOID(Int32.Parse(reportOIDStr));
            }
            if ((report == null) || (table == null))
            {
                return;
            }
            else
            {
                String gridColumnsStr = Convert.ToString(report.GridColumns);
                String[] gridColumns = gridColumnsStr.Split('&');

                foreach (String gridColumn in gridColumns)
                {
                    String[] nameValue = gridColumn.Split('=');
                    if (nameValue[1] == "true")
                    {
                        try
                        {
                            table.Columns.Remove(nameValue[0]);
                        }
                        catch
                        { }
                    }
                }
            }

            if (reportType == "CSV")
            {
                //Remove Comma from Text
                string tempStr = "";
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    for (int j = 0; j < table.Columns.Count; j++)
                    {
                        tempStr = Convert.ToString(table.Rows[i][j]);
                        if (tempStr.Contains(','))
                        {
                            table.Rows[i][j] = tempStr.Replace(',', ' ');
                        }
                    }
                }

                HttpContext context = HttpContext.Current;
                context.Response.Clear();
                context.Response.ContentType = "text/csv";
                context.Response.AddHeader("Content-Disposition", "attachment; filename=" + report.ReportName +"_"+DateTime .Now .ToShortDateString ()+ ".csv");

                //Write a row for column names
                foreach (DataColumn dataColumn in table.Columns)
                context.Response.Write(dataColumn.ColumnName + ",");
                context.Response.Write(Environment.NewLine);

                //Write one row for each DataRow
                foreach (DataRow dataRow in table.Rows)
                {
                    for (int dataColumnCount = 0; dataColumnCount < table.Columns.Count; dataColumnCount++)
                        context.Response.Write(dataRow[dataColumnCount].ToString() + ",");
                    context.Response.Write(Environment.NewLine);
                }
                context.Response.End();
            }
            else if (reportType == "Excel")
            {
                DataGrid dtaFinal = new DataGrid();
                dtaFinal.DataSource = table;
                dtaFinal.DataBind();

                dtaFinal.HeaderStyle.ForeColor = System.Drawing.Color.White;
                dtaFinal.HeaderStyle.BackColor = System.Drawing.Color.DarkGray;
                dtaFinal.ItemStyle.BackColor = System.Drawing.Color.White;
                dtaFinal.AlternatingItemStyle.BackColor = System.Drawing.Color.AliceBlue;

                StringWriter sw = new StringWriter();
                HtmlTextWriter hw = new HtmlTextWriter(sw);
                dtaFinal.RenderControl(hw);

                HttpContext context = HttpContext.Current;
                context.Response.Buffer = true;
                context.Response.Clear();

                context.Response.ContentType = "application/ms-excel";
                context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + report.ReportName + ".xls");

                context.Response.Write(sw.ToString());
                context.Response.Flush();
                context.Response.Close();
                context.Response.End();
            }
            else if (reportType == "PDF")
            {
                HttpResponse Response = HttpContext.Current.Response;
                Response.Clear();
                Response.ContentType = "application/octet-stream";
//.........这里部分代码省略.........
开发者ID:mominbd,项目名称:testing,代码行数:101,代码来源:ExportToExcel.cs

示例13: ExportDialog

    public static void ExportDialog(string One, string two, string three, DataSet ds, Page page)
    {
        string title = DateTime.Now.ToString("yyMMdd") + three + ".xls";
        System.Web.UI.WebControls.DataGrid DataGrid1 = new DataGrid();
        HttpResponse response = HttpContext.Current.Response;

        DataGrid1.DataSource = ds;
        DataGrid1.DataBind();

        StringWriter tw = new StringWriter();
        HtmlTextWriter myWrite = new HtmlTextWriter(tw);

        if (One != "")
            myWrite.WriteLine(One);
        if (two != "")
            myWrite.WriteLine(two);

        DataGrid1.RenderControl(myWrite);

        response.Clear();
        response.Buffer = true;
        response.Charset = "GB2312";
        response.Write("<meta http-equiv=Content-Type content=text/html;charset=GB2312>");
        response.AppendHeader("Content-Disposition", "attachment;filename=" + title);
        response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
        response.ContentType = "application/vnd.xls";//Response.ContentType= "application/msword";

        page.EnableViewState = false;

        response.Write(tw.ToString());
        response.End();
    }
开发者ID:loozhang,项目名称:51aspx_YiMengWeb,代码行数:32,代码来源:Communal.cs

示例14: setDataSource

        public static void setDataSource(DataGrid oGrd, DataView oDv, string sSortExpression, int iCurPage)
        {
            string sFullLeft = "";
            string sFullRight = "";
            string sFullSortExp = "";
            string sHeader = "";
            int iIndx;
            string sAscImage = "<img src=App_Themes/mcm/images/grid_sort_asc.gif border=0>";
            string sDescImage = "<img src=App_Themes/mcm/images/grid_sort_desc.gif border=0>";

            if (sSortExpression != "")
            {
                foreach (DataGridColumn oCol in oGrd.Columns)
                {
                    sHeader = oCol.HeaderText;
                    iIndx = sHeader.IndexOf("<img");

                    if (oCol.SortExpression != "")
                    {
                        if (oCol.SortExpression.Replace(" DESC", "") == sSortExpression.Replace(" DESC", ""))
                        {
                            if (sSortExpression.EndsWith(" DESC"))
                            {
                                if (iIndx >= 0)
                                    sHeader = sHeader.Replace(sDescImage, sAscImage);
                                else
                                    sHeader = sHeader + sAscImage;
                                sFullLeft += "," + sSortExpression.Replace(" DESC", "");
                                oCol.SortExpression = sSortExpression.Replace(" DESC", "");
                            }
                            else
                            {
                                if (iIndx >= 0)
                                    sHeader = sHeader.Replace(sAscImage, sDescImage);
                                else
                                    sHeader = sHeader + sDescImage;
                                sFullLeft += "," + sSortExpression + " DESC";
                                oCol.SortExpression = sSortExpression + " DESC";
                            }
                        }
                        else
                        {
                            if (iIndx >= 0)
                                sHeader = sHeader.Substring(0, iIndx);
                            sFullRight += "," + oCol.SortExpression;
                        }
                    }
                    oCol.HeaderText = sHeader;
                }
                sFullSortExp = sFullLeft + sFullRight;
                if (sFullSortExp.StartsWith(",")) sFullSortExp = sFullSortExp.Substring(1);
                oDv.Sort = sFullSortExp;

            }
            //if (flag)
            oGrd.Attributes["CurrentSortExpression"] = sFullSortExp;

            // Handle paging
            // paging error incase current page set is out of bounds.
            //	if so reset to last page
            int iTimes = 0;
            while (iTimes++ < 2)
            {
                try
                {
                    if (iCurPage < 0) iCurPage = oGrd.CurrentPageIndex;

                    if (iCurPage >= 0 && iCurPage < oGrd.PageCount)
                        oGrd.CurrentPageIndex = iCurPage;
                    else if (oGrd.PageCount > 0 && iCurPage >= oGrd.PageCount)
                        oGrd.CurrentPageIndex = oGrd.PageCount - 1;
                    else	// for safety
                        oGrd.CurrentPageIndex = 0;

                    oGrd.DataSource = oDv;
                    oGrd.DataBind();
                    break;
                }
                catch (HttpException oEx)
                {
                    iCurPage = oGrd.CurrentPageIndex;
                    continue;
                }
            }
        }	
开发者ID:shukla2009,项目名称:Personal,代码行数:85,代码来源:BasePage.cs

示例15: sendEmail

    public void sendEmail()
    {
        Whitfieldcore wCore = new Whitfieldcore();
        whitfield_reports _wRep = new whitfield_reports();
        MailMessage message = new MailMessage();

        message.To.Add(System.Configuration.ConfigurationManager.AppSettings["devEmail"]);

        //Here is where we add the receipients.
        using (DataSet ds = wCore.GetRightDistributionList(Convert.ToInt32(ViewState["twc_project_number"].ToString())) )  //HHS Uncomment this portion when there is an email list.
        {
            DataTable dtUsr = ds.Tables[0];
            if (dtUsr.Rows.Count > 0)
            {
                foreach (DataRow dRow in dtUsr.Rows)
                {
                    string _email = dRow["Email"] == DBNull.Value ? "" : dRow["Email"].ToString();
                    message.To.Add(_email);
                }
            }
        }

        message.To.Add(System.Configuration.ConfigurationManager.AppSettings["AdminEmail"].ToString());
        //This is commented by Harish on Friday, January 27th with the request of Jammie.
        //message.To.Add(System.Configuration.ConfigurationManager.AppSettings["PMEmail"].ToString());

        message.From = new MailAddress(System.Configuration.ConfigurationManager.AppSettings["DFR_fromEmail"]);
        message.Subject = txtReportDate.Text.Trim() + "  Daily Field Report:" + lblPrjHeader.Text.Trim();
        message.IsBodyHtml = true;

        StringBuilder sb = new StringBuilder();
        sb.Append("<html><head></head>");
        sb.Append("<body>");
        //Header
        sb.Append("<TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'><TR>");
        sb.Append("<TD><IMG height='80' alt='' src='http://www.whitfield-co.com/whitfield-co/assets/img/TWC%20Primary%20Logo1.JPG' border='0'></TD>");
        sb.Append("<TD class='form1' vAlign='bottom' align='right' width='100%'><b>The Whitfield Corporation, Inc.,<br>");
        sb.Append("P.O. Box 0385<br>");
        sb.Append("Fulton, MD 20759<br>");
        sb.Append("(301)-483-0791<br>");
        sb.Append("(301)-483-0792</b><br>");
        sb.Append("<IMG height='9' alt='' src='http://www.whitfield-co.com/whitfield-co/assets/img/images.gif' width='1'>");
        sb.Append("</TD>");
        sb.Append("</TR></TABLE>");

        //EmployeeHours
        System.Drawing.ColorConverter colConvert = new ColorConverter();
        DataGrid dgWorkOrders = new DataGrid();
        dgWorkOrders.Font.Size = 9;
        dgWorkOrders.CssClass = "data";

        dgWorkOrders.HeaderStyle.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("#60829F");
        dgWorkOrders.HeaderStyle.CssClass = "subnav";
        dgWorkOrders.HeaderStyle.Font.Bold = true;
        dgWorkOrders.ItemStyle.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("#EAEFF3");
        dgWorkOrders.FooterStyle.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("#D9D9D9");

        dgWorkOrders.DataSource = _wRep.GetReportActivityForProjectMail(_wRep.GetReportNumber(Convert.ToInt32(ViewState["twc_project_number"].ToString()), txtReportDate.Text.Trim()), Convert.ToInt32(ViewState["twc_project_number"].ToString()));
        dgWorkOrders.DataBind();

        StringBuilder SBEmployeeHours = new StringBuilder();
        StringWriter SWEmployeeHours = new StringWriter(SBEmployeeHours);
        HtmlTextWriter htmlTWEmployeeHours = new HtmlTextWriter(SWEmployeeHours);
        dgWorkOrders.RenderControl(htmlTWEmployeeHours);
        string EmployeeHoursString = SBEmployeeHours.ToString();
        sb.Append("<br><B>Work Executed for Today:</b><br>" + EmployeeHoursString);

        //Daily Work Performed Notes/Comments
        String StrRptNotes = "";

        if (txtRptNotes.Text == "")
        {
            StrRptNotes = "None.";
        }
        else
        {
            StrRptNotes = txtRptNotes.Text.Trim();
        }
        sb.Append("<TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'><TR>");
        sb.Append("<TD>");
        sb.Append("<br><b>Daily Work Performed Notes/Comments:</b>" + StrRptNotes + "<br>");
        sb.Append("</TD>");
        sb.Append("</TR></TABLE>");

        //Significant Issues/Impediments Notes/Comments:
        String StrRptIssues = "";

        if (txtRptIssues.Text == "")
        {
            StrRptIssues = "None.";
        }
        else
        {
            StrRptIssues = txtRptIssues.Text.Trim();
        }

        sb.Append("<TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'><TR>");
        sb.Append("<TD>");
        sb.Append("<br><b>Significant Issues/Impediments Notes/Comments:</b>" + StrRptIssues + "<br>");
        sb.Append("</TD>");
//.........这里部分代码省略.........
开发者ID:frdharish,项目名称:WhitfieldAPPs,代码行数:101,代码来源:Whitfield_projectInfo.aspx.cs


注:本文中的DataGrid.DataBind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。