How to fire RowCommand for a GridView which is inside a Repeater?

2.8k views Asked by At

I have a Repeater and inside it a GridView. Now I want to to fire GridView's RowCommand. So can any one tell me how can it be?

2

There are 2 answers

0
Josh Darnell On BEST ANSWER

What it sounds like you want to do is handle the RowCommand event in each of your GridViews.

One way to do this would be to create an event handler for the ItemCreated event in the Repeater control. In that event handler, you could then add the RowCommand event handler to each GridView using += syntax. So, if your RowCommand event handler method is called "GridView1_RowCommand", you could do this:

Repeater1_ItemCreated(Object Sender, RepeaterItemEventArgs e)
{

    GridView tempGV = (GridView)e.Item.FindControl("GridView1");
    tempGV += GridView1_RowComamnd;

}

Then, each time a RowCommand event is fired from one of your GridViews, the GridView_RowCommand event will be called.

2
Sai Kalyan Kumar Akshinthala On

Refer to this site, where a similar discussion is done.