Stored Proc. checkbox parameter in gridview

I have an editable gridview with a checkbox used to put a product in "Active" or "Inactive" mode.
The DB fields is a BIT type value.
When I try to update my gridview the checkbox does not update the field value??
Here is my code in the gridview:

<ItemTemplate><%#IIf(Eval("Active"), "<font color='lime'><i>Yes</i></font>", "<font color='red'><i>No</i></font>")%></ItemTemplate>
<asp:CheckBox ID="chk1" runat="server" Width="40px" Text='<%# ReplaceBoolValue(Eval("Active"))%>' Checked='<%# Eval("Active") %>' EnableViewState="true" />

Here is my parameter in code behind:

 myCom.Parameters.AddWithValue("@Active", SqlDbType.Bit)
        If CType(GridProducts.Rows(e.RowIndex).FindControl("chk1"), CheckBox).Checked = True Then
            myCom.Parameters("@Active").Value = 1
            myCom.Parameters("@Active").Value = 0
        End If

All other control inthe gridview are returning the correct values, except this checkbox.
Can you tell me what is wrong with my code?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Miguel OzSoftware EngineerCommented:
From memory, you need to compare the value returned from function Eval. (The return value could not be used as Boolean variable)
Replace  Eval("Active") with:
Eval("Active").ToString() == "1"

Open in new window

pascalmartinAuthor Commented:
Sorry Miguel this doesn't work, the procedure doesn't fire...
Miguel OzSoftware EngineerCommented:
What is the value  of CType(GridProducts.Rows(e.RowIndex).FindControl("chk1"), CheckBox).Checked ? When the UI Checkbox is checked and when it is not.
Grvidview is very sensitive to where in the page lifecycle you are getting information. Could you post your complete page or a sample page with just your issue. I have VS2013/2010 and SQL server 2012
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

pascalmartinAuthor Commented:
Hi there I solve the issue on my own.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Miguel OzSoftware EngineerCommented:
No worries, please post your solution as the accepted answer and close the question.
pascalmartinAuthor Commented:
I solved it by myself after trying many different solutions...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.