03-02-2011 07:46 AM
I need to pop up a dialog from a button on the Insert Account and Insert Contact/Account screen.
When I try to use dialog.ShowMessage, I'm unable to use Carriage returns to format my lengthy list of items that I need to display.
I'm unable to make an Account smart part work from a button as well, it just does nothing when I click.
I need to display a list of Codes and Descriptions, it's about 40 items longs.
Does anyone have any suggestions?
03-02-2011 09:51 AM
03-03-2011 05:39 AM
Hi Mark,
could you post a small sample how to do this and use the ext.dialog thing?
Thanks! Alexander
03-04-2011 07:31 AM
Hey Mark,
I'd greatly appreciate an example of that too.
Thanks,
-Chris
03-04-2011 07:57 AM
03-08-2011 02:24 AM
Hi All,
1. Copy the save business rule code from the InsertAccount.ascx file first and then place it in c# code snippet in the same event.
After that
2. Write the appropriate Condition for which field you want to make madatory or display a message box.
Write the below code
ScriptManager.RegisterClientScriptBlock((Page)HttpContext.Current.Handler, HttpContext.Current.Handler.GetType(), "MyScript5", "alert( 'Phone is Mandatory)", true);
Note: In the above part of code you can replace a string builder object (with alert(''Phone is Mandatory')) which contains a java script function
Thanks,
Jack
03-08-2011 03:50 AM
As said in previous post the power is in the RegisterClientScriptBlock Call to show your dialog.
You can also throw a Sage.Platform.Application.ValidationException(string) with your html encoded string as well. I have done this in a project and using the included class created a somewhat consistent way of doing multi error reporting. Its crude but works well.
so do something like
FormatterErrors errors = ValidateAllRequiredFormValues();
string result = errors.Errors();
if (string.isNullOrEmpty(result)) throw new Sage.Platform.Application.ValidationException(result);
inside of your validation code add the required checks
public FormatterErrors ValidateAllRequiredFormValues() {
FormatterErrors errors =new FormatterErrors();
if (string.IsNullOrEmpty(a.AccountName) errors.AddFormatted("{{Account Name}} is a required Field.");
return errors;
}
Kindest,
Mark