The simple way to do this is to incorporate that into your SQL so your data
really reflects what your grid is showing. You will have to change the
SelectCommand of your sqlDataSource to include an imaginary field. so if your
select statement is "select sourceID, a, b, c from myTable where a=2" you
will change that and add the imaginary field like so "select sourceID, a, b,
c, Case When [sourceID] 0 Then 1 Else 0 End as d from myTable where a=2".
This guarantees the return of an additional field called d the value of
which is set to 1 if sourceID is 0 and d would be 0 if sourceID isn't 0.
You will bind to that field normally when you're displaying your grid and
then you can read it when it is submitted. How you use that in the submit is
entirely up to you. Just keep in mind that there is no field called d in
myTable so it won't go anywhere if you don't handle it in the code.
A clean way to show you that SQL statement is the following
SELECT [SourceID]
, [a]
, [b]
, [c]
, CASE
WHEN [SourceID] 0 THEN 1
ELSE 0
END AS [d]
FROM myTable
WHERE [a] = 2
Hope this helps.
--
Mohamad Elarabi
MCP, MCTS, MCPD.
"Robert Smith" wrote:
Hi,
I have a GridView with a checkbox column in it called FromInsight,
however this
is not bound to the dataset, its value is based on another column from the
dataset called sourceid
For each row FromInsight = true if (SourceId 0). I try to loop around the
gridview and add the value of the checkbox but the column seems to have no
checked value, please can you help with this.
Thanx in advance
Robert