本文整理汇总了C#中Control.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Control.ToString方法的具体用法?C# Control.ToString怎么用?C# Control.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Control
的用法示例。
在下文中一共展示了Control.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DisplayControls
protected void DisplayControls(Control item, int depth)
{
if (item.Controls != null)
{
Page.Response.Write(new String('-', depth));
Page.Response.Write(item.ToString() + "<br />");
foreach (Control cntrl in item.Controls)
{
DisplayControls(cntrl, depth++);
}
}
else
{
Page.Response.Write(item.ToString() + "<br />");
}
}
示例2: DeriveControlName
public static string DeriveControlName(Control control)
{
if (control != null)
{
try
{
string str = control.ToString();
int i = str.LastIndexOf(".");
return str.Remove(0, i + 1);
}
catch
{
return control.ToString();
}
}
return control.ToString();
}
示例3: FromControl
public static ControlTemplate FromControl(Control control)
{
ControlTemplate ct = new ControlTemplate();
ct.Name = control.Name;
ct.Class = control.ToString();
ct.Properties = new List<PropertyTemplate>
{
new PropertyTemplate("Left", control.Left),
new PropertyTemplate("Top", control.Top),
new PropertyTemplate("MinimumWidth", control.MinimumWidth),
new PropertyTemplate("Height", control.Height),
new PropertyTemplate("Width", control.Width),
new PropertyTemplate("Anchor", (int) control.Anchor),
};
if (control.Text != null)
ct.Properties.Add(new PropertyTemplate("Text", control.Text));
if (control.StayOnBack)
ct.Properties.Add(new PropertyTemplate("StayOnBack", control.StayOnBack));
if (control.Passive)
ct.Properties.Add(new PropertyTemplate("Passive", control.Passive));
if (control is Label)
ct.Properties.Add(new PropertyTemplate("Alignment", (int) (control as Label).Alignment));
//if (control is ImageBox)
// ct.Properties.Add(new PropertyTemplate("Image", (control as ImageBox).Image));
ct.Controls = new List<ControlTemplate>();
foreach (var c in control.Controls)
ct.Controls.Add(FromControl(c));
return ct;
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
parent = messages.GetParentOfType(this.Parent
);
BLItems.navigateCat += new EventHandler(subCatAction);
if (!IsPostBack)
{
switch (parent.ToString())
{
case "orgproducts_aspx":
break;
}
// txtPriceEnd
//if (!IsPostBack)
//{
messages.cnt = 0;
messages.arCats = new String[20];
/// DataSet ds = UpdateDonate("R", "get_Categories", 0, "");
///
BLCustomer cst = (BLCustomer)custs();
DataSet ds = orgs().Category.GetCatList(ref cst, "R", "get_Categories", 0, "");
custs_ = cst;
lstcat.DataSource = ds;
lstcat.DataBind();
lstcat.Items.Insert(0, "All Categories");
//}
}
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (drplstCPage.SelectedIndex == -1)
{ drplstCPage.SelectedValue = BLItems.pager <= 0 ? "1" : BLItems.pager.ToString(); }
if (drplstPageSize.SelectedIndex == -1)
{ drplstPageSize.SelectedValue = items().rowlimit.ToString(); }
TotalPages.Text = (BLItems.totpage).ToString();
///////////////////////////CurrentPage.Text = (BLItems.pager - 1).ToString();
/// messages.navigate += new EventHandler(NavigationLink_Click);
if (!IsPostBack)
{
parent = messages.GetParentOfType(this.Parent);
switch (parent.ToString())
{
case "orgproducts_aspx":
case "ASP.orgproducts_aspx":
case "orgproducts_ascx":
ds = ((BLCustomer)messages.cust).Organization.Orgitems.Items;
////datalist = messages.datalist;
//////// DataTable dataTable = (DataTable)(((BLCustomer)messages.cust).Organization.Orgitems.ItemsDV).Table;
break;
case "auction_aspx":
// messages.DataTable = dataTable;
Response.Redirect("orgproducts.aspx?");
break;
}
////////////if (IsPostBack)
////////////{
//////////// /////////////// DataTable dataTable = messages.DataTable != null ? messages.DataTable : null;
//////////// DataTable dataTable = (DataTable)((DataView)((DataList)this.Parent.FindControl("dtalstItems")).DataSource).Table;
//////////// DataList dtalstItems = (DataList)datalist;
//////////// DataView dv = new DataView();
//////////// dv.Table = dataTable;
//////////// dtalstItems.DataSource = dv;// dataTable;
//////////// dtalstItems.DataBind();
////////////}
}
}