本文整理汇总了C#中System.Web.UI.WebControls.HiddenField.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# HiddenField.GetType方法的具体用法?C# HiddenField.GetType怎么用?C# HiddenField.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.HiddenField
的用法示例。
在下文中一共展示了HiddenField.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindAttributeGroup
/// <summary>
/// Binds the attribute group.
/// </summary>
/// <param name="saveSearchDoc">The save search doc.</param>
/// <param name="SaveSearchXPATH">The save search XPATH.</param>
private void BindAttributeGroup(XmlDocument saveSearchDoc, string saveSearchXPATH)
{
string strLabel;
TextBox objTextBox = new TextBox();
ListBox objListBox = new ListBox();
RadioButton objRadioButton = new RadioButton();
#region SRP Code
DropDownList objDropdownList = new DropDownList();
RadComboBox objRadComboBox = new RadComboBox();
RadioButtonList objRadioButtonList = new RadioButtonList();
HiddenField objHiddenField = new HiddenField();
#endregion
XmlNodeList xmlnodelistAttrGrp = saveSearchDoc.SelectNodes(saveSearchXPATH);
//loop through the save search XML.
foreach(XmlNode xmlnodeAttrGrp in xmlnodelistAttrGrp)
{
try
{
//Get the Control label.
strLabel = xmlnodeAttrGrp.Attributes.GetNamedItem(LABEL).Value.ToString();
}
catch(Exception)
{
strLabel = string.Empty;
}
if(strLabel.Length > 0)
{
//Loop through the controls in page.
foreach(Control objControl in this.Controls)
{
//Loop through the controls in the page's panel.
foreach(Control objChildControl in objControl.Controls)
{
#region RadioButton Control
//Checks whether the control is a radio button or not.
if(string.Compare(objChildControl.GetType().ToString(), objRadioButton.GetType().ToString()) == 0)
{
if(string.Equals(objChildControl.ID, strLabel))
{
((RadioButton)(objChildControl)).Checked = true;
}
}
#endregion RadioButton Control
#region TextBox Control
//Check for TextBox controls in the list.
if(string.Compare(objChildControl.GetType().ToString(), objTextBox.GetType().ToString()) == 0)
{
//if the Control ID matches then it will assign the value.
if(string.Compare(objChildControl.ID, strLabel) == 0)
{
if(string.Compare(xmlnodeAttrGrp.FirstChild.Name, VALUE) == 0)
{
((TextBox)(objChildControl)).Text = xmlnodeAttrGrp.FirstChild.InnerText.ToString();
}
else
{
((TextBox)(objChildControl)).Text = xmlnodeAttrGrp.Attributes.GetNamedItem(VALUE).Value.ToString();
}
}
}
#endregion TextBox Control
#region ListBox Control
//Checks whether the control is a List Box or not.
if(string.Compare(objChildControl.GetType().ToString(), objListBox.GetType().ToString()) == 0)
{
//Checks whether the Id matches with the Label.
if(string.Compare(objChildControl.ID, strLabel) == 0)
{
((ListBox)(objChildControl)).ClearSelection();
XmlNodeList xmlnodelistValue = saveSearchDoc.SelectNodes(saveSearchXPATH + "/value");
//Modification done for Field Issue.
if(!string.Equals(xmlnodeAttrGrp.Attributes.GetNamedItem(CHECKED).Value.ToString(), FALSE))
{
//Loop through the items in the list.
foreach(ListItem lstItems in ((ListBox)(objChildControl)).Items)
{
foreach(XmlNode xmlnodeListBoxItem in xmlnodelistValue)
{
if(string.Compare(xmlnodeListBoxItem.ParentNode.Attributes.GetNamedItem(LABEL).Value.ToString(), strLabel) == 0)
{
//check for the item text and if the value matches then that item will be selected.
if(string.Compare(lstItems.Value, xmlnodeListBoxItem.InnerText) == 0)
{
lstItems.Selected = true;
}
}
}
}
}
}
}
#endregion ListBox Control
//.........这里部分代码省略.........
示例2: getHiddenControl
private static HiddenField getHiddenControl(FormField param, string currentValue)
{
HiddenField ctrl = new HiddenField();
ctrl.ID = ctrl.GetType().Name + param.Name;
if (string.IsNullOrEmpty(currentValue))
ctrl.Value = param.DefaultValue;
else
ctrl.Value = currentValue;
return ctrl;
}
示例3: BindInnerAttributeGroup
/// <summary>
/// Binds the inner attribute group.
/// </summary>
/// <param name="saveSearchDoc">The save search doc.</param>
/// <param name="SaveSearchXPATH">The save search XPATH.</param>
private void BindInnerAttributeGroup(XmlDocument saveSearchDoc, string saveSearchXPATH)
{
XmlNodeList xmlnodelistAttrGrp = saveSearchDoc.SelectNodes(saveSearchXPATH);
foreach(XmlNode xmlnodeAttrGrp in xmlnodelistAttrGrp)
{
string strLabel = string.Empty;
try
{
strLabel = xmlnodeAttrGrp.Attributes.GetNamedItem(LABEL).Value.ToString();
}
catch(Exception)
{
strLabel = string.Empty;
}
if(strLabel.Length > 0)
{
foreach(Control objControl in this.Controls)
{
foreach(Control objChildControl in objControl.Controls)
{
RadioButton objRadioButton = new RadioButton();
TextBox objTextBox = new TextBox();
ListBox objListBox = new ListBox();
// SRP Code
DropDownList objDropdownList = new DropDownList();
RadComboBox objRadComboBox = new RadComboBox();
RadioButtonList objRadioButtonList = new RadioButtonList();
HiddenField objHiddenField = new HiddenField();
if(objChildControl.ID != null)
{
//Checks whether the ID is Equal to trDates row.
if(string.Equals(objChildControl.ID.ToString(), "trDates"))
{
foreach(Control objDateControl in objChildControl.Controls)
{
foreach(Control objDatesControl in objDateControl.Controls)
{
#region TextBox Control
//Checks for control type as TextBox.
if(string.Equals(objDatesControl.GetType().ToString(), objTextBox.GetType().ToString()))
{
if(string.Equals(objDatesControl.ID, strLabel))
{
if(xmlnodeAttrGrp.HasChildNodes)
{
if(string.Equals(xmlnodeAttrGrp.FirstChild.Name, VALUE))
{
((TextBox)(objDatesControl)).Text = xmlnodeAttrGrp.FirstChild.InnerText.ToString();
}
}
else
{
((TextBox)(objDatesControl)).Text = xmlnodeAttrGrp.Attributes.GetNamedItem(VALUE).Value.ToString();
}
}
}
#endregion TextBox Control
}
}
}
}
#region RadioButton Control
//Checks for control type as RadioButton.
if(string.Equals(objChildControl.GetType().ToString(), objRadioButton.GetType().ToString()))
{
if(string.Equals(objChildControl.ID, strLabel))
{
((RadioButton)(objChildControl)).Checked = true;
}
}
#endregion RadioButton Control
#region ListBox Control
//Check for ListBox type controls in the list.
if(string.Compare(objChildControl.GetType().ToString(), objListBox.GetType().ToString()) == 0)
{
if(string.Compare(objChildControl.ID, strLabel) == 0)
{
((ListBox)(objChildControl)).ClearSelection();
XmlNodeList xmlnodelistValue = saveSearchDoc.SelectNodes(saveSearchXPATH + "/value");
if(!string.Equals(xmlnodeAttrGrp.Attributes.GetNamedItem(CHECKED).Value.ToString(), FALSE))
{
//Loop through the items in the list.
foreach(ListItem lstItems in ((ListBox)(objChildControl)).Items)
{
foreach(XmlNode xmlnodeListBoxItem in xmlnodelistValue)
{
//check for the item text and if the value matches then that item will be selected.
if(string.Compare(xmlnodeListBoxItem.ParentNode.Attributes.GetNamedItem(LABEL).Value.ToString(), strLabel) == 0)
{
if(string.Compare(lstItems.Value, xmlnodeListBoxItem.InnerText) == 0)
{
lstItems.Selected = true;
}
}
//.........这里部分代码省略.........
示例4: getControlValue
private static string getControlValue(FormField currField, Control container)
{
string res = "";
switch (currField.Type)
{
case FormFieldTypeEnum.Text:
case FormFieldTypeEnum.Numeric:
{
var t1 = new TextBox();
t1 = Utility.FindControlRecursive<TextBox>(container, t1.GetType().Name + currField.Name);
if (t1 != null)
res = t1.Text;
}
break;
case FormFieldTypeEnum.Html:
{
//var t1 = new FCKeditor();
var t1 = new TextBox();
t1 = Utility.FindControlRecursive<TextBox /*FCKeditor*/>(container, t1.GetType().Name + currField.Name);
if (t1 != null)
res = t1.Text;
}
break;
case FormFieldTypeEnum.Combo:
{
var t1 = new DropDownList();
t1 = Utility.FindControlRecursive<DropDownList>(container, t1.GetType().Name + currField.Name);
if (t1 != null)
res = t1.SelectedValue;
}
break;
case FormFieldTypeEnum.Hidden:
case FormFieldTypeEnum.Error:
{
var t1 = new HiddenField();
t1 = Utility.FindControlRecursive<HiddenField>(container, t1.GetType().Name + currField.Name);
if (t1 != null)
res = t1.Value;
}
break;
}
return res;
}