I'm currently using a certain ItemTemplate
for three repeaters that are all on the same page, but they are all bound to different data sources. Is there any way to refactor my web form without using a user control to easily refer to this template so I will only have to define it once?
views:
114answers:
2
+2
A:
No. That's the reason user controls exist, to encapsulate repeating visual components.
Oded
2010-03-11 14:38:46
I don't quite agree. To me, user controls are their own "entities" which can be put just about anywhere and hold their own state, etc. What I was looking for was something similar to a macro.
Deniz Dogan
2010-03-11 14:50:12
A:
yes it's possible, create another asp.net control (ascx) that is having a repeater, create a public method that accepts data table (or list or items) and bind the repeater with that, you will probably get this done in 10mins
public void BindData(DataTable dt)
{
rpt.DataSource = dt;
rpt.DataBind();
}
It will work if your dt has same column names.
lakhlaniprashant.blogspot.com
2010-03-11 14:48:06