My GridView has an \"Active\" CheckBox, to indicate whether the record is active or not. It\'s just a flag, a bit value in the database.
I need to UPDATE the \"Activate
I need a Status column in database which contains 1,0 for representing Employee's Status "Active" and "Inactive" respectively. I want edit this record through front-end,having grid-view, and want to perform on GridView's update event, after clicking on Edit Button. I have a TemplateField having header-text "Status". I am unable to update changed value of checkbox.
Moreover, if will get checked or unchecked CheckBox on the basis of value stored in database, if it is 0 then CheckBox will be uncheked, otherwise will be checked. If user click on edit button, and then check or uncheck any Check-box, then on the basis of this, value should be updated in database.
DataBase:-
CREATE TABLE [dbo].[Employee](
[Employee_ID] [int] IDENTITY(1,1) NOT NULL,
[Employee_Name] [varchar](50) NULL,
[Employee_Address] [varchar](100) NULL,
[Emp_Status] [int] NULL,
PRIMARY KEY CLUSTERED
(
[Employee_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON
Front-End:-
Mark-up:
<%-- --%>
<%--
1
--%>
Code:
protected bool GetStatus(string str)
{
if (str=="1")
{
return true;
}
else
{
return false;
}
}
I am getting Error:-
An exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll but was not handled in user code