you may try this
<pre> protected void UpdateRecord(object sender, GridViewUpdateEventArgs e)
{
HJSoftware.BusinessAcceess.BusinessAccess ba = new HJSoftware.BusinessAcceess.BusinessAccess();
int EmpID = Int32.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
int intResult = 0;
GridViewRow row = GridView1.Rows[e.RowIndex];
DropDownList DdlGender = (DropDownList)row.FindControl("ddlGender");
FileUpload ImageUpload = (FileUpload)row.FindControl("ImageUpload");
FileUpload BiodataUpload = (FileUpload)row.FindControl("BiodataUpload");
TextBox FirstName = (TextBox)row.FindControl("txtFirstName");
TextBox LastName = (TextBox)row.FindControl("txtLastName");
TextBox MiddleName = (TextBox)row.FindControl("txtMiddleName");
TextBox Address1 = (TextBox)row.FindControl("txtAddress1");
TextBox Address2 = (TextBox)row.FindControl("txtAddress2");
TextBox State1 = (TextBox)row.FindControl("txtState1");
TextBox ZipCode = (TextBox)row.FindControl("txtZipCode");
TextBox DOB = (TextBox)row.FindControl("txtDOB");
TextBox Phone = (TextBox)row.FindControl("txtPhone");
TextBox Email = (TextBox)row.FindControl("txtEmail");
TextBox Designation = (TextBox)row.FindControl("txtDesignation");
TextBox DateOfJoining = (TextBox)row.FindControl("txtDateOfJoining");
TextBox DateOfReleving = (TextBox)row.FindControl("txtDateOfReleving");
Image image1 = (Image)row.FindControl("image");
HyperLink hl1 = (HyperLink)row.FindControl("hl1");
DropDownList DdlDept = (DropDownList)row.FindControl("DropDownList1");}
public int Update(int EmpID,int DeptID,string FirstName,string LastName,string MiddleName,string Address1,
string Address2, string State1, int ZipCode, string Gender, int Phone,DateTime DOB, string Email, string Designation,DateTime DateOfJoining,DateTime DateOfReleving,string FileName,string BioData)
{
SqlCommand myCommand = new SqlCommand();
SqlConnection myConnection = new SqlConnection(connectionString);
myConnection.Open();
myCommand = new SqlCommand("sp_UpdateEmployee", myConnection);
myCommand.CommandType = CommandType.StoredProcedure;
try
{
myCommand.Parameters.AddWithValue("@Photo", "images/" + FileName);
myCommand.Parameters.AddWithValue("@EmpId",EmpID);
myCommand.Parameters.AddWithValue("@DeptId",DeptID);
myCommand.Parameters.AddWithValue("@FirstName",FirstName );
myCommand.Parameters.AddWithValue("@LastName",LastName );
myCommand.Parameters.AddWithValue("@MiddleName",MiddleName );
myCommand.Parameters.AddWithValue("@Address1",Address1 );
myCommand.Parameters.AddWithValue("@Address2",Address2 );
myCommand.Parameters.AddWithValue("@State1",State1 );
myCommand.Parameters.AddWithValue("@ZipCode",ZipCode );
myCommand.Parameters.AddWithValue("@Gender",Gender );
myCommand.Parameters.AddWithValue("@DOB",DOB );
myCommand.Parameters.AddWithValue("@Phone",Phone );
myCommand.Parameters.AddWithValue("@Email",Email );
myCommand.Parameters.AddWithValue("@Designation",Designation );
myCommand.Parameters.AddWithValue("@DateOfJoining",DateOfJoining );
myCommand.Parameters.AddWithValue("@DateOfReleving", DateOfReleving);
myCommand.Parameters.AddWithValue("@BioData",BioData );
return myCommand.ExecuteNonQuery();
}
catch
{
throw;
}
finally
{
myCommand.Dispose();
myConnection.Close();
myConnection.Dispose();
}