Here's my data: (Table: EmployeePlan)
where Status "A" means an employee subscribed to a certain plan and "D" otherwise.
I have created a GridView in ASP.Net, normalising the data by the query:
and the GridView looks like this:
where "x" is a checked checkbox and "_" is a non-checked checkbox
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.
Code:
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:
Code:
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
Code:
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.
Comment