Inheritance: System.Web.UI.WebControls.CompositeDataBoundControl, IDataItemContainer, INamingContainer, IPostBackEventHandler, IPostBackContainer
    protected void myItemUpdated(object sender, FormViewUpdatedEventArgs e)
    {
        System.Web.UI.WebControls.FormView  formView   = sender as System.Web.UI.WebControls.FormView;
        Obout.Ajax.UI.FileUpload.FileUpload fileUpload = formView.FindControl("fileUpload1") as Obout.Ajax.UI.FileUpload.FileUpload;
        if (fileUpload != null)
        {
            if (fileUpload.PostedFiles.Count > 0)
            {
                string result = "";
                foreach (PostedFileInfo info in fileUpload.PostedFiles)
                {
                    // Here you can place the code to save uploaded files
                    //

                    if (result.Length == 0)
                    {
                        result  = "<b>Uploaded files:</b><br><br>";
                        result += "<table border='0' cellspacing='2' cellpadding='2'>";
                        result += "<tr><td style='font-weight: bold; text-align:left;'>File name</td><td style='font-weight: bold; text-align:left;'>Length</td><td style='font-weight: bold; text-align:left;'>Content type</td></tr>";
                    }
                    result += "<tr><td style='text-align:left;'>" + info.FileName + "</td><td style='text-align:left;'>" + info.ContentLength.ToString() + "</td><td style='text-align:left;'>" + info.ContentType + "</td></tr>";
                }
                if (result.Length == 0)
                {
                    result = "No files uploaded";
                }
                else
                {
                    result += "</table>";
                }
                label.Text = result;
            }
        }
    }
 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;
 }
Example #3
0
        public static object ParseItemId(System.Web.UI.Page page, System.Web.UI.WebControls.FormView formView)
        {
            if (!page.IsPostBack)
            {
                if (System.Web.HttpContext.Current.Session["Id"] != null)
                {
                    if (System.Web.HttpContext.Current.Session["Id"].ToString().StartsWith("v", StringComparison.CurrentCulture))
                    {
                        formView.ChangeMode(FormViewMode.ReadOnly);
                    }
                    else if (System.Web.HttpContext.Current.Session["Id"].ToString().StartsWith("e", StringComparison.CurrentCulture))
                    {
                        formView.ChangeMode(FormViewMode.Edit);
                    }
                    else if (System.Web.HttpContext.Current.Session["Id"].ToString().StartsWith("i", StringComparison.CurrentCulture))
                    {
                        formView.ChangeMode(FormViewMode.Insert);
                    }

                    if (
                        (System.Web.HttpContext.Current.Session["Id"].ToString().StartsWith("v", StringComparison.CurrentCulture)) ||
                        (System.Web.HttpContext.Current.Session["Id"].ToString().StartsWith("e", StringComparison.CurrentCulture)) ||
                        (System.Web.HttpContext.Current.Session["Id"].ToString().StartsWith("i", StringComparison.CurrentCulture))
                        )
                    {
                        System.Web.HttpContext.Current.Session["Id"] = System.Web.HttpContext.Current.Session["Id"].ToString().Substring(1);
                    }
                }
            }

            return(System.Web.HttpContext.Current.Session["Id"]);
        }
Example #4
0
        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;
                }
            }
        }
 /// <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);
      }
 }
 protected string extractTextBoxValue(FormView fv,string controlID)
 {
     try
     {
         return (fv.FindControl(controlID) as TextBox).Text;
     }
     catch (NullReferenceException ex)
     {
         return null;
     }
 }
 public FormView BindFormView(FormView grdVGenIn, string strSqlIn)
 {
     objConnection = open_connection();
     if (open_con == true)
     {
         try
         {
             objDataSet = new DataSet();
             objAdapter = new OracleDataAdapter(strSqlIn, objConnection);
             objAdapter.Fill(objDataSet, "tblGrdV");
             grdVGenIn.DataSource = objDataSet.Tables["tblGrdV"].DefaultView;
             grdVGenIn.DataBind();
             gridView_bind = true;
             return grdVGenIn;
         }
         catch (OracleException objError)
         {
             if (objError.Message.Substring(0, 21) == "Table does not exist.")
             {
                 ErrorStr = ErrorMsg(objConnection, "MSG1201");
             }
             else if (objError.Message.Substring(59, 25) == "ORA-00904: invalid column name")
             {
                 ErrorStr = ErrorMsg(objConnection, "MSG1202");
             }
             else
             {
                 ErrorStr = objError.Message;
                 err_flag = true;
             }
             gridView_bind = false;
             return null;
         }
         finally
         {
             objConnection.Close();
             objConnection.Dispose();
             objAdapter.Dispose();
         }
     }
     else
     {
         return null;
     }
 }
Example #8
0
 public void Build(FormView form, IConfigurationSection section, IBinder binder, IDictionary<string, object> boundControls, IDictionary<string, object> dataSources)
 {
     if (null == form)
     {
         throw new ArgumentNullException("form");
     }
     if (null == section)
     {
         throw new ArgumentNullException("section");
     }
     if (null == binder)
     {
         throw new ArgumentNullException("binder");
     }
     this._boundControls = boundControls;
     this._boundControls.Clear();
     this._dataSources = dataSources;
     this._dataSources.Clear();
     form.EditItemTemplate = new TemplateHelper(this.BuildItemTemplate(section, binder, FormViewMode.Edit), section);
 }
		/// <summary>
		/// Sets the data-entry mode of the specified <see cref="FormView"/> object based
		/// on whether or not the <see cref="HttpRequest"/> parameter value is null.
		/// </summary>
		/// <param name="formView">A <see cref="FormView"/> object.</param>
		/// <param name="requestParameterName">The <see cref="HttpRequest"/> parameter name.</param>
		public static void SetDefaultMode(FormView formView, String requestParameterName)
		{
			if ( String.IsNullOrEmpty(HttpContext.Current.Request[requestParameterName]) )
			{
				formView.DefaultMode = FormViewMode.Insert;
				HideButton(formView, "UpdateButton");
			}
			else
			{
				formView.DefaultMode = FormViewMode.Edit;
				HideButton(formView, "InsertButton");
			}
		}
		/// <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);
					}
				}
			}
		}
		public void FormView_GetPostBackOptions_Null_Argument () {
			FormView fv = new FormView ();
			fv.Page = new Page ();
			PostBackOptions options = ((IPostBackContainer) fv).GetPostBackOptions (null);
		}
 public FormView ClearFormView(FormView grdVGenIn)
 {
     grdVGenIn.DataSource = null;
     grdVGenIn.DataBind();
     return null;
 }
		/// <summary>
		/// Redirect the client to a new URL after an update or cancel operation.
		/// </summary>
		/// <param name="formView">A <see cref="FormView"/> object.</param>
		/// <param name="url">The target location.</param>
		public static void RedirectAfterUpdateCancel(FormView formView, String url)
		{
			RedirectAfterUpdateCancel(formView, url, null);
		}
		/// <summary>
		/// Redirects the client to a new URL after the ItemCommand event of
		/// the <see cref="FormView"/> object has been raised with a CommandName
		/// of "Cancel".
		/// </summary>
		/// <param name="formView">A <see cref="FormView"/> object.</param>
		/// <param name="url">The target location.</param>
		/// <param name="dataSource">The associated <see cref="ILinkedDataSource"/> object.</param>
		public static void RedirectAfterCancel(FormView formView, String url, ILinkedDataSource dataSource)
		{
			formView.ItemCommand += new FormViewCommandEventHandler(
				delegate(object sender, FormViewCommandEventArgs e)
				{
					// cancel button
					if ( String.Compare("Cancel", e.CommandName, true) == 0 )
					{
						Redirect(url, dataSource);
					}
				}
			);
		}
 /// <summary>
 /// Redirects the client to a new URL after the ItemDeleted event of
 /// the <see cref="FormView"/> object has been raised.
 /// </summary>
 /// <param name="formView">A <see cref="FormView"/> object.</param>
 /// <param name="url">The target location.</param>
 /// <param name="dataSource">The associated <see cref="ILinkedDataSource"/> object.</param>
 public static void RedirectAfterDelete(FormView formView, String url, ILinkedDataSource dataSource)
 {
     formView.ItemDeleted += new FormViewDeletedEventHandler(
         delegate(object sender, FormViewDeletedEventArgs e)
         {
             Redirect(url, dataSource, e.Exception);
         }
     );
 }
		public void FormViewRow_BubbleEvent ()
		{
			FormView fv = new FormView ();
			PokerFormViewRow row = new PokerFormViewRow (2, DataControlRowType.Footer, DataControlRowState.Insert);
			Button bt=new Button ();
			fv.Controls.Add (row);			
			CommandEventArgs com=new CommandEventArgs (new CommandEventArgs ("Delete",null));
			fv.ItemDeleting += new FormViewDeleteEventHandler (R_DataBinding);
			Assert.AreEqual (false, dataDeleting, "BeforeBubbleEvent");
			row.DoOnBubbleEvent (row,com);
			Assert.AreEqual (true, dataDeleting, "AfterBubbleEvent");
			fv.ChangeMode (FormViewMode.Insert); 
			com = new CommandEventArgs (new CommandEventArgs ("Insert", null));
			fv.ItemInserting += new FormViewInsertEventHandler (dv_ItemInserting);
			Assert.AreEqual (false, dataInserting, "BeforeInsertBubbleEvent");
			row.DoOnBubbleEvent (row, com);
			Assert.AreEqual (true, dataInserting, "AfterInsertBubbleEvent");
			fv.ChangeMode (FormViewMode.Edit);
			com = new CommandEventArgs (new CommandEventArgs ("Update", null));
			fv.ItemUpdating += new FormViewUpdateEventHandler (dv_ItemUpdating);
			Assert.AreEqual (false, dataUpdating, "BeforeUpdateBubbleEvent");
			row.DoOnBubbleEvent (row, com);
			Assert.AreEqual (true, dataUpdating, "AfterUpdateBubbleEvent");
			fv.ItemUpdating += new FormViewUpdateEventHandler (dv_ItemUpdating);

  
		}
Example #17
0
 /// <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;
 }
Example #18
0
 /// <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;
 }
Example #19
0
        protected override void OnInit(EventArgs e)
        {
            LinkButton dummyLink = new LinkButton();
            dummyLink.ID = "dummyLink";
            this.Controls.Add(dummyLink);
            UpdatePanelDynamic linkUpdatePanel = new UpdatePanelDynamic();
            this.Controls.Add(linkUpdatePanel);
            _link = new LinkButton();
            _link.ID = "selectorLauncher";
            _link.Text = "";
            linkUpdatePanel.ContentTemplateContainer.Controls.Add(_link);
            this.Link.Click += new EventHandler(Link_Click);
            _container = new Panel();
            _container.ID = "selectorContainer";
            _container.CssClass = "selector_modalPopup";
            _container.Style.Add("display", "none");
            _searchPanel = new Panel();
            _searchPanel.ID = "searchPanel";
            _searchPanel.CssClass = "selector_searchpanel";
            _container.Controls.Add(_searchPanel);
            _buttonsPanel = new Panel();
            _buttonsPanel.ID = "buttonsPanel";
            _buttonsPanel.CssClass = "selector_buttonspanel";
            _container.Controls.Add(_buttonsPanel);
            this.UpdatePanel = new UpdatePanelDynamic();
            this.UpdatePanel.ID = "updatePanel";
            this.resultsSelectedIndexHidden = new HiddenField();
            this.resultsSelectedIndexHidden.ID = "resultsSelectedIndexHidden";
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(this.resultsSelectedIndexHidden);
            visibilityHidden = new HiddenField();
            visibilityHidden.ID = "visibilityHidden";
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(visibilityHidden);
            _titleLabel = new Label();
            _titleLabel.CssClass = "selector_title";
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(_titleLabel);
            _criteriaDataSource = new DataTableDataSource();
            _criteriaDataSource.ID = "criteriaDataSource";
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(_criteriaDataSource);
            Panel criteriaPanel = new Panel();
            criteriaPanel.CssClass = "selector_criteriaPanel";
            _criteria = new FormView();
            _criteria.ID = "Criteria";
            _criteria.CssClass = "selector_criteria";
            _criteria.DefaultMode = FormViewMode.Edit;
            criteriaPanel.Controls.Add(_criteria);
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(criteriaPanel);
            Panel searchButtonPanel = new Panel();
            searchButtonPanel.CssClass = "selector_searchButtonPanel";
            _searchButton = new OneClickButton();
            _searchButton.ID = "searchButton";
            _searchButton.Text = _searchText;
            _searchButton.Click += new EventHandler(this.searchButton_Click);
            searchButtonPanel.Controls.Add(_searchButton);
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(searchButtonPanel);
            Panel resultsContainer = new Panel();
            resultsContainer.ID = "resultsContainer";
            resultsContainer.CssClass = "selector_results";
            _results = new DataGridView();
            _results.ID = "Results";
            _results.AutoGenerateSelectButton = true;

            if (null != _selectorSource)
                _results.DataSource = _selectorSource;

            resultsContainer.Controls.Add(_results);
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(resultsContainer);
            _searchPanel.Controls.Add(this.UpdatePanel);
            _okButton = new Button();
            _okButton.ID = "okButton";
            _okButton.Text = _okText;
            _buttonsPanel.Controls.Add(_okButton);
            _cancelButton = new Button();
            _cancelButton.ID = "cancelButton";
            _cancelButton.Text = _cancelText;
            _buttonsPanel.Controls.Add(_cancelButton);
            this.Controls.Add(_container);
            _container.DefaultButton = "searchButton";
            this.PopupExtender = new ModalPopupExtender();
            this.PopupExtender.ID = "popupExtender";
            this.PopupExtender.TargetControlID = "dummyLink";
            this.PopupExtender.PopupControlID = "selectorContainer";
            this.PopupExtender.BackgroundCssClass = "selector_modalBackground";
            this.PopupExtender.OkControlID = "okButton";
            this.PopupExtender.CancelControlID = "cancelButton";
            this.PopupExtender.DropShadow = true;
            this.PopupExtender.PopupDragHandleControlID = "selectorContainer";
            this.Controls.Add(this.PopupExtender);

            if (this.shouldShow)
                this.DoShow();
            if (this.shouldHide)
                this.DoHide();

            base.OnInit(e);
            this.Results.SelectedIndexChanged += new EventHandler(this.Results_SelectedIndexChanged);
        }
Example #20
0
 public static void UpdateItemId(object value, System.Web.UI.WebControls.FormView formView)
 {
     System.Web.HttpContext.Current.Session["Id"] = value;
     formView.DefaultMode = FormViewMode.Edit;
 }
		/// <summary>
		/// Sets the values to update using the specified names and values.
		/// </summary>
		/// <param name="formView">A <see cref="FormView"/> object.</param>
		/// <param name="names">The property names.</param>
		/// <param name="values">The property values.</param>
		public static void SetOnUpdating(FormView formView, String[] names, Object[] values)
		{
			formView.ItemUpdating += new FormViewUpdateEventHandler(
				delegate(object sender, FormViewUpdateEventArgs e)
				{
					SetValues(e.NewValues, names, values);
				}
			);
		}
		/// <summary>
        /// Redirects the client to a new URL after the ItemDeleted event of
        /// the <see cref="FormView"/> object has been raised.
        /// </summary>
        /// <param name="formView">A <see cref="FormView"/> object.</param>
        /// <param name="url">The target location.</param>
        public static void RedirectAfterDelete(FormView formView, String url)
        {
            RedirectAfterDelete(formView, url, null);
        }
		/// <summary>
		/// Redirect the client to a new URL after an insert, update, or cancel operation.
		/// </summary>
		/// <param name="formView">A <see cref="FormView"/> object.</param>
		/// <param name="url">The target location.</param>
		/// <param name="dataSource">The associated <see cref="ILinkedDataSource"/> object.</param>
		public static void RedirectAfterInsertUpdateCancel(FormView formView, String url, ILinkedDataSource dataSource)
		{
			RedirectAfterInsert(formView, url, dataSource);
			RedirectAfterUpdate(formView, url, dataSource);
			RedirectAfterCancel(formView, url, dataSource);
		}
 /// <summary>
 /// Redirects the client to a new URL after the ItemDeleted event of
 /// the <see cref="FormView"/> object has been raised.
 /// </summary>
 /// <param name="formView">A <see cref="FormView"/> object.</param>
 /// <param name="gridView">A <see cref="GridView"/> object.</param>
 /// <param name="url">The target location.</param>
 public static void RedirectAfterDelete(FormView formView, GridView gridView, String url)
 {
     url = GetRedirectUrl(gridView, url);
     RedirectAfterDelete(formView, url);
 }
 /// <summary>
 /// Binds a property's value to a <see cref="FormView" /> child control when the <see cref="FormView"/> is inserting.
 /// </summary>
 /// <param name="formView">A <see cref="FormView"/> object.</param>
 /// <param name="propertyName">The name of the property to bind the value to.</param>
 /// <param name="controlId">The id of child control that contains the desired value.</param>
 public static void BindOnInserting(FormView formView, string propertyName, string controlId)
 {
    if (formView != null)
    {
       formView.ItemInserting += new FormViewInsertEventHandler(
       delegate(object sender, FormViewInsertEventArgs e)
       {
          BindControl(formView, e.Values, propertyName, controlId);
       }
    );
    }
 }
		/// <summary>
		/// Redirects the client to a new URL after the ItemCommand event of
		/// the <see cref="FormView"/> object has been raised with a CommandName
		/// of "New".
		/// </summary>
		/// <param name="formView">A <see cref="FormView"/> object.</param>
		/// <param name="url">The target location.</param>
		public static void RedirectAfterAddNew(FormView formView, String url)
		{
			formView.ItemCommand += new FormViewCommandEventHandler(
				delegate(object sender, FormViewCommandEventArgs e)
				{
					// add button
					if ( String.Compare("New", e.CommandName, true) == 0 )
					{
						Redirect(url);
						HttpContext.Current.Response.End();
					}
				}
			);
		}
Example #27
0
        public static void setInternalValueCheckBox(String CheckBoxId, Boolean value, FormView frm)
        {
            CheckBox t = (CheckBox)frm.FindControl(CheckBoxId);

            if (t != null)
            {
              t.Checked = value;
            }
        }
		/// <summary>
		/// Redirect the client to a new URL after an insert or update operation.
		/// </summary>
		/// <param name="formView">A <see cref="FormView"/> object.</param>
		/// <param name="url">The target location.</param>
		public static void RedirectAfterInsertUpdate(FormView formView, String url)
		{
			RedirectAfterInsertUpdate(formView, url, null);
		}
		public void FormView_GetPostBackOptions_CausesValidation () {
			FormView fv = new FormView ();
			fv.Page = new Page ();
			IButtonControl btn = new Button ();
			Assert.IsTrue (btn.CausesValidation);
			Assert.AreEqual (String.Empty, btn.CommandName);
			Assert.AreEqual (String.Empty, btn.CommandArgument);
			Assert.AreEqual (String.Empty, btn.PostBackUrl);
			Assert.AreEqual (String.Empty, btn.ValidationGroup);
			PostBackOptions options = ((IPostBackContainer) fv).GetPostBackOptions (btn);
		}
		/// <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);
            }
         }
      }
		public void FormView_CurrentMode () {
			FormView view = new FormView ();
			view.DefaultMode = FormViewMode.Insert;
			Assert.AreEqual (FormViewMode.Insert, view.CurrentMode, "FormView_CurrentMode#1");
			view.ChangeMode (FormViewMode.Edit);
			Assert.AreEqual (FormViewMode.Edit, view.CurrentMode, "FormView_CurrentMode#2");
		}
 /// <summary>
 /// Binds a property's value to a <see cref="FormView" /> child control when the <see cref="FormView"/> is inserting or updating.
 /// </summary>
 /// <param name="formView">A <see cref="FormView"/> object.</param>
 /// <param name="propertyName">The name of the property to bind the value to.</param>
 /// <param name="controlId">The id of child control that contains the desired value.</param>
 public static void BindOnInsertingUpdating(FormView formView, string propertyName, string controlId)
 {
    BindOnInserting(formView, propertyName, controlId);
    BindOnUpdating(formView, propertyName, controlId);
 }
		public void FormView_GetPostBackOptions () {
			FormView fv = new FormView ();
			fv.Page = new Page ();
			IButtonControl btn = new Button ();
			btn.CausesValidation = false;
			Assert.IsFalse (btn.CausesValidation);
			Assert.AreEqual (String.Empty, btn.CommandName);
			Assert.AreEqual (String.Empty, btn.CommandArgument);
			Assert.AreEqual (String.Empty, btn.PostBackUrl);
			Assert.AreEqual (String.Empty, btn.ValidationGroup);
			PostBackOptions options = ((IPostBackContainer) fv).GetPostBackOptions (btn);
			Assert.IsFalse (options.PerformValidation);
			Assert.IsFalse (options.AutoPostBack);
			Assert.IsFalse (options.TrackFocus);
			Assert.IsTrue (options.ClientSubmit);
			Assert.IsTrue (options.RequiresJavaScriptProtocol);
			Assert.AreEqual ("$", options.Argument);
			Assert.AreEqual (null, options.ActionUrl);
			Assert.AreEqual (null, options.ValidationGroup);
			Assert.IsTrue (object.ReferenceEquals (options.TargetControl, fv));

			btn.ValidationGroup = "VG";
			btn.CommandName = "CMD";
			btn.CommandArgument = "ARG";
			btn.PostBackUrl = "Page.aspx";
			Assert.IsFalse (btn.CausesValidation);
			Assert.AreEqual ("CMD", btn.CommandName);
			Assert.AreEqual ("ARG", btn.CommandArgument);
			Assert.AreEqual ("Page.aspx", btn.PostBackUrl);
			Assert.AreEqual ("VG", btn.ValidationGroup);
			options = ((IPostBackContainer) fv).GetPostBackOptions (btn);
			Assert.IsFalse (options.PerformValidation);
			Assert.IsFalse (options.AutoPostBack);
			Assert.IsFalse (options.TrackFocus);
			Assert.IsTrue (options.ClientSubmit);
			Assert.IsTrue (options.RequiresJavaScriptProtocol);
			Assert.AreEqual ("CMD$ARG", options.Argument);
			Assert.AreEqual (null, options.ActionUrl);
			Assert.AreEqual (null, options.ValidationGroup);
		}