本文整理汇总了C#中System.Web.UI.WebControls.BoundField类的典型用法代码示例。如果您正苦于以下问题:C# BoundField类的具体用法?C# BoundField怎么用?C# BoundField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BoundField类属于System.Web.UI.WebControls命名空间,在下文中一共展示了BoundField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportToExcel
/// <summary>
/// 数组方式
/// </summary>
/// <param name="dataList"></param>
/// <param name="fields"></param>
/// <param name="headTexts"></param>
/// <param name="title"></param>
/// <param name="TableName"></param>
public static void ExportToExcel(DataTable dataList, string[] fields, string[] headTexts, string title,
string TableName) {
var gvw = new GridView();
int ColCount, i;
//如果筛选的字段和对应的列头名称个数相对的情况下只导出指定的字段
if (fields.Length != 0 && fields.Length == headTexts.Length) {
ColCount = fields.Length;
gvw.AutoGenerateColumns = false;
for (i = 0; i < ColCount; i++) {
var bf = new BoundField();
bf.DataField = fields[i];
bf.HeaderText = headTexts[i];
gvw.Columns.Add(bf);
}
}
else {
gvw.AutoGenerateColumns = true;
}
gvw.DataSource = dataList;
SetStype(gvw);
// gvw.Columns[]
gvw.DataBind();
ExportToExcel(gvw, title, TableName);
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
var createdColumn = new BoundField();
createdColumn.DataField = "Created";
createdColumn.HeaderText = "Datum";
createdColumn.DataFormatString = "{0:dd-MM-yyyy}";
var deliveryPriceColumn = new BoundField();
deliveryPriceColumn.HeaderText = "Verzendkosten";
deliveryPriceColumn.DataField = "DeliveryPrice";
deliveryPriceColumn.DataFormatString = "{0:C}";
var viewColumn = new HyperLinkField();
viewColumn.Text = "Bekijk";
viewColumn.Target = "_blank";
viewColumn.DataNavigateUrlFormatString = this.Request.Url.AbsolutePath + "?page=Order&order={0}";
viewColumn.DataNavigateUrlFields = new[] { "Id" };
var pdfColumn = new HyperLinkField();
pdfColumn.Text = "PDF";
pdfColumn.Target = "_blank";
pdfColumn.DataNavigateUrlFormatString = this.Request.Url.AbsolutePath + "?page=Order&method=Pdf&order={0}";
pdfColumn.DataNavigateUrlFields = new[] { "Id" };
this.GridViewOrders.Columns.Add(createdColumn);
this.GridViewOrders.Columns.Add(deliveryPriceColumn);
this.GridViewOrders.Columns.Add(viewColumn);
this.GridViewOrders.Columns.Add(pdfColumn);
this.GridViewOrders.AutoGenerateColumns = false;
this.GridViewOrders.DataSource = new BusinessLogicLayer.Order().GetAll();
this.GridViewOrders.DataBind();
}
示例3: GenerateColumns
protected void GenerateColumns()
{
// remove all previous rows because we set EnableViewState="True"
gvScholPrograms.Columns.Clear();
/* set ScholID as the primary keys of each row */
gvScholPrograms.DataKeyNames = new string[] { "ScholID" };
/* 1st column = Scholarship Name */
HyperLinkField hlf = new HyperLinkField();
hlf.HeaderText = TextCode(10421);
hlf.HeaderStyle.CssClass = "leftAlign";
hlf.SortExpression = "ScholName";
hlf.DataTextField = "ScholName";
hlf.DataNavigateUrlFields = new string[] { "ScholID" };
hlf.DataNavigateUrlFormatString = "ScholAppDetailsPrinterFriendly.aspx?LoginID=" + LoginID + "&ScholID={0}";
hlf.ItemStyle.CssClass = "leftAlign";
gvScholPrograms.Columns.Add(hlf);
/* 2nd column = Deadline */
BoundField bf2 = new BoundField();
bf2.HeaderText = TextCode(10422);
bf2.SortExpression = "DeadlineSorting";
bf2.DataField = "Deadline";
bf2.ItemStyle.CssClass = "leftAlign";
gvScholPrograms.Columns.Add(bf2);
/* 3rd column = Status */
BoundField bf3 = new BoundField();
bf3.HeaderText = TextCode(10423);
bf3.SortExpression = "Status";
bf3.DataField = "Status";
bf3.ItemStyle.CssClass = "leftAlign";
gvScholPrograms.Columns.Add(bf3);
}
示例4: OnInit_gridFila
protected void OnInit_gridFila(object sender, EventArgs e)
{
if (!Page.IsPostBack)
Session.Remove("acessoMedico");
bool acessoMedico;
if (Session["acessoMedico"] == null)
{
IUsuarioProfissionalUrgence iUsuarioProfissional = Factory.GetInstance<IUsuarioProfissionalUrgence>();
Usuario usuario = (Usuario)Session["Usuario"];
acessoMedico = iUsuarioProfissional.VerificarAcessoMedico(usuario.Codigo, "REALIZAR_CONSULTA_MEDICA", usuario.Unidade.CNES);
Session["acessoMedico"] = acessoMedico;
}
else
acessoMedico = (bool)Session["acessoMedico"];
if (!acessoMedico)
{
gridFila.Columns.RemoveAt(1);
BoundField nomepaciente = new BoundField();
nomepaciente.DataField = "NomePacienteToString";
nomepaciente.HeaderText = "Paciente";
nomepaciente.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
nomepaciente.ItemStyle.Width = Unit.Pixel(280);
gridFila.Columns.Insert(1, nomepaciente);
}
}
示例5: LoadGridViewListaUsuarios
private void LoadGridViewListaUsuarios()
{
UsuarioNegocio usuarioNegocio = new UsuarioNegocio();
List<Usuario> listUsuarios = usuarioNegocio.ObterTodosUsuarios();
GridViewListaUsuarios.Columns.Clear();
GridViewListaUsuarios.DataSource = listUsuarios;
GridViewListaUsuarios.AutoGenerateColumns = false;
BoundField bfNomeUsuario = new BoundField();
bfNomeUsuario.DataField = "Nome";
bfNomeUsuario.HeaderText = "Nome";
GridViewListaUsuarios.Columns.Add(bfNomeUsuario);
BoundField bfLogin = new BoundField();
bfLogin.DataField = "Login";
bfLogin.HeaderText = "Login";
GridViewListaUsuarios.Columns.Add(bfLogin);
CommandField cmdField = new CommandField();
cmdField.ButtonType = ButtonType.Image;
cmdField.DeleteImageUrl = "Icons/cross.png";
cmdField.EditImageUrl = "Icons/page_edit.png";
//cmdField.SelectImageUrl = "Icons/money_add.png";
cmdField.ShowDeleteButton = true;
cmdField.ShowEditButton = true;
//cmdField.ShowSelectButton = true;
cmdField.EditText = "Editar Usuario";
cmdField.DeleteText = "Remover Usuario";
GridViewListaUsuarios.Columns.Add(cmdField);
GridViewListaUsuarios.DataBind();
}
示例6: can_initalise
public void can_initalise()
{
/*
* prepare a definied testable structure
*/
DataControlFieldCollection columns = new DataControlFieldCollection();
Dictionary<string, bool> setupConfig = TrackListing.getKeyboardConfiguration(new HashedSet<string>(), new HashedSet<string>());
foreach(KeyValuePair<string, bool> entry in setupConfig) {
BoundField dummy = new BoundField();
dummy.HeaderText = entry.Key;
columns.Add(dummy);
}
Assert.AreEqual(15, columns.Count);
foreach(DataControlField dummy in columns)
Assert.IsTrue(dummy.Visible);
/*
* ... more definied structure
*/
string disabledColumn = Track.Property.Titel.ToString();
string fadedColumn = Track.Property.Year.ToString();
ISet<string> disabled = new HashedSet<string>(new string[] { disabledColumn });
ISet<string> faded = new HashedSet<string>(new string[] { fadedColumn });
Dictionary<string, bool> testConfig = TrackListing.getKeyboardConfiguration(disabled, faded);
Assert.AreEqual(14, testConfig.Count);
foreach(KeyValuePair<string, bool> entry in testConfig) {
if(entry.Key.Equals(fadedColumn))
Assert.IsTrue(entry.Value);
else
Assert.IsFalse(entry.Value);
}
StateBag stateBag = new StateBag();
/*
* white-box expectations
*/
Expect.Once.On(view).GetProperty("StateBag").Will(Return.Value(stateBag));
Expect.Once.On(view).GetProperty("DisabledColumns").Will(Return.Value(disabled));
Expect.Once.On(view).GetProperty("FadedColumns").Will(Return.Value(faded));
Expect.Once.On(view).GetProperty("Columns").Will(Return.Value(columns));
/*
* do the testing
*/
presenter.initialise();
Assert.AreEqual(SortDirection.Ascending, (SortDirection)StateBagTask.getSortDirection(stateBag));
Assert.AreEqual(Track.Property.Titel, (Track.Property)StateBagTask.getSortExpression(stateBag));
foreach(DataControlField dummy in columns) {
if(dummy.HeaderText.Equals(disabledColumn) || dummy.HeaderText.Equals(fadedColumn))
Assert.IsFalse(dummy.Visible);
else
Assert.IsTrue(dummy.Visible);
}
}
示例7: btnSearch_Click
protected void btnSearch_Click(object sender, EventArgs e)
{
if (dplstSearchScope.SelectedValue.Equals("all"))
{
//搜索全部的话,简单刷新即可。
Response.Redirect(Request.Url.ToString());
}
else
{
if (dplstSearchScope.SelectedValue.Equals("alreadyBuy"))
{
BoundField buyCoursePeople = new BoundField();
buyCoursePeople.DataField = "course_people";
buyCoursePeople.DataFormatString = "{0}";
buyCoursePeople.HeaderText = "购买人数";
//魔法!别动!
CourseManageDataSource.SelectCommand
=
"SELECT [avfun].[dbo].[COURSE].[course_id],[avfun].[dbo].[COURSE].[course_name],[avfun].[dbo].[COURSE].[course_price],[avfun].[dbo].[COURSE].[course_robot_link],[avfun].[dbo].[COURSE].[course_begin_date],[avfun].[dbo].[COURSE].[course_isDeleted],[avfun].[dbo].[COURSE].[course_timestamp],count([user_id]) as course_people"
+ " FROM [avfun].[dbo].[COURSE],[avfun].[dbo].[UserCourseList]"
+ " WHERE([avfun].[dbo].[COURSE].[course_id] = order_course )"
+ " GROUP BY [avfun].[dbo].[COURSE].[course_id],[avfun].[dbo].[COURSE].[course_name],[avfun].[dbo].[COURSE].[course_price],[avfun].[dbo].[COURSE].[course_robot_link],[avfun].[dbo].[COURSE].[course_begin_date],[avfun].[dbo].[COURSE].[course_isDeleted],[avfun].[dbo].[COURSE].[course_timestamp]"
+ " ORDER BY [avfun].[dbo].[COURSE].[course_begin_date] DESC";
CourseLists.Columns.Add(buyCoursePeople);
}
else
{
CourseLists.Columns.RemoveAt(CourseLists.Columns.Count - 1);
CourseManageDataSource.SelectCommand = "SELECT [course_id], [course_name], [course_price], [course_begin_date], [course_robot_link], [course_isDeleted] FROM [COURSE] ORDER BY [course_begin_date] DESC";
}
}
}
示例8: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
List<SqlParameter> parameterList = new List<SqlParameter>();
SqlDataReader reader = SQLUtilities.RunStoredProcedure("GetAllUsers", parameterList);
if (reader != null)
{
DataTable dt = new DataTable();
BoundField bf = new BoundField();
BoundField bf1 = new BoundField();
dt.Columns.Add("UserID");
dt.Columns.Add("User Name");
while (reader.Read())
{
string userID = reader[0].ToString();
string username = reader[1].ToString();
dt.Rows.Add(
bf1.DataField.Insert(0, userID),
bf.DataField.Insert(0, username)
);
}
Session["CACHEDATA1"] = dt;
GridView1.DataSource = dt;
GridView1.DataBind();
}
parameterList.Clear();
SqlDataReader reader2 = SQLUtilities.RunStoredProcedure("GetAllSongsAndArtists", parameterList);
if (reader2 != null)
{
DataTable dt = new DataTable();
BoundField bf = new BoundField();
BoundField bf1 = new BoundField();
dt.Columns.Add("Artist");
dt.Columns.Add("Song Title");
while (reader2.Read())
{
string artist = reader2[0].ToString();
string song = reader2[1].ToString();
dt.Rows.Add(
bf1.DataField.Insert(0, artist),
bf.DataField.Insert(0, song)
);
}
Session["CACHEDATA1"] = dt;
GridView2.DataSource = dt;
GridView2.DataBind();
}
}
}
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
var nameColumn = new BoundField();
nameColumn.DataField = "Name";
nameColumn.HeaderText = "Naam";
var heightColumn = new BoundField();
heightColumn.DataField = "Height";
heightColumn.HeaderText = "Hoogte";
var widthColumn = new BoundField();
widthColumn.DataField = "Width";
widthColumn.HeaderText = "Breedte";
var lengthColumn = new BoundField();
lengthColumn.DataField = "Length";
lengthColumn.HeaderText = "Lengte";
var connectionsColumn = new BoundField();
connectionsColumn.DataField = "Connections";
connectionsColumn.HeaderText = "Connecties";
this.GridView.Columns.Add(nameColumn);
this.GridView.Columns.Add(heightColumn);
this.GridView.Columns.Add(widthColumn);
this.GridView.Columns.Add(lengthColumn);
this.GridView.Columns.Add(connectionsColumn);
this.GridView.AutoGenerateColumns = false;
this.GridView.DataSource = this.Ships;
this.GridView.DataBind();
}
示例10: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
LinkButton eas_pesquisarcnes = this.EAS.WUC_LinkButton_PesquisarCNES;
LinkButton eas_pesquisarnome = this.EAS.WUC_LinkButton_PesquisarNomeFantasia;
this.InserirTrigger(eas_pesquisarcnes.UniqueID, "Click", this.UpdatePanel_Unidade);
this.InserirTrigger(eas_pesquisarnome.UniqueID, "Click", this.UpdatePanel_Unidade);
eas_pesquisarcnes.Click += new EventHandler(OnClick_PesquisarCNES);
eas_pesquisarnome.Click += new EventHandler(OnClick_PesquisarNomeFantasiaUnidade);
if (!IsPostBack)
{
if (!Factory.GetInstance<ISeguranca>().VerificarPermissao(((Usuario)Session["Usuario"]).Codigo, "MANTER_ESTABELECIMENTO_SAUDE", Modulo.ESTABELECIMENTO_SAUDE))
{
BoundField bound = new BoundField();
bound.HeaderText = "Nome Fantasia";
bound.DataField = "NomeFantasia";
bound.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
bound.ItemStyle.Width = Unit.Pixel(500);
grid_EstabelecimentoSaude.Columns.RemoveAt(1);
grid_EstabelecimentoSaude.Columns.Insert(1, bound);
}
this.EAS.WUC_EstabelecimentosPesquisados = new List<ViverMais.Model.EstabelecimentoSaude>();
}
}
示例11: InitControls
private void InitControls()
{
BoundField column = new BoundField();
column.HeaderText = GetLocalString("ColumnTransferName");
column.DataField = "TransferName";
gvReport.Columns.Add(column);
column = new BoundField();
column.HeaderText = GetLocalString("ColumnSourceAccountName");
column.DataField = "SourceAccountName";
gvReport.Columns.Add(column);
column = new BoundField();
column.HeaderText = GetLocalString("ColumnTargetAccountName");
column.DataField = "TargetAccountName";
gvReport.Columns.Add(column);
column = new BoundField();
column.HeaderText = GetLocalString("ColumnTransactionDate");
column.DataField = "TransactionDate";
gvReport.Columns.Add(column);
column = new BoundField();
column.HeaderText = GetLocalString("ColumnTransactionAmount");
column.DataField = "TransactionAmount";
gvReport.Columns.Add(column);
}
示例12: AddColumn
public void AddColumn(string DataField, string Header, GridView gv)
{
BoundField Field = new BoundField();
Field.DataField = DataField;
Field.HeaderText = Header;
DataControlField Col = Field;
gv.Columns.Add(Col);
}
示例13: Page_Init
protected override void Page_Init(object sender, EventArgs e)
{
#region imposto le colonne della gridview
#region titolo
var col = new BoundField();
col.HeaderText = Etichette.GetItem(Etichette.EtichetteEnum.PopUpOrderListTitleHeaderText, Languages).Valore;
col.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
__GridView_Prodotti.Columns.Insert(0, col);
#endregion
#region quantità
col = new BoundField();
col.HeaderText = Etichette.GetItem(Etichette.EtichetteEnum.PopUpOrderListAmountHeaderText, Languages).Valore;
col.SortExpression = "Quantità";
col.DataField = "Quantità";
col.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
col.HeaderStyle.Width = new Unit(90);
__GridView_Prodotti.Columns.Insert(1, col);
#endregion
#region prezzo singolo
col = new BoundField();
col.HeaderText = Etichette.GetItem(Etichette.EtichetteEnum.PopUpOrderListPriceHeaderText, Languages).Valore;
col.SortExpression = "Prezzo";
col.DataField = "Prezzo";
col.DataFormatString = "{0:C2}";
col.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
col.HeaderStyle.Width = new Unit(100);
__GridView_Prodotti.Columns.Insert(2, col);
#endregion
#region prezzo multiplo
col = new BoundField();
col.HeaderText = Etichette.GetItem(Etichette.EtichetteEnum.PopUpOrderListPriceTotalHeaderText, Languages).Valore;
col.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
col.HeaderStyle.Width = new Unit(100);
__GridView_Prodotti.Columns.Insert(3, col);
#endregion
#endregion
//La categoria selezionata non contiene nessun prodotto
NoProducts = Etichette.GetItem(Etichette.EtichetteEnum.PopUpOrderListNoProducts, Languages).Valore;
if (Ordini.GetItem(Ordini.KeyColumnsEnum.Id, GetQueryStringId) == null) return;
CaricaOrdini();
}
示例14: OnPreInit
protected override void OnPreInit(EventArgs e)
{
BoundField field = new BoundField()
{
//标记
DataField = "SupplierName",
HeaderText = "SupplierName",
};
this.relativeLinkGroupGrid.Columns.Insert(2, field);
base.OnPreInit(e);
}
示例15: adminGetAllTestimonials
protected void adminGetAllTestimonials()
{
TestimonialsObj tObj = new TestimonialsObj();
try
{
if (tObj.getTestimonials(0, true))
{
//bind data
BoundField custName = new BoundField();
custName.ReadOnly = true;
custName.HeaderText = "Customer Name";
custName.DataField = "cust_Name";
this.gvTestimonials.Columns.Add(custName);
BoundField custLoc = new BoundField();
custLoc.ReadOnly = true;
custLoc.HeaderText = "Customer Location";
custLoc.DataField = "cust_Location";
this.gvTestimonials.Columns.Add(custLoc);
BoundField custBlurb = new BoundField();
custBlurb.ReadOnly = true;
custBlurb.HeaderText = "Customer Testimonial";
custBlurb.DataField = "testimonial";
this.gvTestimonials.Columns.Add(custBlurb);
BoundField custEvent = new BoundField();
custEvent.ReadOnly = true;
custEvent.HeaderText = "Event";
custEvent.DataField = "cust_Event";
this.gvTestimonials.Columns.Add(custEvent);
this.gvTestimonials.DataSource = null;
this.gvTestimonials.Dispose();
this.gvTestimonials.DataSource = tObj.ds;
this.gvTestimonials.DataBind();
this.formPanel.Visible = false;
this.viewPanel.Visible = true;
}
else
{
this.errMsg.Text = tObj.errMsg;
this.errMsg.Visible = true;
}
}
catch (Exception ee)
{
this.errMsg.Visible = true;
this.errMsg.Text = ee.Message.ToString();
}
tObj = null;
}