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


C# BoundField类代码示例

本文整理汇总了C#中BoundField的典型用法代码示例。如果您正苦于以下问题:C# BoundField类的具体用法?C# BoundField怎么用?C# BoundField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: BindGrid

 private void BindGrid()
 {
     SqlCommand cmd = new SqlCommand("select * from tblUser", con);
     SqlDataAdapter da = new SqlDataAdapter(cmd);
     DataTable dt = new DataTable();
     da.Fill(dt);
     if (dt.Rows.Count > 0)
     {
         for (int i = 0; i < dt.Columns.Count; i++)
         {
             if (i == 0)
             {
                 HyperLinkField b = new HyperLinkField();
                 b.HeaderText = dt.Columns[i].ColumnName;
                 b.DataTextField = dt.Columns[i].ColumnName;
                 b.DataNavigateUrlFormatString = "Default.aspx?Id={0}";
                 b.DataNavigateUrlFields = new string[] { dt.Columns[i].ColumnName };
                 b.Target = "_blank";
                 GridView1.Columns.Add(b);
             }
             else
             {
                 BoundField b = new BoundField();
                 b.HeaderText = dt.Columns[i].ColumnName;
                 b.DataField = dt.Columns[i].ColumnName;
                 GridView1.Columns.Add(b);
             }
         }
         GridView1.DataSource = dt;
         GridView1.DataBind();
     }
 }
开发者ID:chutinhha,项目名称:onlineexampro,代码行数:32,代码来源:Grid.aspx.cs

示例2: bindDataByDate

    protected void bindDataByDate(GridView gv)
    {
        DataSet ds = getBookingsDataThisyear(getSegmentID(), getSalesOrgID());
        if (ds != null)
        {
            gv.Width = Unit.Pixel(300);
            gv.AutoGenerateColumns = false;
            gv.AllowPaging = false;
            gv.Visible = true;

            //Calculate the VAR column and Total row of next year.
            try
            {
                ds.Tables[0].Columns.Add("VAR");
                if (ds.Tables[0].Rows[0][0] != DBNull.Value)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        float tmp = 0;
                        if (float.Parse(dr[2].ToString()) != 0)
                        {
                            tmp = (float.Parse(dr[1].ToString()) - float.Parse(dr[2].ToString())) * 100 / float.Parse(dr[2].ToString());
                            dr["VAR"] = Convert.ToInt32(tmp).ToString() + "%";
                        }
                    }
                }
            }
            catch
            {
                log.WriteLog(LogUtility.LogErrorLevel.LOG_ERROR, "Format string to float Error.");
                Response.Redirect("~/Executive/ExecutiveError.aspx");
            }

            for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
            {
                BoundField bf = new BoundField();

                bf.DataField = ds.Tables[0].Columns[i].ColumnName.ToString();
                bf.HeaderText = ds.Tables[0].Columns[i].Caption.ToString();
                bf.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
                bf.HeaderStyle.HorizontalAlign = HorizontalAlign.Right;
                if (i == 0)
                {
                    bf.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
                    bf.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
                }
                bf.ReadOnly = true;
                gv.Columns.Add(bf);
            }

            gv.Caption = "Total(" + year.Substring(2, 2) + ")";
            gv.CaptionAlign = TableCaptionAlign.Top;
            gv.AllowSorting = true;
            gv.DataSource = ds.Tables[0];
            gv.DataBind();
        }
        else
            gv.Visible = false;
    }
开发者ID:gracianani,项目名称:SINO_CRM,代码行数:59,代码来源:ExecutiveBookingBySalesOrgBySegment.aspx.cs

示例3: bindDataSource

    /// <summary>
    /// Use for displaying out a data table by gridview 
    /// </summary>
    /// <param name="gridview"></param>
    /// <param name="str_caption">caption of gridview</param>
    /// <param name="ds">DataSet</param>
    protected void bindDataSource(GridView gridview, string str_caption, DataSet ds)
    {
        bool flag = true;
        if (ds != null)
        {
            if (ds.Tables[0].Rows.Count == 0)
            {
                flag = false;
                sql.getNullDataSet(ds);
            }
            //By Lhy 20110512 ITEM18  DEL Start
            //gridview.Width = Unit.Pixel(260);
            //By Lhy 20110512 ITEM18  DEL End
            gridview.AutoGenerateColumns = false;
            //BY lhy 20110511 DEL Start;
            // gridview.AllowPaging = true;
            //BY lhy 20110511 DEL End;

            //BY lhy 20110511 ADD Start;
            gridview.AllowPaging = false;
            //BY lhy 20110511 ADD End;
            gridview.Visible = true;

            for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
            {
                BoundField bf = new BoundField();

                bf.DataField = ds.Tables[0].Columns[i].ColumnName.ToString();
                bf.HeaderText = ds.Tables[0].Columns[i].Caption.ToString();
                bf.ItemStyle.Width = 200;
                bf.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
                bf.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
                bf.HeaderStyle.Wrap = false;
                gridview.Columns.Add(bf);
            }

            CommandField cf_Delete = new CommandField();
            cf_Delete.ButtonType = ButtonType.Image;
            cf_Delete.ShowDeleteButton = true;
            cf_Delete.ShowCancelButton = true;
            cf_Delete.CausesValidation = false;
            cf_Delete.DeleteImageUrl = "~/images/del.jpg";
            cf_Delete.DeleteText = "Delete";
            gridview.Columns.Add(cf_Delete);

            gridview.AllowSorting = true;
            //By Lhy 20110512 ITEM18  DEL End
            //gridview.Caption = str_caption;
            //gridview.CaptionAlign = TableCaptionAlign.Top;
            //By Lhy 20110512 ITEM18  DEL End
            gridview.DataSource = ds.Tables[0];
            gridview.DataBind();
            gridview.Columns[0].Visible = false;
            gridview.Columns[gridview.Columns.Count - 1].Visible = flag;
            if (getRoleID(getRole()) != "0")
                gridview.Columns[gridview.Columns.Count - 1].Visible = false;
        }
    }
开发者ID:gracianani,项目名称:SINO_CRM,代码行数:64,代码来源:RSMInfo.aspx.cs

示例4: bindDataSource

    protected void bindDataSource(DataSet ds_channel)
    {
        bool notNullFlag = true;
        if (ds_channel.Tables[0].Rows.Count == 0)
        {
            notNullFlag = false;
            sql.getNullDataSet(ds_channel);
        }
        gv_channel.Width = Unit.Pixel(600);
        gv_channel.AutoGenerateColumns = false;
        //By Wsy 20110512 ITEM 18 DEL Start
        //gv_channel.AllowPaging = true;
        //By Wsy 20110512 ITEM 18 DEL End

        //By Wsy 20110512 ITEM 18 ADD Start
        gv_channel.AllowPaging = false;
        //By Wsy 20110512 ITEM 18 ADD End
        gv_channel.Visible = true;
        gv_channel.HeaderStyle.Wrap = false;

        for (int i = 0; i < ds_channel.Tables[0].Columns.Count; i++)
        {
            BoundField bf = new BoundField();

            bf.DataField = ds_channel.Tables[0].Columns[i].ColumnName.ToString();
            bf.HeaderText = ds_channel.Tables[0].Columns[i].Caption.ToString();
            bf.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
            bf.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
            bf.ReadOnly = true;
            //By Wsy 20110512 ITEM 18 ADD Start
            bf.ItemStyle.Width = 500;
            //By Wsy 20110512 ITEM 18 ADD End
            bf.ControlStyle.Width = bf.ItemStyle.Width;
            gv_channel.Columns.Add(bf);
        }

        CommandField cf_Delete = new CommandField();
        cf_Delete.ButtonType = ButtonType.Image;
        cf_Delete.ShowDeleteButton = true;
        cf_Delete.ShowCancelButton = true;
        cf_Delete.CausesValidation = false;
        cf_Delete.DeleteImageUrl = "~/images/del.jpg";
        cf_Delete.DeleteText = "Delete";
        gv_channel.Columns.Add(cf_Delete);

        gv_channel.AllowSorting = true;
        gv_channel.DataSource = ds_channel.Tables[0];
        gv_channel.DataBind();
        gv_channel.Columns[0].Visible = false;
        gv_channel.Columns[gv_channel.Columns.Count - 1].Visible = notNullFlag;
        if (getRoleID(getRole()) != "0")
        {
            gv_channel.Columns[gv_channel.Columns.Count - 1].Visible = false;
        }
        lbtn_channel.Visible = true;
    }
开发者ID:gracianani,项目名称:SINO_CRM,代码行数:56,代码来源:AdminSalesChannel.aspx.cs

示例5: createColumns

 private void createColumns(DataSet ds)
 {
     gvResult.Columns.Clear();
     foreach (DataColumn column in ds.Tables[0].Columns)
     {
         BoundField boundField = new BoundField();
         boundField.DataField = column.ColumnName;
         boundField.HeaderText = column.ColumnName;
         gvResult.Columns.Add(boundField);
     }
 }
开发者ID:kiquenet,项目名称:B4F,代码行数:11,代码来源:TestHQL.aspx.cs

示例6: BindGrid

    public void BindGrid()
    {
        DataTable dtCost = getTable();
        if (dtCost != null)
        {
            if (dtCost.Rows.Count > 0)
            {
                btnExport.Visible = true;
                grdCostReport.DataSource = dtCost;

                BoundField bnd = new BoundField();
                bnd.DataField = "Field";
                bnd.HeaderText = "Model";
                grdCostReport.Columns.Add(bnd);

                string strQuarterQuery = "Select distinct Quarter from vw_QuarterWiseBudgetCost";
                DataTable dtQuarter = objQueryController.ExecuteQuery(strQuarterQuery);
                if (dtQuarter != null)
                {
                    if (dtQuarter.Rows.Count > 0)
                    {
                        foreach (DataRow drQuarter in dtQuarter.Rows)
                        {
                            BoundField bndf = new BoundField();
                            bndf.DataField = drQuarter["Quarter"].ToString();
                            bndf.HeaderText = drQuarter["Quarter"].ToString();
                            grdCostReport.Columns.Add(bndf);
                        }
                    }
                }
                strGroup = "ModelGroupName";
                helper = new GridViewHelper(this.grdCostReport, false);
                string[] cols = new string[1];
                cols[0] = strGroup;
                helper.RegisterGroup(cols, true, true);
                helper.GroupHeader += new GroupEvent(helper_GroupHeader);
                grdCostReport.DataBind();

            }
            else
            {
                btnExport.Visible = false;
                grdCostReport.DataSource = null;
                grdCostReport.DataBind();

            }
        }
        else
        {
            btnExport.Visible = false;
            grdCostReport.DataSource = null;
            grdCostReport.DataBind();
        }
    }
开发者ID:krishnakant,项目名称:WMS,代码行数:54,代码来源:BudgetReport.aspx.cs

示例7: AddColumnToGridView

    /// <summary>
    /// Adds new column to specified GridView control.
    /// </summary>
    /// <param name="gv">GridView control.</param>
    /// <param name="dataField">Name of the data field.</param>
    /// <param name="headerText">Header text.</param>
    private void AddColumnToGridView(GridView gv, string dataField, string headerText)
    {
        // Define first header column
        BoundField boundfield = new BoundField
        {
            DataField = dataField,
            HeaderText = headerText
        };

        gv.Columns.Add(boundfield);
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:17,代码来源:Tab_Reports.aspx.cs

示例8: bound

    protected void bound(string nombreCampo, string nombreLabel)
    {
        if (dt.Rows[0][nombreCampo].ToString() != "0" && dt.Rows[0][nombreCampo] != null && dt.Rows[0][nombreCampo].ToString() != "")
        {
            BoundField bound = new BoundField();

            if (nombreCampo == "PrecioVenta")
            {
                if (dt.Rows[0]["MonedaVenta"].ToString() == "P")
                {
                    bound.HeaderText = nombreLabel + " (ARS$)";
                }
                else if (dt.Rows[0]["MonedaVenta"].ToString() == "D")
                {
                    bound.HeaderText = nombreLabel + " (US$)";
                }
            }
            else if (nombreCampo == "PrecioVenta2")
            {
                if (dt.Rows[0]["MonedaVenta2"].ToString() == "P")
                {
                    bound.HeaderText = nombreLabel + " (ARS$)";
                }
                else if (dt.Rows[0]["MonedaVenta2"].ToString() == "D")
                {
                    bound.HeaderText = nombreLabel + " (US$)";
                }
            }
            else if (nombreCampo == "PrecioAlquiler")
            {
                if (dt.Rows[0]["MonedaAlquiler"].ToString() == "P")
                {
                    bound.HeaderText = nombreLabel + " (ARS$)";
                }
                else if (dt.Rows[0]["MonedaAlquiler"].ToString() == "D")
                {
                    bound.HeaderText = nombreLabel + " (US$)";
                }
            }
            else
            {
                bound.HeaderText = nombreLabel;
            }

            bound.DataField = nombreCampo;
            bound.HeaderStyle.HorizontalAlign = HorizontalAlign.Right;
            bound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
            DetailsView1.Fields.Add(bound);
        }
    }
开发者ID:EasyDenken,项目名称:GrupoINCI,代码行数:50,代码来源:FichaPropiedad.aspx.cs

示例9: bindDataSource

    protected void bindDataSource(DataSet ds_region)
    {
        bool notNullFlag = true;
        if (ds_region.Tables[0].Rows.Count == 0)
        {
            notNullFlag = false;
            sql.getNullDataSet(ds_region);
        }

        gv_Region.Width = Unit.Pixel(800);
        gv_Region.AutoGenerateColumns = false;
        gv_Region.AllowPaging = false;
        gv_Region.Visible = true;

        for (int i = 0; i < ds_region.Tables[0].Columns.Count; i++)
        {
            BoundField bf = new BoundField();

            bf.DataField = ds_region.Tables[0].Columns[i].ColumnName.ToString();
            bf.HeaderText = ds_region.Tables[0].Columns[i].Caption.ToString();
            bf.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
            bf.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
            bf.HeaderStyle.Wrap = false;
            gv_Region.Columns.Add(bf);
        }

        //CommandField cf_Delete = new CommandField();
        //cf_Delete.ButtonType = ButtonType.Image;
        //cf_Delete.ShowDeleteButton = true;
        //cf_Delete.ShowCancelButton = true;
        //cf_Delete.CausesValidation = false;
        //cf_Delete.DeleteImageUrl = "~/images/del.jpg";
        //cf_Delete.DeleteText = "Delete";
        //gv_Region.Columns.Add(cf_Delete);

        gv_Region.AllowSorting = true;
        gv_Region.DataSource = ds_region.Tables[0];
        gv_Region.DataBind();

        gv_Region.Columns[gv_Region.Columns.Count - 1].Visible = notNullFlag;
        gv_Region.Columns[0].Visible = false;
        gv_Region.Columns[1].Visible = false;
        gv_Region.Columns[2].Visible = false;
        gv_Region.Columns[3].Visible = false;
        if (getRoleID(getRole()) != "0")
            gv_Region.Columns[gv_Region.Columns.Count - 1].Visible = false;
    }
开发者ID:gracianani,项目名称:SINO_CRM,代码行数:47,代码来源:AdminRegion.aspx.cs

示例10: OnPreRender

    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        this.Visible = false;

        if (this.Table != null)
        {
            // Get the log table
            DataTable dt = this.Table;
            if (!DataHelper.DataSourceIsEmpty(dt))
            {
                this.Visible = true;

                // Set the column names
                foreach (DataColumn dc in dt.Columns)
                {
                    BoundField col = new BoundField();
                    col.DataField = dc.ColumnName;
                    col.HeaderText = GetString(ResourcePrefix + dc.ColumnName);

                    // Set style
                    col.ItemStyle.BorderColor = Color.FromArgb(204, 204, 204);
                    col.ItemStyle.BorderStyle = BorderStyle.Solid;
                    col.ItemStyle.BorderWidth = 1;
                    col.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
                    if (dc.DataType != typeof(string))
                    {
                        col.ItemStyle.Wrap = false;
                    }

                    col.HeaderStyle.CopyFrom(col.ItemStyle);

                    gridValues.Columns.Add(col);
                }

                // Bind the data
                gridValues.DataSource = dt;
                gridValues.DataBind();

                if (!String.IsNullOrEmpty(this.Title))
                {
                    this.ltlInfo.Text = "<div style=\"padding: 5px 2px 2px 2px;\"><strong>" + this.Title + "</strong></div>";
                }
            }
        }
    }
开发者ID:v-jli,项目名称:jean0407large,代码行数:47,代码来源:ValuesTable.ascx.cs

示例11: _SetupGridView

    //private SqlDataSource _sqlDataSource;
    private void _SetupGridView()
    {
        var idBoundField = new ButtonField
                               {
                                   DataTextField = "ID",
                                   ButtonType = ButtonType.Link,
                                   CommandName = "Select",
                                   HeaderText = "Select"
                               };
        var firstNameField = new BoundField
                                 {
                                     DataField = "FirstName",
                                     HeaderText = "First Name",
                                     SortExpression = "FirstName, LastName"
                                 };
        var lastNameField = new BoundField
                                {
                                    DataField = "LastName",
                                    HeaderText = "Last Name",
                                    SortExpression = "LastName, FirstName"
                                };
        var phoneField = new BoundField
                             {
                                 DataField = "Phone",
                                 HeaderText = "Phone",
                                 SortExpression = "Phone"
                             };
        var emailField = new BoundField
                             {
                                 DataField = "EmailAddress",
                                 HeaderText = "Email Address",
                                 SortExpression = "EmailAddress"
                             };

        _gridView.Columns.Add(idBoundField);
        _gridView.Columns.Add(firstNameField);
        _gridView.Columns.Add(lastNameField);
        _gridView.Columns.Add(phoneField);
        _gridView.Columns.Add(emailField);

        _gridView.DataSourceID = "_sqlDataSource";
        _gridView.DataKeyNames = new[] {"Id"};
        _gridView.RowCommand += GridCommand;
    }
开发者ID:RobinClowers,项目名称:olympia_software_craftsmanship_workshop,代码行数:45,代码来源:CitizenList.aspx.cs

示例12: bindDataSource

    /// <summary>
    /// bindDataSource
    /// </summary>
    /// <param name="gridview"></param>
    /// <param name="str_caption"></param>
    /// <param name="ds"></param>
    /// <param name="sel"></param>
    /// 
    protected void bindDataSource(GridView gridview, string str_caption, DataSet ds, bool sel)
    {
        bool bflag = true;
        if (ds.Tables[0].Rows.Count == 0)
        {
            bflag = false;
            sql.getNullDataSet(ds);
        }
        gridview.Width = Unit.Pixel(370);
        gridview.AutoGenerateColumns = false;
        gridview.AllowPaging = false;
        gridview.Visible = true;

        for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
        {
            BoundField bf = new BoundField();

            bf.DataField = ds.Tables[0].Columns[i].ColumnName.ToString();
            bf.ItemStyle.Width = 200;
            bf.HeaderText = ds.Tables[0].Columns[i].Caption.ToString();
            bf.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
            bf.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;

            gridview.Columns.Add(bf);
        }

        CommandField cf_Delete = new CommandField();
        cf_Delete.ButtonType = ButtonType.Image;
        cf_Delete.ShowDeleteButton = true;
        cf_Delete.ShowCancelButton = true;
        cf_Delete.CausesValidation = false;
        cf_Delete.DeleteImageUrl = "~/images/del.jpg";
        cf_Delete.DeleteText = "Delete";
        gridview.Columns.Add(cf_Delete);

        gridview.Caption = str_caption;
        gridview.CaptionAlign = TableCaptionAlign.Top;
        gridview.AllowSorting = true;
        gridview.DataSource = ds.Tables[0];
        gridview.DataBind();
        gridview.Columns[0].Visible = false;
        gridview.Columns[gridview.Columns.Count - 1].Visible = bflag;
    }
开发者ID:gracianani,项目名称:SINO_CRM,代码行数:51,代码来源:SalesOrgMgrSalesOrgInfo.aspx.cs

示例13: bindDataSource

    protected void bindDataSource()
    {
        DataSet ds_Country = sql.getOperationBySegment(ddlist_segment.SelectedItem.Value);

        if (ds_Country.Tables[0].Rows.Count > 0)
        {
            gv_opAbbr.Width = Unit.Pixel(200);
            gv_opAbbr.AutoGenerateColumns = false;
            gv_opAbbr.AllowPaging = true;
            gv_opAbbr.Visible = true;

            for (int i = 2; i < ds_Country.Tables[0].Columns.Count; i++)
            {
                BoundField bf = new BoundField();

                bf.DataField = ds_Country.Tables[0].Columns[i].ColumnName.ToString();
                bf.HeaderText = ds_Country.Tables[0].Columns[i].Caption.ToString();
                bf.ItemStyle.Width = 100;
                bf.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
                bf.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
                bf.ReadOnly = true;

                gv_opAbbr.Columns.Add(bf);
            }

            gv_opAbbr.AllowSorting = true;
            gv_opAbbr.DataSource = ds_Country.Tables[0];
            gv_opAbbr.DataBind();
            panel_enter.Visible = true;
            panel_enter.Enabled = true;
        }
        else
        {
            panel_enter.Visible = true;
            gv_opAbbr.Visible = false;
            panel_enter.Enabled = false;
        }
    }
开发者ID:gracianani,项目名称:SINO_CRM,代码行数:38,代码来源:ExecutiveBookingsSalesForecast.aspx.cs

示例14: OnPreRender

    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        Visible = false;

        if (Table != null)
        {
            // Get the log table
            DataTable dt = Table;
            if (!DataHelper.DataSourceIsEmpty(dt))
            {
                Visible = true;

                // Set the column names
                foreach (DataColumn dc in dt.Columns)
                {
                    BoundField col = new BoundField();
                    col.DataField = dc.ColumnName;
                    col.HeaderText = GetString(ResourcePrefix + dc.ColumnName);

                    col.HeaderStyle.CopyFrom(col.ItemStyle);

                    gridValues.Columns.Add(col);
                }

                // Bind the data
                gridValues.DataSource = dt;
                gridValues.DataBind();

                if (!String.IsNullOrEmpty(Title))
                {
                    ltlInfo.Text = "<div style=\"padding: 5px 2px 2px 2px;\"><strong>" + Title + "</strong></div>";
                }
            }
        }
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:37,代码来源:ValuesTable.ascx.cs

示例15: bindDataSource

    /// <summary>
    ///  Bind user information
    /// </summary>
    /// <param name="ds">dataset</param>
    protected void bindDataSource(DataSet ds)
    {
        if (ds.Tables[0].Rows.Count == 0)
        {
            sql.getNullDataSet(ds);
        }
        gv_administrator.Width = Unit.Pixel(800);
        gv_administrator.AutoGenerateColumns = false;
        gv_administrator.AllowPaging = true;
        gv_administrator.Visible = true;

        //add columns
        addOperationCol(ds);
        addCountryCol(ds);
        addSegmentCol(ds);

        for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
        {
            BoundField bf = new BoundField();

            bf.DataField = ds.Tables[0].Columns[i].ColumnName.ToString();
            bf.HeaderText = ds.Tables[0].Columns[i].Caption.ToString();
            bf.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
            bf.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;

            gv_administrator.Columns.Add(bf);
        }

        gv_administrator.AllowSorting = true;
        gv_administrator.DataSource = ds.Tables[0];
        gv_administrator.DataBind();
        gv_administrator.Columns[0].Visible = false;
        gv_administrator.Columns[6].Visible = false;
        gv_administrator.Columns[7].Visible = false;
        gv_administrator.Columns[8].Visible = false;
        gv_administrator.Columns[9].Visible = false;
    }
开发者ID:gracianani,项目名称:SINO_CRM,代码行数:41,代码来源:AdminUserRelation.aspx.cs


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