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

RadGrid Insert, Update and Delete - Usercontrol

1 Answer 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bader
Top achievements
Rank 1
Bader asked on 27 Jul 2011, 05:08 PM
Hello,

I'm using the demo: http://demos.telerik.com/aspnet-ajax/editor/examples/righttoleft/defaultcs.aspx.
Can i know using the c# code (In the server side) of the usercontrol in which mode I'm in (Insert or update)?
Note: I'm using the follwoing code:
((bool)DataBinder.Eval(Container, "OwnerTableView.IsItemInserted")) ? false : true

But thats doesn't help in the server side of the user control.

Please, I need your help,
It is apprecited to send me a sample code:

Regards,
Bader

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 01 Aug 2011, 01:49 PM
Hi Bader,

Is the provided link correct, or you meant some demo about RadGrid? You could check the mode in which the usercontrol is, by hooking up some event, that is applicable for your case. In the event's body, you check weather the item is in edit mode or item is inserted. Here is an example on how to achieve that,  using ItemDataBound event:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item.IsInEditMode)
        {
            //Some code goes here.....
        }
        else if (e.Item.OwnerTableView.IsItemInserted)
        {
            //Some code goes here.....
        }
    }

You could check this online demo, to see whether it is something similar to your project.

All the best,
Andrey
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Bader
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or