This is a migrated thread and some comments may be shown as answers.

Problem determining which grid raised Edit event

4 Answers 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
AkAlan
Top achievements
Rank 2
AkAlan asked on 30 Dec 2010, 08:12 PM
I'm trying to run some code in the RadGrid1_ItemDataBound and RadGrid1_UpdateCommand events and am running into problems now that I have added a detail grid to the equation. I am using sqlDataSource for both grids, not using NeedDataSource. What is the best way to determine which grid raised the events? Should I be using NeedDatasource with the sqlDataSource as well? Thanks for any help.

4 Answers, 1 is accepted

Sort by
0
Elliott
Top achievements
Rank 2
answered on 30 Dec 2010, 08:14 PM
do the table views of the grid all have Names?
if they do then the e.Item.OwnerTableView.Name will tell you what triggered the event that got you to the handler you are working with

Marianne
0
AkAlan
Top achievements
Rank 2
answered on 30 Dec 2010, 08:23 PM
OK, I just gave them names, didn't realize that was an option. Works like a champ. Next if you don't mind, how to determine if the command was edit or insert? Thanks for the quick and correct reply.
0
Elliott
Top achievements
Rank 2
answered on 30 Dec 2010, 08:29 PM
I had that same problem 6 months ago
here is what Telerik told me to do

protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is IGridInsertItem)
    {
        //...
    }
}
0
AkAlan
Top achievements
Rank 2
answered on 30 Dec 2010, 08:37 PM
Also works great. Thanks again for replying so quick, your'e really making my day!
Tags
Grid
Asked by
AkAlan
Top achievements
Rank 2
Answers by
Elliott
Top achievements
Rank 2
AkAlan
Top achievements
Rank 2
Share this question
or