Create a User Control
Below Code goes in User Control
<asp:ImageButton id='ImageButton1' runat='server'></asp:ImageButton>
Create a property called source
VB.NET
Public Property source() As String
Get
Return ImageButton1.ImageUrl
End Get
Set(ByVal Value As String)
ImageButton1.ImageUrl = Value
End Set
End Property
C#
public string source
{
get
{
return ImageButton1.ImageUrl;
}
set
{
ImageButton1.ImageUrl = value;
}
}
Now in your webform:
Drag and drop User Control and set the source property.
<uc1:UCImageButton source='b2346.jpg' id='UCImageButton1' runat='server'></uc1:UCImageButton>
Share with