Passing a parameter to a User Control,

vishalneeraj-24503
Posted by vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 843
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>

Comments or Responses

Login to post response