当前位置: 首页 > news >正文

广西北海联友建设网站管理seo关键词外包

广西北海联友建设网站管理,seo关键词外包,个人做负面网站犯法不,做国外商品的网站Telerik UI for WinForms拥有适用Windows Forms的110多个令人惊叹的UI控件,所有的UI for WinForms控件都具有完整的主题支持,可以轻松地帮助开发人员在桌面和平板电脑应用程序提供一致美观的下一代用户体验。 Telerik UI for WinForms组件为可视化任何类…

Telerik UI for WinForms拥有适用Windows Forms的110多个令人惊叹的UI控件,所有的UI for WinForms控件都具有完整的主题支持,可以轻松地帮助开发人员在桌面和平板电脑应用程序提供一致美观的下一代用户体验。

Telerik UI for WinForms组件为可视化任何类型的数据提供了非常丰富的UI控件,其中RadGridView是最常用的数据组件。在上文中(点击这里回顾>>),我们主要介绍了如何绑定到DataTable、绑定到JSON、绑定到CSV等,本文继续介绍如何层次结构中的多个子选项卡、嵌套多级层次结构等。

获取Telerik UI for Winform R1 2023 SP2下载(Q技术交流:726377843)

层次结构中的多个子选项卡

每个GridViewTemplate都有一个Templates属性,用于存储其各自的子层次结构级别。因此,可以在同一层次结构级别上添加尽可能多的子模板。

现在,我们将在Products选项卡旁边添加第二个选项卡,其中包含订单:

DataTable ordersTable = new DataTable();
ordersTable.Columns.Add("OrderID", typeof(int));
ordersTable.Columns.Add("CategoryID", typeof(int));
ordersTable.Columns.Add("OrderDate", typeof(DateTime));
for (int i = 0; i < 30; i++)
{
ordersTable.Rows.Add(i, rand.Next(0, 5), DateTime.Now.AddDays(-1 * i));
}GridViewTemplate ordersLevel = new GridViewTemplate();
ordersLevel.DataSource = ordersTable;
ordersLevel.Caption = "Orders";
ordersLevel.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
this.radGridView1.MasterTemplate.Templates.Add(ordersLevel);GridViewRelation relationOrders = new GridViewRelation(radGridView1.MasterTemplate);
relationOrders.ChildTemplate = ordersLevel;
relationOrders.RelationName = "CategoriesOrders";
relationOrders.ParentColumnNames.Add("CategoryID");
relationOrders.ChildColumnNames.Add("CategoryID");
this.radGridView1.Relations.Add(relationOrders);

嵌套多级层次结构

以类似的方式,我们将用必要的GridViewRelations定义嵌套的GridViewTemplates来构造三个层次结构:categories - product - orders。

Random rand = new Random();
DataTable categories = new DataTable();
categories.Columns.Add("CategoryID", typeof(int));
categories.Columns.Add("Title", typeof(string));
categories.Columns.Add("CreatedOn", typeof(DateTime));
for (int i = 0; i < 5; i++)
{
categories.Rows.Add(i, "Master" + i, DateTime.Now.AddDays(i));
}DataTable productsTable = new DataTable();
productsTable.Columns.Add("ProductID", typeof(int));
productsTable.Columns.Add("CategoryID", typeof(int));
productsTable.Columns.Add("Name", typeof(string));
productsTable.Columns.Add("UnitPrice", typeof(decimal));
for (int i = 0; i < 30; i++)
{
productsTable.Rows.Add(i, rand.Next(0, 5), "Product" + i, 1.25 * i);
}this.radGridView1.MasterTemplate.DataSource = categories;
this.radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;GridViewTemplate productsLevel = new GridViewTemplate();
productsLevel.DataSource = productsTable;
productsLevel.Caption = "Products";
productsLevel.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
this.radGridView1.MasterTemplate.Templates.Add(productsLevel);GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate);
relation.ChildTemplate = productsLevel;
relation.RelationName = "CategoriesProducts";
relation.ParentColumnNames.Add("CategoryID");
relation.ChildColumnNames.Add("CategoryID");
this.radGridView1.Relations.Add(relation);DataTable ordersTable = new DataTable();
ordersTable.Columns.Add("OrderID", typeof(int));
ordersTable.Columns.Add("ProductID", typeof(int));
ordersTable.Columns.Add("OrderDate", typeof(DateTime));
for (int i = 0; i < 100; i++)
{
ordersTable.Rows.Add(i, rand.Next(0, 30), DateTime.Now.AddDays(-1 * i));
}GridViewTemplate ordersLevel = new GridViewTemplate();
ordersLevel.DataSource = ordersTable;
ordersLevel.Caption = "Orders";
ordersLevel.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
productsLevel.Templates.Add(ordersLevel);GridViewRelation relationOrders = new GridViewRelation(productsLevel);
relationOrders.ChildTemplate = ordersLevel;
relationOrders.RelationName = "ProductsOrders";
relationOrders.ParentColumnNames.Add("ProductID");
relationOrders.ChildColumnNames.Add("ProductID");
this.radGridView1.Relations.Add(relationOrders);

按需加载层次

在某些情况下,不需要为所有层次级别加载整个数据,这就是所谓的按需加载功能。只有在被请求时才加载层次结构级别,例如,当用户展开父行时。

private void LoadOnDemand()
{
Random rand = new Random();
GridViewDecimalColumn idColumn = new GridViewDecimalColumn("CategoryID");
GridViewTextBoxColumn titleColumn = new GridViewTextBoxColumn("Title");
GridViewDateTimeColumn dateColumn = new GridViewDateTimeColumn("CreatedOn");
this.radGridView1.MasterTemplate.Columns.AddRange(idColumn, titleColumn, dateColumn);
this.radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
for (int i = 0; i < 5; i++)
{
this.radGridView1.MasterTemplate.Rows.Add(i, "Master" + i, DateTime.Now.AddDays(i));
}GridViewTemplate productsLevel = new GridViewTemplate();
productsLevel.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
GridViewDecimalColumn productIdColumn = new GridViewDecimalColumn("ProductID");
GridViewDecimalColumn categoryIdColumn = new GridViewDecimalColumn("CategoryID");
GridViewTextBoxColumn productNameColumn = new GridViewTextBoxColumn("Name");
GridViewDecimalColumn unitPriceColumn = new GridViewDecimalColumn("UnitPrice");
productsLevel.Columns.AddRange(productIdColumn, categoryIdColumn, productNameColumn, unitPriceColumn);
this.radGridView1.MasterTemplate.Templates.Add(productsLevel);
productsLevel.HierarchyDataProvider = new GridViewEventDataProvider(productsLevel);
this.radGridView1.RowSourceNeeded += RadGridView1_RowSourceNeeded;
}private void RadGridView1_RowSourceNeeded(object sender, GridViewRowSourceNeededEventArgs e)
{
if (e.Template.HierarchyLevel==1)
{
for (int i = 0; i < 30; i++)
{
GridViewRowInfo row = e.Template.Rows.NewRow();
row.Cells["ProductID"].Value = i;
row.Cells["CategoryID"].Value = e.ParentRow.Cells["CategoryID"].Value;
row.Cells["Name"].Value = "Product" + row.Cells["CategoryID"].Value+"."+i;
row.Cells["UnitPrice"].Value = 1.25 * i;
e.SourceCollection.Add(row );
}
}
}

GridViewRowSourceNeededEventArgs让开发者可以访问相应的模板,因此如果您有几个层次结构级别,可以通过Template.HierarchyLevel或Caption轻松区分他们。

转换数据类型

在这篇博文的最后一部分,我们将关注一个非常微妙和重要的问题,即数据绑定和将数据记录的字段与网格列进行映射。当数据记录以与想要使用的RadGridView中相应列不兼容的特定类型存储值时,我们将向您提供如何处理这种情况的技巧。

最常见的情况是在DataSource集合中存储“YES”和“NO”,而GridViewCheckBoxColumn期望布尔值解析true/false值,考虑以下设置:

DataTable dt = new DataTable();
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("IsActive", typeof(string));
for (int i = 0; i < 20; i++)
{
dt.Rows.Add(i, "Item" + i, i % 2 == 0 ? "YES" : "NO");
}
this.radGridView1.DataSource = dt;

默认情况下,RadGridView为字符串字段生成GridViewTextBoxColumn,但是如果想用GridViewCheckBoxColumn替换默认列,则可能会丢失字段值映射,因为字符串值不能解析为布尔值。

为了处理这种情况,我们将实现一个自定义的TypeConverter类,它决定RadGridView如何识别这种类型。

public class ToggleStateConverter : TypeConverter
{
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
return destinationType == typeof(ToggleState) || destinationType == typeof(bool);
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (value is string && destinationType == typeof(ToggleState))
{
string stringValue = (string)value;
switch (stringValue)
{
case "YES":
return ToggleState.On;
case "NO":
return ToggleState.Off;
default:
return ToggleState.Indeterminate;
}
}
else if (value is bool && destinationType == typeof(char))
{
bool boolValue = (bool)value;
switch (boolValue)
{
case true:
return "YES";
case false:
return "NO";
default:
return "NO";
}
}
return base.ConvertTo(context, culture, value, destinationType);
}
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(ToggleState) || sourceType == typeof(bool);
}
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
ToggleState state;
bool boolValue;
if (value is ToggleState)
{
state = (ToggleState)value;
switch (state)
{
case ToggleState.On:
return "YES";
case ToggleState.Off:
return "NO";
default:
return "NO";
}
}
else if (value is bool)
{
boolValue = (bool)value;
switch (boolValue)
{
case true:
return "YES";
case false:
return "NO";
default:
return "NO";
}
}
return base.ConvertFrom(context, culture, value);
}
}

现在,对列应用转换器:

DataTable dt = new DataTable();
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("IsActive", typeof(string));
for (int i = 0; i < 20; i++)
{
dt.Rows.Add(i, "Item" + i, i % 2 == 0 ? "YES" : "NO");
}
this.radGridView1.DataSource = dt;
this.radGridView1.Columns.Remove("IsActive");
GridViewCheckBoxColumn checkBoxColumn = new GridViewCheckBoxColumn("IsActive");
checkBoxColumn.FieldName = "IsActive";
checkBoxColumn.DataTypeConverter = new ToggleStateConverter();
checkBoxColumn.EditMode = EditMode.OnValueChange;
this.radGridView1.Columns.Add(checkBoxColumn);

使用TypeConverter的类似方法可以应用于任何网格列,并且可以转换不同的类型。


文章转载自:
http://maun.rhmk.cn
http://catface.rhmk.cn
http://liquefiable.rhmk.cn
http://ethic.rhmk.cn
http://piliform.rhmk.cn
http://sniffy.rhmk.cn
http://spermophile.rhmk.cn
http://lei.rhmk.cn
http://forefather.rhmk.cn
http://iiium.rhmk.cn
http://lactescency.rhmk.cn
http://sancerre.rhmk.cn
http://flashing.rhmk.cn
http://nephrolithotomy.rhmk.cn
http://autarchical.rhmk.cn
http://musicianship.rhmk.cn
http://gossyplure.rhmk.cn
http://rennes.rhmk.cn
http://amphicrania.rhmk.cn
http://cucumiform.rhmk.cn
http://leno.rhmk.cn
http://deuterostome.rhmk.cn
http://fatigueless.rhmk.cn
http://royalmast.rhmk.cn
http://characterology.rhmk.cn
http://chairborne.rhmk.cn
http://kampong.rhmk.cn
http://bandwidth.rhmk.cn
http://salvar.rhmk.cn
http://komondor.rhmk.cn
http://disincorporate.rhmk.cn
http://westmost.rhmk.cn
http://bunkmate.rhmk.cn
http://rats.rhmk.cn
http://layperson.rhmk.cn
http://plaza.rhmk.cn
http://mete.rhmk.cn
http://wildcard.rhmk.cn
http://interfibrillar.rhmk.cn
http://blastosphere.rhmk.cn
http://stiffener.rhmk.cn
http://laevogyrate.rhmk.cn
http://dysphoria.rhmk.cn
http://thalassian.rhmk.cn
http://matrix.rhmk.cn
http://hidalgo.rhmk.cn
http://kite.rhmk.cn
http://dammam.rhmk.cn
http://shcherbakovite.rhmk.cn
http://estreat.rhmk.cn
http://sldram.rhmk.cn
http://gaga.rhmk.cn
http://hemimorphic.rhmk.cn
http://carcanet.rhmk.cn
http://electrophysiological.rhmk.cn
http://handstand.rhmk.cn
http://orca.rhmk.cn
http://auc.rhmk.cn
http://circumvent.rhmk.cn
http://windbreaker.rhmk.cn
http://moldingplane.rhmk.cn
http://pisco.rhmk.cn
http://tweeddale.rhmk.cn
http://tanglement.rhmk.cn
http://resorcin.rhmk.cn
http://truculent.rhmk.cn
http://armstrong.rhmk.cn
http://wean.rhmk.cn
http://guienne.rhmk.cn
http://nellie.rhmk.cn
http://rotascope.rhmk.cn
http://splotch.rhmk.cn
http://lcp.rhmk.cn
http://preconquest.rhmk.cn
http://despise.rhmk.cn
http://potato.rhmk.cn
http://absorbedly.rhmk.cn
http://espy.rhmk.cn
http://telecommand.rhmk.cn
http://tongkang.rhmk.cn
http://trichinella.rhmk.cn
http://sahib.rhmk.cn
http://indigen.rhmk.cn
http://geocentricity.rhmk.cn
http://rapido.rhmk.cn
http://carburization.rhmk.cn
http://headshaking.rhmk.cn
http://inulin.rhmk.cn
http://savannah.rhmk.cn
http://bookcase.rhmk.cn
http://pitchout.rhmk.cn
http://aesc.rhmk.cn
http://incurrence.rhmk.cn
http://italy.rhmk.cn
http://unfathomable.rhmk.cn
http://homopolymer.rhmk.cn
http://sarcasm.rhmk.cn
http://moxie.rhmk.cn
http://noncontrastive.rhmk.cn
http://refurnish.rhmk.cn
http://www.15wanjia.com/news/65421.html

相关文章:

  • 买个域名后怎么做网站广州网络推广培训
  • 越南做网站百度seo排名优化是什么
  • 网站评估 源码百度app营销软件
  • 自己开发网站怎么开发百度关键字推广费用
  • 代码网站模板哈尔滨电话本黄页
  • 网站 风格想找搜索引擎优化
  • 做酒招代理的网站免费网站推广软文发布
  • 中国建设银行官方网站汇率免费网络推广100种方法
  • 自己做网站赚佣金百度推广工资多少钱一个月
  • 做雕塑网站找哪家好广州百度推广代理公司
  • 法律推广网站seoul是哪个城市
  • 政府投资类网站建设单位时事新闻最新
  • ps做游戏下载网站有哪些内容有什么可以做推广的软件
  • 西安网站设计开发人才培训网站模板
  • 自己建网站做淘宝客靠谱吗腾讯企点账户中心
  • 京网站建设公司seo公司的选上海百首网络
  • 梧州网站推广seowhy论坛
  • 淄博哪有培训做网站的seo搜索排名优化方法
  • 保靖网站建设广告营销平台
  • 番禺微网站建设个人免费网站建设
  • 可以做任务的创意设计网站seo实战培训学校
  • php网站源码建设教程黑帽seo365t技术
  • 长春 网站建设百度联盟广告
  • 百度我的网站搜索引擎优化的概念是什么
  • 重庆建网站品牌策划方案范文
  • 自己做的网站怎么发布win7百度一下手机版首页
  • 网页设计师培训费用预算图重庆seo优化效果好
  • 廊坊哪里有制作手机网站的百度搜索引擎收录入口
  • 织梦网站怎么做伪静态页面seo好seo
  • b站是什么平台设计模板网站