Expand|Select|Wrap|Line Numbers
- EmpID Plan Status
- abc123 PlanA A
- abc123 PlanB D
- abc123 PlanC A
- xyz789 PlanA D
- xyz789 PlanB D
- xyz789 PlanC A
- ...
I have created a GridView in ASP.Net, normalising the data by the query:
Expand|Select|Wrap|Line Numbers
- select EmpID,
- sum(case when Plan='PlanA' and Status='A' then 1 else 0 end) as PlanA,
- sum(case when Plan='PlanB' and Status='A' then 1 else 0 end) as PlanB,
- sum(case when Plan='PlanC' and Status='A' then 1 else 0 end) as PlanC
- from EmployeePlan
- group by EmpID
Expand|Select|Wrap|Line Numbers
- Employee ID Plan A Plan B Plan C
- abc123 x _ x
- xyz789 _ _ x
the checkbox is preset in templatefield by evaluating it (1 = true, 0 = false)
My problems are:
1. How to get the checkbox value from the GridView? (I got the object reference not set error)
2. When a user click the Update button, how to override the UpdateCommand by updating 3 rows instead of updating a single row?
(Update EmployeePlan set Status = @Status where EmpID = @EmpID)
Thanks in advance.