本文整理汇总了C#中System.Web.UI.WebControls.WebParts.WebPartManager.FindControl方法的典型用法代码示例。如果您正苦于以下问题:C# WebPartManager.FindControl方法的具体用法?C# WebPartManager.FindControl怎么用?C# WebPartManager.FindControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.WebParts.WebPartManager
的用法示例。
在下文中一共展示了WebPartManager.FindControl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildCommand
private SqlCommand BuildCommand(IConfigurationElement commandElement, IBinder binder, WebPartManager manager)
{
SqlCommand command = new SqlCommand();
foreach (IConfigurationElementAttribute attribute in commandElement.Attributes.Values)
{
ReflectionServices.SetValue(command, attribute.ConfigKey, attribute.Value);
}
IBindingItemsCollection bindingParams = binder.NewBindingItemCollectionInstance();
binder.BindingSet.Add(commandElement.ConfigKey, bindingParams);
foreach (IConfigurationElement parameterElement in commandElement.Elements.Values)
{
SqlParameter parameter = new SqlParameter();
foreach (IConfigurationElementAttribute parameterAttribute in parameterElement.Attributes.Values)
{
if ("bind" == parameterAttribute.ConfigKey)
{
string bindstring = parameterAttribute.Value.ToString();
bool isOutput = parameterElement.Attributes.ContainsKey("Direction") &&
("Output" == parameterElement.GetAttributeReference("Direction").Value.ToString() ||
"InputOutput" == parameterElement.GetAttributeReference("Direction").Value.ToString());
if (bindstring.Contains("."))
{
string sourcestring = bindstring.Substring(0, bindstring.IndexOf("."));
IBindingItem bindingItem = binder.NewBindingItemInstance();
if (!isOutput)
{
bindingItem.Source = manager.FindControl(sourcestring);
bindingItem.SourceProperty = bindstring.Substring(sourcestring.Length + 1);
bindingItem.Target = parameter;
bindingItem.TargetProperty = "Value";
}
else
{
bindingItem.Target = manager.FindControl(sourcestring);
bindingItem.TargetProperty = bindstring.Substring(sourcestring.Length + 1);
bindingItem.Source = parameter;
bindingItem.SourceProperty = "Value";
}
bindingParams.Add(bindingItem);
}
}
else
{
ReflectionServices.SetValue(parameter, parameterAttribute.ConfigKey, parameterAttribute.Value);
}
}
if (null == parameter.Value)
{
parameter.Value = DBNull.Value;
}
command.Parameters.Add(parameter);
}
return command;
}