Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Nickel Contributor
Posts: 66
Registered: ‎03-30-2009

Edit Address Form

Working for a global company we have a need to change the city picklist based on the country. I see a custom form called EditAddress and have made the changes to this form. However, this form is not the same form used to add address for the account detail or the insert account/contact screen. This form is used to update addresses off the address tab.

 

Does anyone know where the other form is..? Someone told me they thought it might be a control ? How can I make the change needed so that I can get the right picklist associated to the contry on an Insert Account/Contatc form ?

Tuned Listener
Posts: 15
Registered: ‎08-01-2008

Re: Edit Address Form

It is a control and not really too easy to dynamically set the city picklist as far as I know.  I had a simular customization to dynamically set a picklist inside a control OnLoad of the form.  The Add Contact/Account form is a custom form so the form is located in Support Files>Smart Parts>Contact>InsertContact.ascx.  Probably better to edit in Visual Studio so you can get autocomplete, etc.

 

I've only been able to get it to work for the Load event of the form (not the change event of a picklist inside the control).  Maybe with the following code you can figure it out the rest.

 

Add the following to the inline C# in the InsertContact.ascx form.

 

The following updates the city picklist OnLoad of the form:

 

protected void changeCityPicklist()
{
 PickListControl pc = null;
 foreach (Control PanelControl in adrAccountAddress.Controls)
 {
  foreach (Control c in PanelControl.Controls)
  {
   pc = c.FindControl("City") as PickListControl;
  }
 }
 pc.PickListName = "<name of picklist>";
}

 

Basically you have to iterate through the address control's control collection to find the City picklistcontrol, then set the picklist name property of the picklistcontrol.

 

Now add a call to the changeCityPicklist() method in the protected override void OnLoad(EventArgs e) method.

 

There should be a way to add an event to the PicklistValueChanged event of the Country picklist in the AddressControl, but I'm not sure.  Either way, it's not very straight forward.

Nickel Contributor
Posts: 66
Registered: ‎03-30-2009

Re: Edit Address Form

I will give what your suggesting a try. I did notice that the Autopost back for the picklist control was false, if you change it to true you get the change on the picklist value to fire.. you just nee to wire it in also