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

[Solved] How to set the value of cell before update fires

1 Answer 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark Breen
Top achievements
Rank 1
Mark Breen asked on 17 Oct 2009, 04:15 PM
Hello All,

I have the IP address of the user and I want to set one of the columns in the data source of the grid.  In Pseudo code, I want to achieve the following

MyGrid . RowBeingUpdated . Column ("IPAddress).Value = "192.168.1.1";

Could someone advise which event I should use and the syntax to update the cell value.  I have tried to get it working with DataKeyValues, but am not familiar enough yet to get it working.

I have included below the code that I used with the VS2008 default grid, and it works fine for that control.

Thanks in advance, 

Mark Breen
Ireland

<snip>
        protected void LinqDSBoatBuilders_Inserting(object sender, LinqDataSourceInsertEventArgs e)
        {
            BoatBuilder oRec = (BoatBuilder)e.NewObject; //This is my LINQtoSQL data source
            oRec.CreatedOnDate = DateTime.Now;
            oRec.CreatedByIPAddress = GetIPAddress();
        }
</snip>

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 22 Oct 2009, 09:25 AM
Hello Mark,

How to update/insert records in RadGrid for ASP.NET AJAX using automatic operations and data source controls or manual editing you can see from the demos pointed below:

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/linqdatasource/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editmodes/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/extractvalues/defaultcs.aspx

You may also refer to the Update/Insert/Delete records chapter from the online documentation of the product:
http://www.telerik.com/help/aspnet-ajax/gridoverview.html

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Mark Breen
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or