本文整理汇总了C#中System.Web.UI.WebControls.Label.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Label.GetType方法的具体用法?C# Label.GetType怎么用?C# Label.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.Label
的用法示例。
在下文中一共展示了Label.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLabelXml
/// <summary>
/// 取得label对应的xml
/// </summary>
/// <param name="item">blockfielditem</param>
/// <returns>xml</returns>
private string GetLabelXml(TBlockFieldItem item, String tableName, ref String id)
{
String strLabel = String.Empty;
if (string.Compare(item.ControlType, "refvalbox", true) == 0)
{
WebControl control = null;
PropertyInfo info = null;
if (!string.IsNullOrEmpty(item.RefValNo) || (item.RefField != null))
{
control = new WebRefVal();
control.ID = string.Format("{0}RefVal", item.DataField);
(control as WebRefVal).DataSourceID = GenWebDataSource(item, tableName, "RefVal", string.Empty);
(control as WebRefVal).DataBindingField = item.DataField;
(control as WebRefVal).DataTextField = FSYS_REFVAL.Tables[0].Rows[0]["DISPLAY_MEMBER"].ToString();
(control as WebRefVal).DataValueField = FSYS_REFVAL.Tables[0].Rows[0]["VALUE_MEMBER"].ToString();
(control as WebRefVal).BackColor = System.Drawing.Color.Transparent;
(control as WebRefVal).BorderStyle = BorderStyle.None;
(control as WebRefVal).ReadOnly = true;
(control as WebRefVal).Width = 100;
info = control.GetType().GetProperty("BindingValue");
//id = control.ID;
strLabel = GetControlXml(control, info, item.DataField, item.EditMask);
}
else
{
control = new Label();
control.ID = string.Format("{0}Label", item.DataField);
strLabel = GetControlXml(control, control.GetType().GetProperty("Text"), item.DataField, item.EditMask);
}
//control.ID = string.Format("{0}{1}", control.ID, id);
int i = strLabel.IndexOf("runat=\"server\"");
strLabel = strLabel.Insert(i + 14, " Width=\"100\" BackColor=\"Transparent\"");
}
else
{
//用上面的方法实现
Label label = new Label();
label.ID = string.Format("{0}Label", item.DataField);
strLabel = GetControlXml(label, label.GetType().GetProperty("Text"), item.DataField, item.EditMask);
}
return strLabel;
}
示例2: GetLabelXml
private string GetLabelXml(DataRow dr)
{
String strLabel = String.Empty;
//用上面的方法实现
System.Web.UI.WebControls.Label label = new System.Web.UI.WebControls.Label();
label.ID = string.Format("{0}Label", dr["ColumnName"].ToString());
strLabel = GetControlXml(label, label.GetType().GetProperty("Text"), dr["ColumnName"].ToString(), dr["EditMask"].ToString());
return strLabel;
}