本文整理汇总了C#中System.Web.UI.WebControls.FormView.FindControl方法的典型用法代码示例。如果您正苦于以下问题:C# FormView.FindControl方法的具体用法?C# FormView.FindControl怎么用?C# FormView.FindControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.FormView
的用法示例。
在下文中一共展示了FormView.FindControl方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDdlValue
public int GetDdlValue(FormView fv, string name)
{
var ddl = fv.FindControl(name) as DropDownList;
if (ddl.SelectedValue != null)
return Convert.ToInt32(ddl.SelectedValue);
return -1;
}
示例2: BindControl
/// <summary>
/// Binds a controls value to a property of an entity.
/// </summary>
/// <param name="formView">A <see cref="FormView"/> object.</param>
/// <param name="list">The <see cref="IOrderedDictionary"/> containing the values.</param>
/// <param name="propertyName">The name of the property to bind the value to.</param>
/// <param name="controlId">The id of the control to get the value from.</param>
public static void BindControl(FormView formView, IOrderedDictionary list, string propertyName, string controlId)
{
if (formView != null)
{
Control control = formView.FindControl(controlId);
BindControl(control, list, propertyName);
}
}
示例3: extractTextBoxValue
protected string extractTextBoxValue(FormView fv,string controlID)
{
try
{
return (fv.FindControl(controlID) as TextBox).Text;
}
catch (NullReferenceException ex)
{
return null;
}
}
示例4: LoadUITestDataFromFormView
public static void LoadUITestDataFromFormView(FormView formViewEmployee)
{
TextBox txtFirstName = (TextBox)formViewEmployee.FindControl("txtFirstName");
TextBox txtLastName = (TextBox)formViewEmployee.FindControl("txtLastName");
TextBox txtHireDate = (TextBox)formViewEmployee.FindControl("txtHireDate");
TextBox txtAddress = (TextBox)formViewEmployee.FindControl("txtAddress");
TextBox txtHomePhone = (TextBox)formViewEmployee.FindControl("txtHomePhone");
DropDownList ddlCountry = (DropDownList)formViewEmployee.FindControl("ddlCountry");
//since in read-only mode there is no text box control
if (formViewEmployee.CurrentMode != FormViewMode.ReadOnly)
{
////using data value in form in custom way
//populating per-fill data
if (formViewEmployee.CurrentMode == FormViewMode.Insert)
{
txtFirstName.Text = "Ashraful";
txtLastName.Text = "Alam";
txtHireDate.Text = DateTime.Now.ToString();
txtAddress.Text = "One Microsoft Way";
txtHomePhone.Text = "912200022";
ddlCountry.Items.FindByText("USA").Selected = true;
}
}
}
示例5: SetDefaultValue
/// <summary>
/// Sets the default value of the control with the specified id parameter when
/// the <see cref="FormView"/> is in Insert mode.
/// </summary>
/// <param name="formView">The form view.</param>
/// <param name="controlID">The control ID.</param>
/// <param name="value">The value.</param>
public static void SetDefaultValue(FormView formView, String controlID, String value)
{
if (formView != null && formView.CurrentMode == FormViewMode.Insert)
{
Control control = formView.FindControl(controlID);
if (control != null)
{
SetValue(control, value);
}
}
}
示例6: InitPassword
/// <summary>
/// Initializes a password <see cref="TextBox"/> control with the current value.
/// </summary>
/// <param name="formView">A <see cref="FormView"/> object.</param>
/// <param name="controlId">The control's ID property value.</param>
/// <param name="dataSource">The associated <see cref="ILinkedDataSource"/> object.</param>
/// <param name="propertyName">The property name that the <see cref="TextBox"/> is bound to.</param>
public static void InitPassword(FormView formView, String controlId, ILinkedDataSource dataSource, String propertyName)
{
if ( formView != null && !formView.Page.IsPostBack && dataSource != null &&
!String.IsNullOrEmpty(controlId) && !String.IsNullOrEmpty(propertyName) )
{
TextBox input = formView.FindControl(controlId) as TextBox;
if ( input != null )
{
Object entity = dataSource.GetCurrentEntity();
if ( entity != null )
{
String password = EntityUtil.GetPropertyValue(entity, propertyName) as String;
InitPassword(input, password);
}
}
}
}
示例7: getInternalValueFromForm
/// <summary>
/// Devuelve el valor de la propiedad Text de un TextBox contenido dentro de un FormView o un valor por defecto en caso no encontrarlo.
/// </summary>
/// <param name="f">FormView del cual se quiere sacar el valor del campo de texto</param>
/// <param name="Id">String Id del TextBox dentro del FormView</param>
/// <param name="DefaultValue">El valor por defecto en caso de no encontrar el DropDownList en el FormView</param>
/// <returns>El valor de la propiedad Text del TextBox pasado como parametro o null si no lo encuentra.</returns>
public static String getInternalValueFromForm(FormView f, String Id, String DefaultValue)
{
TextBox t = (TextBox)f.FindControl(Id);
if (t != null)
{
return t.Text;
}
else return DefaultValue;
}
示例8: getInternalValueFromDropDownList
/// <summary>
/// Devuelve el valor de la propiedad SelectedValue de un DropDownList contenido en un FormView o un valor por defecto
/// </summary>
/// <param name="frm">FormView que contiene el DropDownList</param>
/// <param name="cbxName">Id del DropDownList contenido en el FormView</param>
/// <param name="DefaultValue">El valor por defecto a devolver en caso no encontrar el componente</param>
/// <returns>El valor de la propiedad SelectedValue o cadena vacía en caso no encontrarlo</returns>
public static String getInternalValueFromDropDownList(FormView frm, string cbxName, String DefaultValue)
{
DropDownList cbx = (DropDownList)frm.FindControl(cbxName);
if (cbx != null) return cbx.SelectedValue;
else return DefaultValue;
}
示例9: setInternalValueCheckBox
public static void setInternalValueCheckBox(String CheckBoxId, Boolean value, FormView frm)
{
CheckBox t = (CheckBox)frm.FindControl(CheckBoxId);
if (t != null)
{
t.Checked = value;
}
}
示例10: setInternalValueASB
public static void setInternalValueASB(String ASBId, String value, FormView frm)
{
ASB.AutoSuggestBox t = null;
try
{
t = (ASB.AutoSuggestBox)frm.FindControl(ASBId);
}
catch (Exception ex)
{
LoggerFacade.LogException(ex);
t = null;
}
if (t != null)
{
t.SelectedValue = value;
}
}
示例11: setInternalValue
public static void setInternalValue(String TextBoxId, String value, FormView frm)
{
TextBox t = frm.FindControl(TextBoxId) as TextBox;
if (t != null)
{
t.Text = value;
}
}
示例12: getInternalValueFromFormCheckBox
/// <summary>
/// Devuelve el valor de la propiedad Text de un CheckBox contenido dentro de un FormView.
/// </summary>
/// <param name="f">FormView del cual se quiere sacar el valor del campo de texto</param>
/// <param name="Id">String Id del TextBox dentro del FormView</param>
/// <returns>El valor de la propiedad Text del CheckBox pasado como parametro o null si no lo encuentra.</returns>
public static Boolean getInternalValueFromFormCheckBox(FormView f, String Id)
{
CheckBox t = (CheckBox)f.FindControl(Id);
if (t != null)
{
return t.Checked;
}
else return false;
}
示例13: getInternalTextFromDropDownList
/// <summary>
/// Devuelve el valor de la propiedad Text del Item Seleccionado de un DropDownList contenido en un FormView
/// </summary>
/// <param name="frm">FormView que contiene el DropDownList</param>
/// <param name="cbxName">Id del DropDownList contenido en el FormView</param>
/// <returns>El valor de la propiedad Text o null</returns>
public static String getInternalTextFromDropDownList(FormView frm, string cbxName)
{
DropDownList cbx = (DropDownList)frm.FindControl(cbxName);
if (cbx != null) return cbx.SelectedItem.Text;
else return null;
}