Adding multiple custom properties in Visual WebPart
First of all, you should be aware of the Custom WebPart Property block consists of two sections as below
[WebBrowsable(true),
WebDisplayName("SMTP Server"),
WebDescription("Enter SMTP Server"),
Personalizable(PersonalizationScope.Shared),
System.ComponentModel.Category("Mail Settings")
]
public string SMTPServer{
get;
set;
}
So to define multiple properties in Visual Webpart you have to repeat the full custom property block as per your count of custom property that you need to use as the following:
// First Property
[WebBrowsable(true),
WebDisplayName("SMTP Server"),
WebDescription("Enter SMTP Server"),
Personalizable(PersonalizationScope.Shared),
System.ComponentModel.Category("Mail Settings")
]
public string SMTPServer{
get;
set;
}
// Second Property
[WebBrowsable(true),
WebDisplayName("SMTP Port"),
WebDescription("Enter SMTP Port"),
Personalizable(PersonalizationScope.Shared),
System.ComponentModel.Category("Mail Settings")
]
public int SMTPPort{
get;
set;
}
For more details, Please check How to add Custom Property in Visual WebPart?