c# - UserControl with Child Controls passed into a Repeater within the UserControl -
I'm trying to achieve something with lines of
UserControl (MyRepeater )
& lt; P & gt; Start control & lt; / P & gt; & Lt; Asp: Repeater id = "myrepeater" runat = "server" /> & Lt; P & gt; Control end & lt; / P & gt;
page
& lt; P & gt; Start page & lt; / P & gt; & Lt; Uc1: MyEperPeter ID = "MyRepter 1" Runat = "Server" & gt; & Lt; ItemTemplate & gt; & Lt; P & gt; Page item template & lt; / P & gt; & Lt; / ItemTemplate & gt; & Lt; / UC1: MyRepeater & gt; & Lt; P & gt; Page end & lt; / P & gt;
The item from the page object will be used as a replayer's item template within the template.
The reason for this is that we use many repeaters, our applications, each repeater and some related buttons do the same code. I would like to keep this code in one place so that developers can use our custom repeater controls, instead of code every time they are needed.
I have done the same in the past, with a webcroll control by creating a repeater control within the render controls method of my repeater control and everything works as I would expect.
Due to the reason I would like to use a UserControl because there are many types of style / layout changes to make changes between the system, it will be as easy as user control, where HTML / ASP can be edited directly is.
Currently the code behind my user control looks like this. [Purse Childland (false)] [Persist Child (true)] Public Partial Class Myprepeter: System. Web. UI. User control, incoming container {secure zero page_init (object sender, event ergugs e) {myRepeater.ItemTemplate = this .ememTemplate; } Secure Zero Page_load (object sender, eventArgse E) {// temporarily bind to myrepeater.DataSource = Enumerable.Range (1, 5); MyRepeater.DataBind (); } [Default value ("")] [browsable (false)] [permanence mode] [template container (typef (repeater))] public virtual itemplate matmetlet {get; Set; }}
In short, it is not working right now ... The contents of the page item template are provided after the full user control and not within the repeater.
Does anyone indicate where I am going wrong and / or can I tell me in a better direction?
You've got a parse and the raid continues incorrectly.
Comments
Post a Comment