Problem determining which grid raised Edit event

5 posts, 0 answers
  1. AkAlan
    AkAlan avatar
    121 posts
    Member since:
    Jun 2009

    Posted 30 Dec 2010 Link to this post

    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.
  2. Elliott
    Elliott avatar
    391 posts
    Member since:
    May 2010

    Posted 30 Dec 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. AkAlan
    AkAlan avatar
    121 posts
    Member since:
    Jun 2009

    Posted 30 Dec 2010 Link to this post

    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.
  5. Elliott
    Elliott avatar
    391 posts
    Member since:
    May 2010

    Posted 30 Dec 2010 Link to this post

    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)
        {
            //...
        }
    }
  6. AkAlan
    AkAlan avatar
    121 posts
    Member since:
    Jun 2009

    Posted 30 Dec 2010 Link to this post

    Also works great. Thanks again for replying so quick, your'e really making my day!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017