The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
DialogService.ShowDialog
Posted: 14 May 10 9:02 AM
|
Hi all
I can open the AddEditAddress form using the below
DialogService.SetSpecs(500, 400, "AddEditAddress", "QAS Returned Address"); DialogService.ShowDialog();
is there a way I can pre populate some of the fields with data (i.e. with the results I have in an array returned from QAS) |
|
|
|
Re: DialogService.ShowDialog
Posted: 14 May 10 10:13 AM
|
Hi,
You can pass parameters to the dialog:
DialogService.DialogParameters.Add(.....);
You can add an object or an array whatever. When you pick the value up on the dialog (on a quickformload) just cast it as the object you are expecting, something like:
if(DialogService.DialogParameters.ContainsKey("mydialogparam")) { string[] test = (string[])DialogService.DialogParameters["mydialogparam"]; }
Off the top of my head so syntax may differ slightly 
Thanks,
Nick |
|
|
|
Re: DialogService.ShowDialog
Posted: 17 May 10 8:57 AM
|
Thanks for the reply Nick, Syntax seems fine to
next issue
When you click on the address edit button and make a change the address is automatically updated on the account details form. When I call the addEditAddress form from a button on a seperate tab and try to update the address on the account details screen nothing happens. Can someone point me in the right direction as I can not see why? the GetParentEntity() on the onformbound method (AddEditAddress) links to the right client so I though everything else would fall into place.
thanks
Andrew |
|
|
|
Re: DialogService.ShowDialog
Posted: 18 May 10 3:25 AM
|
Hmmm. Strange one. Ensure the dialog is calling a Refresh() when the close event is called. If the refresh() doesnt get called you will never see the chnage on the account detail until you do a full F5.
Thats the first thing to check... |
|
|
|
Re: DialogService.ShowDialog
Posted: 18 May 10 6:42 AM
|
I have tried running the code in debug mode and have found the following
In the method onFormBound the below both point back to the account name I was on. _parentEntity = GetParentEntity() as IPersistentEntity; _parentEntityReference = _parentEntity as IComponentReference;
In the method public override ISmartPartInfo GetSmartPartInfo(Type smartPartInfoType) if (BindingSource != null) - this is not null so moves onto next if if (BindingSource.Current != null) - this is null so does not go into the next code which determines if its a new address or an update
In the method protected void btnSave_ClickAction(object sender, EventArgs e) The below are all null IPersistentEntity persistentEntity = BindingSource.Current as IPersistentEntity; _parentEntity = GetParentEntity() as IPersistentEntity; _parentEntityReference = _parentEntity as IComponentReference; so the if statement is not hit which eventually gets to the save and refresh details.
I don't understand how the bindingsource is not null yet the .current is? also how can the getParentEntity etc contain the account details on form bound yet be null in the save method? |
|
|
|
Re: DialogService.ShowDialog
Posted: 18 May 10 8:35 AM
|
If the BindingSource of the editaddress dialog is null then you cannot be passing the current entity and entityid to it? Check what the Eidt address hyperlink in the Address grid is passing to the edit address dialog and copy that. I assume you are only editing an address not ever adding a new one from your other tab? |
|
|
|
Re: DialogService.ShowDialog
Posted: 18 May 10 8:35 AM
|
If the BindingSource of the editaddress dialog is null then you cannot be passing the current entity and entityid to it? Check what the Eidt address hyperlink in the Address grid is passing to the edit address dialog and copy that. I assume you are only editing an address not ever adding a new one from your other tab? |
|
|
|