vijaym Registered: 11/05/09
Posts: 1
|
|
|
Reply with quote | #1 | Issue: I need to check if record already exists. If record already exists then show error message on add screen and do not redirct. If recrod does not exists then, save record and redirect to showtable screen. I have added one property in "BaseApplicationPage.IsDuplicateEntry". which i set true/false in following method of "XXXRecordControl:BaseClientKPIsRecordControl" by overriding SaveData() method. Till here, everything works fine. But issue is url is hard coded inside save method in local variable to method. Now, if i write some custom code to set URL based on "IsDuplicateEntry" property value, which get overrite by iron speed designer. because this method is under " Section 2: Do not modify this section." --------------------------- public void SaveButton_Click_Base(object sender, EventArgs args)
{ string url = @"../ClientKPIs/ShowClientKPIsTable.aspx";// The redirect URL is set on the Properties, Bindings.// The ModifyRedirectURL call resolves the parameters before the// Response.Redirect redirects the page to the URL. // Any code after the Response.Redirect call will not be executed, since the page is// redirected to the URL.bool shouldRedirect = true;string TargetKey;string tk = null;TargetKey = tk; try {// Enclose all database retrieval/update code within a Transaction boundaryDbUtils.StartTransaction(); if (!this.IsPageRefresh){ this.SaveData();} url = this.ModifyRedirectUrl(url, "",false);this.CommitTransaction(sender);} catch (Exception ex) {// Upon error, rollback the transactionthis.RollBackTransaction(sender);shouldRedirect = false;this.ErrorOnPage = true;// Report the error message to the end userBaseClasses.Utils.MiscUtils.RegisterJScriptAlert( this, "BUTTON_CLICK_MESSAGE", ex.Message);} finally {DbUtils.EndTransaction(); } if (shouldRedirect) {this.ShouldSaveControlsToSession = true;this.Response.Redirect(url);} else if (TargetKey != null && !shouldRedirect){this.ShouldSaveControlsToSession = true ; this.CloseWindow(true);} } ----------------------
1. Any guess or hint to fix this issue. 2. Why redirect URLs are hard coded into the class methods, instead it should be read from config file or common class with const string variables.
Thank you. Vijay.
|
| |
akeshgupta
Iron Speed MVP Consulting Organization
Registered: 04/25/04
Posts: 3,991
| |