deleting rows in repeater control

I

Imran Aziz

Hello All,
Is there a way to delete rows from a repeater control using any build in
features?
Imran.
 
C

Craig Deelsnyder

Hello All,
Is there a way to delete rows from a repeater control using any
build in
features?
Imran.

You could delete the row/item from the datasource and rebind...
 
Joined
Jun 30, 2008
Messages
1
Reaction score
0
Using Reflection

If you don't mind using reflection, this works for me:
Code:
//get private field ArrayList in RepeaterItemCollection
var items = repeater.Items.Get<ArrayList>("items");
...
//manipulate items however you want
Get is an extension method I put on Object in my projects to make reflection easy
Code:
public static T Get<T>(this Object obj, String name) {
	BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
	if (obj == null) return default(T);
	var prop = obj.GetType().GetProperty(name, flags);
	if (prop != null) return (T)prop.GetValue(obj, null);
	var field = obj.GetType().GetField(name, flags);
	if (field != null) return (T)field.GetValue(obj);
	return default(T);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top