If you are using a LINQDatasource (or any ASP.NET datasource controls with 2 way databinding) and some of your fields are not updating, then one of the first things you should check is that you are not using Eval, rather than Bind() on your templated fields.
Today, one of my colleagues had issues with both inserting and updating records using a ListView and a LINQ datasource. After a little bit of DK (Divide and Konquer), I eventually found something he had (painfully) overlooked - the Item Template values used Eval (which is fine). However, he had updated the Item template and copied it over to the Edit Item templates and Insert Item templates to save time.
Obviously, Evals are readonly - so the values were never passed into the update of the LINQ datasource.
The Musings and Findings of Software Consultant David Klein (Sydney, Australia)
Showing posts with label DataSources. Show all posts
Showing posts with label DataSources. Show all posts
Friday, 3 April 2009
Wednesday, 5 March 2008
A simple reminder to all: MS AJAX update panel and DataSources interaction - FormView.Update not passing values to DataSource
My Brazillian colleague Andre Gallo was having issues today with one of our datasources not being updated from an ASP.NET formview (a modified Object Container DataSource, part of the Web Client Software Factory package). While the formview had all the values (clearly visible via FormView.FindControl("myControlName"), a call to FormView.Updateitem() was not setting the value on the Object Container Data Source (aka OCDS). I had a look and the problem was that the datasource was OUTSIDE the AJAX panel - and so was not being passed through to the server by the partial postback.
There were 2 possible resolutions to that one:
There were 2 possible resolutions to that one:
- To put the object container datasource into the same panel
- To use the Telerik controls RadAjaxManager which allows you to point to specific trigger and destination controls for the partial postback.
We resolved the issue with option 2.
Labels:
AJAX,
ASP.NET 3.5,
Databinding,
DataSources,
Telerik
Monday, 5 November 2007
Databinding in Page_Load VS LINQ Data Source Selecting Event
While it is nice to have all your databinding code in Page_Load (e.g. in a LoadData() method), it is preferable to use the DataSource Selecting Event. e.g.
This is because you retain full support for Data source pagination and sorting - which equals less code (declarative or programmatic). For more details on using the Selecting event with LINQ datasources, see
http://www.visualbuilder.com/viewdetail.php?type=1&id=1591&group_id=11
1: linqDSProducts_Selecting(object sender, LinqDataSourceSelectEventArgs e)
This is because you retain full support for Data source pagination and sorting - which equals less code (declarative or programmatic). For more details on using the Selecting event with LINQ datasources, see
http://www.visualbuilder.com/viewdetail.php?type=1&id=1591&group_id=11
Subscribe to:
Posts (Atom)