private void EditCompanyData() { try { LoadDropDownList(); GridViewRow oGridViewRow = gvCompany.Rows[Convert.ToInt32(ViewState["index"])]; Label lblCompanyId = (Label)oGridViewRow.FindControl("lblCompanyId"); Session["CompanyId"] = lblCompanyId.Text; CompanyDTO oCompanyDTO = new CompanyDTO(); oCompanyDTO = oWebApiCalls.CompanySearchById(Convert.ToInt32(lblCompanyId.Text)); txtName.Text = oCompanyDTO.Name; txtAddress.Text = oCompanyDTO.Address; txtTelephone.Text = oCompanyDTO.Telephone; txtEmail.Text = oCompanyDTO.Email; txtDescription.InnerText = oCompanyDTO.Description; ddlType.SelectedValue = Convert.ToString((int)oCompanyDTO.Type); txtNoOfShares.Text = Convert.ToString(oCompanyDTO.NumberOfShares); txtSharePrice.Text = Convert.ToString(oCompanyDTO.SharePrice); ddlStatus.SelectedValue = Convert.ToString((int)oCompanyDTO.Status); string DecryptedPwd = Cryptography.Encryption.Decrypt(oCompanyDTO.Password, oCompanyDTO.UserName); txtUserName.Text = oCompanyDTO.UserName; txtPassword.Text = DecryptedPwd; ControllersHandler(CommandMood.Edit); } catch (Exception ex) { lblError.Text = ex.Message.ToString(); throw ex; } }