/// <summary> /// Redirects a client to a new URL and provides the currently selected /// EntityId from the specified <see cref="ILinkedDataSource"/> object; /// This method only redirects if the specified exception is null. /// </summary> /// <param name="url">The target location.</param> /// <param name="dataSource">An <see cref="ILinkedDataSource"/> object.</param> /// <param name="exception">The System.Exception that was thrown, if any.</param> public static void Redirect(String url, ILinkedDataSource dataSource, Exception exception) { if ( exception == null ) { Redirect(url, dataSource); } }
/// <summary> /// Raises the System.Web.UI.Control.Load event. /// </summary> /// <param name="e">The System.EventArgs object that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); // add child controls if (PrimaryMember != null) { this.Controls.Add(PrimaryMember); } if (LinkMember != null) { this.Controls.Add(LinkMember); } if (ReferenceMember != null) { this.Controls.Add(ReferenceMember); } ILinkedDataSource PrimaryDataSource = PrimaryMember.GetLinkedDataSource(); if (PrimaryDataSource != null) { PrimaryDataSource.AfterSelected += new LinkedDataSourceEventHandler(OnAfterSelected); PrimaryDataSource.AfterInserting += new LinkedDataSourceEventHandler(OnAfterInserting); PrimaryDataSource.AfterInserted += new LinkedDataSourceEventHandler(OnAfterInserted); PrimaryDataSource.AfterUpdating += new LinkedDataSourceEventHandler(OnAfterUpdating); PrimaryDataSource.AfterUpdated += new LinkedDataSourceEventHandler(OnAfterUpdated); } }
/// <summary> /// Redirects a client to a new URL and provides the currently selected /// EntityId from the specified <see cref="ILinkedDataSource"/> object. /// </summary> /// <param name="url">The target location.</param> /// <param name="dataSource">An <see cref="ILinkedDataSource"/> object.</param> public static void Redirect(String url, ILinkedDataSource dataSource) { if ( dataSource != null ) { url = String.Format(url, dataSource.GetSelectedEntityId()); } // make sure second argument is false so that unhandled // exceptions bubble up to the application level handler HttpContext.Current.Response.Redirect(url, false); }
/// <summary> /// Redirects the client to a new URL after the ItemInserted or ItemUpdated event of the <see cref="DetailsView"/> /// has been raised or after the ItemCommand event of the <see cref="DetailsView"/> object has /// been raised with a CommandName of "Cancel". /// </summary> /// <param name="view">A <see cref="DetailsView"/> object.</param> /// <param name="url">The target location.</param> /// <param name="dataSource">The associated <see cref="ILinkedDataSource"/> object.</param> public static void RedirectAfterInsertUpdateCancel(DetailsView view, String url, ILinkedDataSource dataSource) { RedirectAfterInsert(view, url, dataSource); RedirectAfterUpdate(view, url, dataSource); RedirectAfterCancel(view, url, dataSource); }
/// <summary> /// Redirects the client to a new URL after the ItemCommand event /// of the <see cref="DetailsView"/> object has been raised with a /// CommandName of "Cancel". /// </summary> /// <param name="view">A <see cref="DetailsView"/> object.</param> /// <param name="url">The target location.</param> /// <param name="dataSource">The associated <see cref="ILinkedDataSource"/> object.</param> public static void RedirectAfterCancel(DetailsView view, String url, ILinkedDataSource dataSource) { view.ItemCommand += new DetailsViewCommandEventHandler( delegate(object sender, DetailsViewCommandEventArgs e) { // cancel button if ( String.Compare("Cancel", e.CommandName, true) == 0 ) { Redirect(url, dataSource); } } ); }
/// <summary> /// Redirects the client to a new URL after the ItemUpdated event /// of the <see cref="DetailsView"/> object has been raised. /// </summary> /// <param name="view">A <see cref="DetailsView"/> object.</param> /// <param name="url">The target location.</param> /// <param name="dataSource">The associated <see cref="ILinkedDataSource"/> object.</param> public static void RedirectAfterUpdate(DetailsView view, String url, ILinkedDataSource dataSource) { view.ItemUpdated += new DetailsViewUpdatedEventHandler( delegate(object sender, DetailsViewUpdatedEventArgs e) { Redirect(url, dataSource, e.Exception); } ); }
/// <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="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); } ); }
/// <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); } } } }