Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can values or parameters be passed into user control?

I haven't used these in awhile. I was just wondering is it possible to pass values or parameters to a user control from the aspx page. Say you register a control and then use it using something like

<uc1:SampleUserControl id="SampleUserControl1" runat="server"></uc1:SampleUserControl> 

style syntax. Can you pass parameters in there?

like image 859
chobo Avatar asked Mar 10 '11 00:03

chobo


People also ask

What is ASPX and ASCX?

aspx: The file extension of Web page. webpage provides a graphical user interface (text, images, buttons, etc.), using which you can design the page which will be rendered to user on browser. . ascx: The file name extension for the user control.


1 Answers

Yes:

<my:Control runat="server" MyPublicProperty="Value1" MyPublicProperty2="Value2"/> 

Any public property can be set in the markup as indicated above. You can get more advanced than this and support child elements, etc. too. See more information.

like image 66
Josh M. Avatar answered Oct 04 '22 20:10

Josh M.