protected void lnkBtnSendRequest_Click(object sender, EventArgs e)
    {
        string strEmailContentForCompany = string.Empty;
        strEmailContentForCompany = "<table>";
        string strContent = string.Empty;
        BLL.TemplateLib oTemplateLib = new BLL.TemplateLib();

        strContent = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("RegistrationRequestForUserEmail").TextAreaHTML;

        List<Entity.CompanyInfo> _objListCompanyInfo = new List<Entity.CompanyInfo>();
        foreach (GridViewRow gvRows in GVUsers.Rows)
        {
            CheckBox chkSelect = (CheckBox)gvRows.FindControl("chkSelect");
            if (chkSelect.Checked)
            {
                lblMsg.Text = string.Empty;
                Label lblCompanyRequestedUsersListId = (Label)gvRows.FindControl("lblCompanyRequestedUsersListId");
                Label lblEmail = (Label)gvRows.FindControl("lblEmail");
                Label lblName = (Label)gvRows.FindControl("lblName");

                if (lblCompanyRequestedUsersListId != null)
                {
                    string strRegistrationLink = AppConfig.GetBaseSiteUrl() + "UserRegistration.aspx?iid=" + lblCompanyRequestedUsersListId.Text;
                    strEmailContentForCompany = strEmailContentForCompany + "<tr><td>" + lblName.Text + "(" + lblEmail.Text + ")</td></tr>";

                    strContent = strContent.Replace("[FullName]", lblName.Text);
                    strContent = strContent.Replace("[SiteUrl]", AppConfig.GetBaseSiteUrl());
                    strContent = strContent.Replace("[RegistrationLink]", strRegistrationLink);
                    strContent = strContent.Replace("[SiteName]", AppConfig.GetSiteName());

                    //AppLib.SendMailToUser(lblEmail.Text, "Registration Request By TLW", strContent, AppConfig.GetAdminEmail());

                       string fname = "~/Upload/" + lblName.Text + ".html";
                       StreamWriter _testData = new StreamWriter(Server.MapPath(fname));
                        _testData.WriteLine(strContent); // Write the file.
                        _testData.Flush();
                        _testData.Close(); // Close the instance of StreamWriter.
                        _testData.Dispose(); // Dispose from memory.

                    oCompanyInfo = new Entity.CompanyInfo();
                    oCompanyInfo.IntCompanyRequestedUsersListId = Convert.ToInt32(lblCompanyRequestedUsersListId.Text);
                    oCompanyInfo.ChrStatus = 'S';
                    oCompanyInfo.DtModifiedDate = DateTime.Now;
                    _objListCompanyInfo.Add(oCompanyInfo);
                    oCompanyInfo = null;
                }
            }
        }

        if (_objListCompanyInfo.Count > 0)
        {
            strEmailContentForCompany = strEmailContentForCompany + "</table>";
            strContent = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("EmailToCompanyForRegistrationofUser").TextAreaHTML;
            strContent = strContent.Replace("[CompanyName]", ddlCompany.SelectedItem.Text);
            strContent = strContent.Replace("[Name]", strEmailContentForCompany);

            oCompanyInfo = new Entity.CompanyInfo();
            oCompanyManager = new BLL.CompanyManager();
            oCompanyInfo = oCompanyManager.GetCompanyDetailsById(Convert.ToInt32(ddlCompany.SelectedValue));
            if (oCompanyInfo != null)
            {
                AppLib.SendMailToUser(oCompanyInfo.StrCompanyEmail, "Registration Request Status of User", strContent, AppConfig.GetAdminEmail());
            }

            oCompanyManager.UpdateRequestUserStatus(_objListCompanyInfo);
            oCompanyManager = null;
            oCompanyInfo = null;

            lblMsg.Text = "Registration Request has been sent successfully.";
            BindCompanies('Y');
        }
        else
        {
            lblMsg.Text = "Please select atleast one record.";
        }
        //BindCompanies('Y');

        oTemplateLib = null;
    }