Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > drop down View modes: 
User avatar
Member
Member
sdonthineni-allianceglobalservices - 7/20/2012 8:40:15 AM
   
drop down
I want to develop a form control

I have 2 drop down boxes(countries, states)

when i select the particular country the correspodning states should be displayed.

when i select a value in drop down box corresponding values should be dispalyed in the other drop box..

can any one suggest me the approach

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 7/20/2012 8:54:06 AM
   
RE:drop down
http://devnet.kentico.com/docs/devguide/index.html?developing_form_controls.htm

Create a custom form control, maybe call it CountryState selector.

In your custom control, create a property that will allow you to tell it the name of the document field for the "State" value.

In your custom control, add both drop downs and the logic to select the country and states.

Override the GetOtherValues method of the custom control and have it return the value of the selected state for the field name set for "State"

In your custom document type that will use this control, add 2 fields, one for country, the other for state.

Choose your custom form control for the Country field and set the property for the State field name to whatever you call it in the custom document type.

Make the field for State not visible in the editing form. Also make sure that it is not set to be a required field.

Now when you select a country and state and save the document, the values from your custom form control will be saved in the country and state fields of your document.

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 7/20/2012 8:55:55 AM
   
RE:drop down
Here is example code for the GetOtherValues method:

public override object[,] GetOtherValues()
{
if (!String.IsNullOrEmpty(StateFieldName))
{
object[,] result = new object[1, 2];
result[0, 0] = StateFieldName;
result[0, 1] = selectedStateName; //this is the variable that you will need to set to your selected state name.
return result;
}
else
{
return base.GetOtherValues();
}
}

User avatar
Member
Member
sdonthineni-allianceglobalservices - 7/20/2012 8:59:55 AM
   
RE:drop down
WindowHelper.Add("Category", selectedValue, false);

does that not help me

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 7/20/2012 9:06:43 AM
   
RE:drop down
I'm not sure. I've never used that before.

I would do it the way I described. It isn't difficult, especially if you are already creating a custom form control.

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 7/20/2012 9:08:31 AM
   
RE:drop down
Refer to this forum post for version 5. It is still quite relevant.

http://devnet.kentico.com/Forums.aspx?forumid=45&threadid=23379