Create a User Control and add below image control inside User Control as:- <asp:ImageButton id="ImageButton1" runat="server"></asp:ImageButton>
Create a property called source:-
public string source
{
get
{
return ImageButton1.ImageUrl;
}
set
{
ImageButton1.ImageUrl = value;
}
}
Now in our webform:
Drag and drop User Control and set the source property as:-
<uc1:UCImageButton source = "view.jpg" Id = "UCImageButton1"
runat = "server"></uc1:UCImageButton>