Possible Duplicate:
How to validate Web Part property value?
below is a custom prop and a code that i am using for my custom web part, my question is, how to validate a custom web part and my requirement is that, when the user enter WebPartContentLink
link i want to make sure that it starts with http://
any idea how to implement ?
private string _webPartContentLink = null;
[Personalizable(PersonalizationScope.Shared)]
[WebBrowsable(true)]
[System.ComponentModel.Category("Services")]
[WebDisplayName("Enter WebPart Content Link")]
[WebDescription("Enter WebPart Content Link")]
public string WebPartContentLink
{
get
{
if (_webPartContentLink == null)
{
_webPartContentLink = string.Empty;
}
return _webPartContentLink;
}
set
{
_webPartContentLink = value;
}
}
PageViewerWebPart oWebPart = new PageViewerWebPart();
oWebPart.ContentLink = WebPart.WebPartContentLink.ToString();
Controls.Add(oWebPart);