deleting rows in repeater control

Discussion in 'ASP .Net' started by Imran Aziz, Aug 4, 2005.

  1. Imran Aziz

    Imran Aziz Guest

    Hello All,
    Is there a way to delete rows from a repeater control using any build in
    features?
    Imran.
     
    Imran Aziz, Aug 4, 2005
    #1
    1. Advertising

  2. On Thu, 04 Aug 2005 10:14:34 -0500, Imran Aziz <> wrote:

    > 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...

    --
    Craig Deelsnyder
    Microsoft MVP - ASP/ASP.NET
     
    Craig Deelsnyder, Aug 4, 2005
    #2
    1. Advertising

  3. Imran Aziz

    Imran Aziz Guest

    Thanks thats what I am doing now.
    Imran.
    "Craig Deelsnyder" <cdeelsny@no_spam_4_meyahoo.com> wrote in message
    news:eek:...
    > On Thu, 04 Aug 2005 10:14:34 -0500, Imran Aziz <> wrote:
    >
    >> 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...
    >
    > --
    > Craig Deelsnyder
    > Microsoft MVP - ASP/ASP.NET
     
    Imran Aziz, Aug 5, 2005
    #3
  4. Imran Aziz

    pwhe23

    Joined:
    Jun 30, 2008
    Messages:
    1
    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);
    }
     
    pwhe23, Jun 30, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SamIAm
    Replies:
    5
    Views:
    5,741
    S. Justin Gengo
    Jan 7, 2004
  2. Harry Barker
    Replies:
    2
    Views:
    543
    Alf P. Steinbach
    Apr 19, 2006
  3. RC-
    Replies:
    5
    Views:
    1,609
  4. Peggy
    Replies:
    1
    Views:
    770
    Eliyahu Goldin
    May 17, 2007
  5. crea
    Replies:
    2
    Views:
    440
    Nobody
    Dec 28, 2012
Loading...

Share This Page