Hello,
I am trying to create a custom property in a extended control, so that it can be acessed in both ASPX and C#. The problem wasn't actually creating it... because i managed to do it, by applying the following code:
public static class Icon
{
public static string activityMonitor = "activityMonitor.png";
public static string addBlankPage = "addBlankPage.png";
public static string addComment = "addComment.png";
public static string addPageTable = "addPageTable.png";
}
public class myButtonIcon : LinkButton
{
public myButtonIcon()
{
}
[Bindable(false)]
[Category("Properties")]
[DefaultValue("")]
[Localizable(true)]
public string IconName { get; set; }
}
However I am sure that this is not the correct way of doing this... for many reasons :(
For example:
I can do: btnIcon.IconName = Icon. //and the names will appear here but they will not appear if I do:
<myControl:myButtonIcon ID="btnTest" runat="server" IconName=" //names do not appear here></myControl:myButtonIcon>
And I am also using two properties instead of using only one... but I tried to combine them in to a single one... but i didn't sucess... so only IconName2 appears in the ASPX.
So... I would really appreciate if you could explain me this better. The code you see here was the result of a long research on the internet and a lot of tries. :(