Monday, May 28, 2012

Email Configuraton setting Coding using C#

 MailSetting ()

{
SmtpClient mailClient = new SmtpClient();

MailMessage email = new MailMessage("busadmin@kryptos.in", txtContactemail.Text);

email.Bcc.Add("vinitha.k@kryptos.in");

email.Subject = "Registration Details for VAR";

email.IsBodyHtml = true;

email.Body = "<html><body><table><tr><td>Dear Partner,</td></tr><tr><td></td></tr><tr><td>Greetings!.</td></tr><tr><td>Please find the log in details for VAR Website Access<br/></td></tr><tr><td></td></tr><tr><td>UserName:" + strUsername + "</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>Password:" + strPassword + "</td></tr><tr><td>Kindly acknowledge the receipt.</td></tr><tr><td></td></tr><tr><td>Regards,</td></tr><tr><td><tr><td>VAR Administrator</td></tr><tr><td>044-43915114 / 5119</td><tr></table><body></html>";

//Attachment attach = new Attachment(ms, inv_no + ".xls");

//email.Attachments.Add(attach);

// You can specify the host name or ipaddress of your server

// Default in IIS will be localhost

//client.PickupDirectoryLocation = @"C:\Inetpub\mailroot\Pickup\";



//Default port will be 25

mailClient.Port = 25;

mailClient.DeliveryMethod =
SmtpDeliveryMethod.SpecifiedPickupDirectory;

mailClient.PickupDirectoryLocation = @"C:\Inetpub\mailroot\Pickup\";

mailClient.Send(email);
}

Thursday, May 24, 2012

Binding Dropdown get values from DB


        public void Dropdownlist2()//gridvalues1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                SqlConnection con = new SqlConnection(ConnectionString);
                //con.Open();
                string str = "select month,week from duration";
                SqlCommand cmd = new SqlCommand(str, con);
                con.Open();
                SqlDataAdapter da = new SqlDataAdapter();
                // DataSet ds = new DataSet();
                DataTable dt = new DataTable();
                da.SelectCommand = cmd;
                da.Fill(dt);
                DropDownList2.DataSource = dt;
                DropDownList1.DataTextField = "month";
                // DropDownList1.DataValueField = "Title";
                DropDownList2.DataValueField = "month";
                DropDownList2.DataBind();
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }

Sample Code for Creating Custom Webparts in Class Library

http://srv00a004:21281/default.aspx

http://srv00a004:21281   <http://srv00a004:21281/>
C:\Inetpub\wwwroot\wss\VirtualDirectories\21281\bin---->To open the virtual directory file

Partner Portal URL:
===================
http://srv00a004:21281/sites/Partner/default.aspx
New Portal:
===============
http://srv00a004:25588/default.aspx
Solution Portal:
=================
http://srv00a004:25588/Solutions/default.aspx
http://srv00a004:25588/sites/SolutionS

http://srv00a004:25588/Solutions/_catalogs/masterpage/SolutionGallery.aspx#


web part validation:
======================
#region Using Name Space
using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.Administration;
using System.Web;
using System.IO;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Drawing;
using System.Data;
using Binarch.KN.SPLAHelper;
using AjaxControlToolkit;
#endregion
namespace Binarch.KN.SPLAWebParts
{
    [Guid("cd032749-00ad-42cb-a265-0bb0c2a12d2d")]
    public class Partner : System.Web.UI.WebControls.WebParts.WebPart
    {
        #region Controls Declaration
        //ExceptionHandler ExHandlers;
        //protected System.Web.UI.WebControls.Menu mnu = new System.Web.UI.WebControls.Menu();
        protected Label lblStatus = new Label();
        protected Table tblMain = new Table();
        protected int userID;
        //Partner View list & search
        protected GridView gvPartner = new GridView();
        protected Table tblViewPartner = new Table();
        protected Table tblSearch = new Table();
        protected Label lblSrchCompany = new Label();
        protected TextBox txtSrchCompany = new TextBox();
        protected Label lblSrchBizVertical = new Label();
        protected DropDownList ddlSrchBizVertical = new DropDownList();
        protected Label lblSrchLicensePrice = new Label();
        protected DropDownList ddlSrchLicensePrice = new DropDownList();
        protected Label lblSrchStatus = new Label();
        protected DropDownList ddlSrchStatus = new DropDownList();
        protected Label lblExpiryDate = new Label();
        protected TextBox txtExpiryDate = new TextBox();
        protected System.Web.UI.WebControls.Image imgCalExpiry = new System.Web.UI.WebControls.Image();
        protected AjaxControlToolkit.CalendarExtender CalExpiryDate = new CalendarExtender();
        protected Button btnSearch = new Button();
        protected Panel pnlPartner = new Panel();
        protected Button btnDelete = new Button();
        protected Button btnAddPartner = new Button();
        protected HiddenField hdnDelPartner = new HiddenField();
        #region Add-Partner Declarations - New
        // protected Table tblMain = new Table();
        protected Table tblPartnerDetail = new Table();
        protected Table tblPricingPatner = new Table();
        protected Table tblProductYear = new Table();
        protected Table tblAlternateContact1 = new Table();
        protected Table tblAlternateContact2 = new Table();
        protected Table tblBillingContact = new Table();
        protected Table tblBillingEscContact = new Table();
        protected Label lblStar = new Label();
        protected Label lblSPLANo = new Label();
        protected TextBox txtSPLANo = new TextBox();
        protected RequiredFieldValidator rqPartnerCode = new RequiredFieldValidator();
        //protected ValidatorCalloutExtender VCEPartnerCode = new ValidatorCalloutExtender();
        protected Label lblEnrollmentNo = new Label();
        protected TextBox txtEnrollmentNo = new TextBox();
        protected RequiredFieldValidator rqenrollmentNo = new RequiredFieldValidator();
        RegularExpressionValidator regnumbers = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCEenrollmentNo = new ValidatorCalloutExtender();
        protected Label lblMBSCNo = new Label();
        protected TextBox txtMBSCNo = new TextBox();
        protected RequiredFieldValidator rqMBSCNo = new RequiredFieldValidator();
        protected Label lblMPNNo = new Label();
        protected TextBox txtMPNNo = new TextBox();
        protected RequiredFieldValidator rqMPNNo = new RequiredFieldValidator();
        protected Label lblPartnerFromDate = new Label();
        protected TextBox txtPartnerFromDate = new TextBox();
        protected RequiredFieldValidator rqLicenseFrmDate = new RequiredFieldValidator();
        //protected ValidatorCalloutExtender VCELicenseFrmDate = new ValidatorCalloutExtender();
        protected CompareValidator cmpPartDate = new CompareValidator();
        protected Label lblPartnerToDate = new Label();
        protected TextBox txtPartnertoDate = new TextBox();
        protected System.Web.UI.WebControls.Image imgCalenderfrm = new System.Web.UI.WebControls.Image();
        protected System.Web.UI.WebControls.Image imgCalenderto = new System.Web.UI.WebControls.Image();
        protected CalendarExtender ceLicenseFrom = new CalendarExtender();
        protected CalendarExtender ceLicenseTo = new CalendarExtender();
        protected RequiredFieldValidator rqLicenseToDate = new RequiredFieldValidator();
        protected RegularExpressionValidator reLicenseDate = new RegularExpressionValidator();
        protected RegularExpressionValidator reLicenseToDate = new RegularExpressionValidator();
        // protected ValidatorCalloutExtender VCELicenseToDate = new ValidatorCalloutExtender();
        //protected ValidatorCalloutExtender VCELicenseDate = new ValidatorCalloutExtender();
        //protected ValidatorCalloutExtender VCEreLicenseToDate = new ValidatorCalloutExtender();
        protected Label lblPartnerCompanyName = new Label();
        protected TextBox txtPartnerCompanyName = new TextBox();
        protected RequiredFieldValidator rqPartnerCompanyName = new RequiredFieldValidator();
        //protected ValidatorCalloutExtender VCEPartnerCompanyName = new ValidatorCalloutExtender();
        protected Label lblPartnerAuthName = new Label();
       protected TextBox txtPartnerAuthName = new TextBox();
        protected RequiredFieldValidator rqPartnerAuthName = new RequiredFieldValidator();
        //protected ValidatorCalloutExtender VCEPartnerAuthName = new ValidatorCalloutExtender();
        protected Label lblPartnerDesignation = new Label();
        protected TextBox txtPartnerDesignation = new TextBox();
        protected RequiredFieldValidator rqPartnerDesignation = new RequiredFieldValidator();
        //protected ValidatorCalloutExtender VCEPartnerDesignation = new ValidatorCalloutExtender();
        protected Label lblPartnerEmailID = new Label();
        protected TextBox txtPartnerEmailID = new TextBox();
        protected RequiredFieldValidator rqPartnerEmailID = new RequiredFieldValidator();
        protected ValidatorCalloutExtender VCErqPartnerEmailID = new ValidatorCalloutExtender();
        protected RegularExpressionValidator rePartnerEmailID = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCErePartnerEmailID = new ValidatorCalloutExtender();
        protected Label lblPartnerAddress = new Label();
        protected TextBox txtPartnerAddress = new TextBox();
        protected RequiredFieldValidator rqPartnerAddress = new RequiredFieldValidator();
        //protected ValidatorCalloutExtender VCEPartnerAddress = new ValidatorCalloutExtender();
        protected Label lblPartnerAddress1 = new Label();
        protected TextBox txtPartnerAddress1 = new TextBox();
        protected Label lblPartnerCity = new Label();
        protected TextBox txtPartnerCity = new TextBox();
        protected RequiredFieldValidator rqPartnerCity = new RequiredFieldValidator();
        //protected ValidatorCalloutExtender VCEPartnerCity = new ValidatorCalloutExtender();
        protected Label lblPartnerState = new Label();
        protected DropDownList ddlPartnerState = new DropDownList();
        protected RequiredFieldValidator rqPartnerState = new RequiredFieldValidator();
        //protected ValidatorCalloutExtender VCEPartnerState = new ValidatorCalloutExtender();
        protected Label lblTelephone = new Label();
        protected TextBox txtTelephone = new TextBox();
        protected RequiredFieldValidator rqPartnerPhone = new RequiredFieldValidator();
        protected ValidatorCalloutExtender VCEPartnerPhone = new ValidatorCalloutExtender();
        protected RegularExpressionValidator rePartnerPhone = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCErePartnerPhone = new ValidatorCalloutExtender();
        protected Label lblPartnerFax = new Label();
        protected TextBox txtPartnerFax = new TextBox();
        protected RegularExpressionValidator rePartnerFax = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCErePartnerFax = new ValidatorCalloutExtender();
        protected Label lblPartnerMobile = new Label();
        protected TextBox txtPartnerMobile = new TextBox();
        protected RegularExpressionValidator rePartnerMobile = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCErePartnerMobile = new ValidatorCalloutExtender();
        protected Label lblShippingContact = new Label();
        protected TextBox txtShippingContact = new TextBox();
        protected Label lblShippingAddress = new Label();
        protected TextBox txtShippingAddress = new TextBox();
        protected Label lblShippingAddress1 = new Label();
        protected TextBox txtShippingAddress1 = new TextBox();
        protected Label lblShippingCity = new Label();
        protected TextBox txtShippingCity = new TextBox();
        protected Label lblShippingState = new Label();
        protected DropDownList ddlShippingState = new DropDownList();
        protected Label lblShippingTelephone = new Label();
        protected TextBox txtShippingTelephone = new TextBox();
        protected RegularExpressionValidator reShippingTelephone = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCEreShippingTelephone = new ValidatorCalloutExtender();
        protected Label lblShippingFax = new Label();
        protected TextBox txtShippingFax = new TextBox();
        protected RegularExpressionValidator reShippingFax = new RegularExpressionValidator();
        protected ValidatorCalloutExtender VCEreShippingFax = new ValidatorCalloutExtender();
        protected Label lblShippingMobile = new Label();
        protected TextBox txtShippingMobile = new TextBox();
        protected RegularExpressionValidator reShippingMobile = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCEreShippingMobile = new ValidatorCalloutExtender();
        protected Label lblShippingEmail = new Label();
        protected TextBox txtShippingEmail = new TextBox();
        protected RegularExpressionValidator reShippingEmail = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCEreShippingEmail = new ValidatorCalloutExtender();
        protected Label lblbizVertical = new Label();
        protected DropDownList ddlBizVertical = new DropDownList();
        protected RequiredFieldValidator rqBizVertical = new RequiredFieldValidator();

        protected Label lblUserName = new Label();
        protected TextBox txtUserName = new TextBox();
        protected RequiredFieldValidator rqUserName = new RequiredFieldValidator();
        //protected ValidatorCalloutExtender VCEUserName = new ValidatorCalloutExtender();
        protected Label lblPassword = new Label();
        protected TextBox txtPassword = new TextBox();
        protected RequiredFieldValidator rqPassword = new RequiredFieldValidator();
        //protected ValidatorCalloutExtender VCEPassword = new ValidatorCalloutExtender();
        protected AjaxControlToolkit.PasswordStrength pwdStrength = new PasswordStrength();
        protected RegularExpressionValidator rePwdValidator = new RegularExpressionValidator();
        protected Label lblSubscriptionAmt = new Label();
        protected TextBox txtSubscriptionAmt = new TextBox();
        protected RegularExpressionValidator reSubscriptionAmt = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCEreSubscriptionAmt = new ValidatorCalloutExtender();
        protected Label lblfrmDate = new Label();
        protected TextBox txtfrmDate = new TextBox();
        protected RequiredFieldValidator rqfrmDate = new RequiredFieldValidator();
        //protected ValidatorCalloutExtender VCErqfrmDate = new ValidatorCalloutExtender();
        //protected RegularExpressionValidator refrmDate = new RegularExpressionValidator();
        // protected ValidatorCalloutExtender VCErefrmDate = new ValidatorCalloutExtender();
        protected RangeValidator rgvfrmDate = new RangeValidator();
        // protected ValidatorCalloutExtender VCErgvfrmDate = new ValidatorCalloutExtender();
        protected TextBox txttoDate = new TextBox();
        //protected RegularExpressionValidator retoDate = new RegularExpressionValidator();
        // protected ValidatorCalloutExtender VCEretoDate = new ValidatorCalloutExtender();
        protected RequiredFieldValidator rqtoDate = new RequiredFieldValidator();
        // protected ValidatorCalloutExtender VCErqtoDate = new ValidatorCalloutExtender();
        protected RangeValidator rgvtoDate = new RangeValidator();
        // protected ValidatorCalloutExtender VCErgvtoDate = new ValidatorCalloutExtender();
        protected CompareValidator cmpDate = new CompareValidator();
        // protected ValidatorCalloutExtender VCEDate = new ValidatorCalloutExtender();
        protected Label lblActive = new Label();
        protected CheckBox chkActive = new CheckBox();
        protected Label lblMedia = new Label();
        protected CheckBox chkMediatype = new CheckBox();
        protected Label lblThreeYearPrice = new Label();
        protected CheckBox chkThreeYrPrice = new CheckBox();
        protected Label lblPricingPartner = new Label();
        protected DropDownList ddlpricingPartner = new DropDownList();
        protected RequiredFieldValidator rqPricing = new RequiredFieldValidator();
        //protected ValidatorCalloutExtender VCErqPricing = new ValidatorCalloutExtender();
        protected Label lblRegFee = new Label();
        protected RadioButton rdoRegFee = new RadioButton();
        protected RadioButton rdoRegFeeNone = new RadioButton();
        protected Label lblpaymentType = new Label();
        protected DropDownList ddlPaymentType = new DropDownList();
        protected DropDownList ddlPaymentMonth = new DropDownList();
        protected Label lblPriority = new Label();
        protected DropDownList ddlPriority = new DropDownList();
        protected RequiredFieldValidator rqPriority = new RequiredFieldValidator();
        //protected ValidatorCalloutExtender VCErqPriority = new ValidatorCalloutExtender();
        protected HiddenField hdnPartnerId = new HiddenField();
        protected Button btnSave = new Button();
        protected Button btnCancel = new Button();
        protected Label lblLicenseType = new Label();
        protected RadioButtonList rdoLicenseType = new RadioButtonList();
        protected RequiredFieldValidator rqLicenseType = new RequiredFieldValidator();
        //protected ValidatorCalloutExtender VCErqLicenseType = new ValidatorCalloutExtender();
        protected Label lblProductYear = new Label();
        protected RadioButtonList rdoProductYear = new RadioButtonList();
        protected RequiredFieldValidator rqProductYear = new RequiredFieldValidator();
        // protected ValidatorCalloutExtender VCErqProductYear = new ValidatorCalloutExtender();
        #region Contact Details
        protected CheckBox chkContact1 = new CheckBox();
        protected CheckBox chkContact2 = new CheckBox();
        protected CheckBox chkBillingContact = new CheckBox();
        protected CheckBox chkBillingEsculationContact = new CheckBox();
        protected Panel ContactNamePanel = new Panel();
        protected Label lblContact1Name = new Label();
        protected TextBox txtContact1Name = new TextBox();
        RequiredFieldValidator reContact1Nmae = new RequiredFieldValidator();
        protected Label lblContact1phone = new Label();
        protected TextBox txtContact1phone = new TextBox();
        RequiredFieldValidator rqConatct1pjone = new RequiredFieldValidator();
        protected RegularExpressionValidator reContact1phone = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCEreContact1phone = new ValidatorCalloutExtender();
        protected Label lblContact1Mobile = new Label();
        protected TextBox txtContact1Mobile = new TextBox();
        RequiredFieldValidator rqContact1MObile = new RequiredFieldValidator();
        protected RegularExpressionValidator reContact1Mobile = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCEreContact1Mobile = new ValidatorCalloutExtender();
        protected Label lblContact1Email = new Label();
        protected TextBox txtContact1Email = new TextBox();
        RequiredFieldValidator rqContact1Email = new RequiredFieldValidator();
        protected RegularExpressionValidator reContact1Email = new RegularExpressionValidator();
        // protected ValidatorCalloutExtender VCEreContact1Email = new ValidatorCalloutExtender();
        protected Label lblContact2Name = new Label();
        protected TextBox txtContact2Name = new TextBox();
        RequiredFieldValidator Conatact2Name = new RequiredFieldValidator();
        protected Label lblContact2phone = new Label();
        protected TextBox txtContact2phone = new TextBox();
        RequiredFieldValidator rqconatact2phone = new RequiredFieldValidator();
        protected RegularExpressionValidator reContact2phone = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCEreContact2phone = new ValidatorCalloutExtender();
        protected Label lblContact2Mobile = new Label();
        protected TextBox txtContact2Mobile = new TextBox();
        RequiredFieldValidator rqConatact2Mobile = new RequiredFieldValidator();
        protected RegularExpressionValidator reContact2Mobile = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCEreContact2Mobile = new ValidatorCalloutExtender();
        protected Label lblContact2Email = new Label();
        protected TextBox txtContact2Email = new TextBox();
        RequiredFieldValidator rqConatact2Email = new RequiredFieldValidator();
        protected RegularExpressionValidator reContact2Email = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCEreContact2Email = new ValidatorCalloutExtender();
        protected Label lblBillingName = new Label();
        protected TextBox txtBillingName = new TextBox();
        RequiredFieldValidator rqBillingName = new RequiredFieldValidator();
        protected Label lblBillingphone = new Label();
        protected TextBox txtBillingphone = new TextBox();
        RequiredFieldValidator rqBillingphone = new RequiredFieldValidator();
        protected RegularExpressionValidator reBillingphone = new RegularExpressionValidator();
        // protected ValidatorCalloutExtender VCEreBillingphone = new ValidatorCalloutExtender();
        protected Label lblBillingMobile = new Label();
        protected TextBox txtBillingMobile = new TextBox();
        RequiredFieldValidator rqBillingMobile = new RequiredFieldValidator();
        protected RegularExpressionValidator reBillingMobile = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCEreBillingMobile = new ValidatorCalloutExtender();
        protected Label lblBillingEmail = new Label();
        protected TextBox txtBillingEmail = new TextBox();
        RequiredFieldValidator rqBillingEmail = new RequiredFieldValidator();
        protected RegularExpressionValidator reBillingEmail = new RegularExpressionValidator();
        protected Label lblBillingexculationName = new Label();
        protected TextBox txtBillingeScName = new TextBox();
        RequiredFieldValidator rqBillingEscName = new RequiredFieldValidator();
        protected Label lblBillingescphone = new Label();
        protected TextBox txtBillingescphone = new TextBox();
        RequiredFieldValidator rqBillingescphone = new RequiredFieldValidator();
        protected RegularExpressionValidator reBillingescphone = new RegularExpressionValidator();
        // protected ValidatorCalloutExtender VCEreBillingphone = new ValidatorCalloutExtender();
        protected Label lblBillingescMobile = new Label();
        protected TextBox txtBillingescMobile = new TextBox();
        RequiredFieldValidator rqBillingescMobile = new RequiredFieldValidator();
        protected RegularExpressionValidator reBillingescMobile = new RegularExpressionValidator();
        //protected ValidatorCalloutExtender VCEreBillingMobile = new ValidatorCalloutExtender();
        protected Label lblBillingescEmail = new Label();
        protected TextBox txtBillingescEmail = new TextBox();
        RequiredFieldValidator rqBillingescEmail = new RequiredFieldValidator();
        protected RegularExpressionValidator reBillingescEmail = new RegularExpressionValidator();
        #endregion
        #region Controls added by Vinitha.K March 2011
        Label lblCreditPeriod = new Label();
        DropDownList ddlCreditPeeriod = new DropDownList();
        RequiredFieldValidator rqCreditPeriod = new RequiredFieldValidator();
        Label lblCreditLimit = new Label();
        TextBox txtcreditlimit = new TextBox();
        RequiredFieldValidator rqCreditLimit = new RequiredFieldValidator();
        CheckBox chkstpiyes = new CheckBox();
        CheckBox chkstpino = new CheckBox();
        Label lblRegion = new Label();
        DropDownList ddlRegion = new DropDownList();
        RequiredFieldValidator rqRegion = new RequiredFieldValidator();
        RequiredFieldValidator rqpam = new RequiredFieldValidator();
        Label lblPam = new Label();
        DropDownList ddlpam = new DropDownList();
        protected DropDownList ddlDate = new DropDownList();
        CheckBox chkEnrollHistory = new CheckBox();
        Panel pnlEnrollHistory = new Panel();
        GridView gvEnrollHistory = new GridView();
        Table tblEnrollHistory = new Table();
        Label lblCurrencyType = new Label();
        DropDownList ddlCurrencyType = new DropDownList();
        RequiredFieldValidator rqCurrency = new RequiredFieldValidator();
        Label lblTaxProfile = new Label();
        Label lblPricelistCurrency = new Label();
        DropDownList ddlPricelstcurrency = new DropDownList();
        RequiredFieldValidator rqPricelstcurrency = new RequiredFieldValidator();
        Label lblsez = new Label();
        RadioButton rbsezyes = new RadioButton();
        RadioButton rbsezno = new RadioButton();
        CheckBox chkSameUSeEsc = new CheckBox();
        CheckBox chkSameBillEsc = new CheckBox();
        CheckBox chkSameBillCOn = new CheckBox();
        AsyncPostBackTrigger asplfrom = new AsyncPostBackTrigger();
        Label lblplfromdate = new Label();
        DateTimeControl dtplfromdate = new DateTimeControl();
        Label lbltodate = new Label();
        DateTimeControl dtpltodate = new DateTimeControl();
        protected AjaxControlToolkit.CalendarExtender InvFromCalendar = new AjaxControlToolkit.CalendarExtender();
        protected ImageButton imgbtnCalendar = new ImageButton();
        protected RequiredFieldValidator rfvTxtDate = new RequiredFieldValidator();
        protected AjaxControlToolkit.CalendarExtender InvToCalendar = new AjaxControlToolkit.CalendarExtender();
        protected ImageButton imgbtnToCalendar = new ImageButton();
        protected RequiredFieldValidator rfvTxtToDate = new RequiredFieldValidator();
        protected TextBox txtInvDate = new TextBox();
        protected TextBox txtInvToDate = new TextBox();
        #endregion
        Label lbltds = new Label();
        TextBox txttdds = new TextBox();
        RequiredFieldValidator rfvtds = new RequiredFieldValidator();
        RangeValidator rfv = new RangeValidator();
        HiddenField hdfconfirmation = new HiddenField();
        #endregion
        #endregion
        #region On Init
        public Partner()
        {
            this.ExportMode = WebPartExportMode.All;
        }
        protected override void Render(HtmlTextWriter writer)
        {
            // TODO: add custom rendering code here.
            this.RegisterStyles(writer);
            this.tblMain.RenderControl(writer);
        }
       
        protected override void OnInit(EventArgs e)
        {
            try
            {
             
                base.OnInit(e);
                EnsureChildControls();          
                this.InitializeComponent();
            }
            catch (Exception ex)
            {
                //ExHandlers = new ExceptionHandler(ex.Message);
                DisplayErroMessage(ex);
            }
        }
      
        #region RegisterStyles
        private void RegisterStyles(HtmlTextWriter writer)
        {
            writer.Write(@"<style type=""text/css"">
                          
                            .TextStrengthWeak   { background: red; font-family:verdana;font-size:9pt;font-weight:bold; }
                            .TextStrengthNotGood { background: yellow;font-family:verdana;font-size:9pt;font-weight:bold; }
                            .TextStrengthGood { background: blue;font-family:verdana;font-size:9pt;font-weight:bold;  }
                            .pnlAjax{ position: relative;}
   
                            .evenRow{ background-color:#EFF3FB;}
                            .oddRow{ background-color:#FFFFFF;}


                            </style>");
        }
        #endregion
       #endregion
        #region InitializeComponent
        private void InitializeComponent()
        {
            try
            {
                lbltds.ID = "lbltds";
                lbltds.Text = "TDS Rebate(%)";
                txttdds.ID = "txttdds";
                txttdds.MaxLength = 5;
                rfvtds.ID = "rfvtds";
                rfvtds.ControlToValidate = "txttdds";
                rfvtds.ErrorMessage = "*";
                rfvtds.ForeColor = Color.Red;
                rfv.ID = "rfv";
                rfv.ControlToValidate = "txttdds";
                rfv.Type = ValidationDataType.Integer;
                rfv.MinimumValue = "0";
                rfv.MaximumValue = "100";
                rfv.ErrorMessage = "Percentage should be between 1- 100";
                txtInvDate.ID = "txtInvDate";
                txtInvDate.MaxLength = 10;
                txtInvDate.Text = "";
                rfvTxtDate.ID = "rfvTxtDate";
                rfvTxtDate.ControlToValidate = "txtInvDate";
                rfvTxtDate.ErrorMessage = "*";
                rfvTxtDate.ForeColor = Color.Red;
                imgbtnCalendar.ID = "imgbtnCalendar";
                imgbtnCalendar.ImageUrl = "/Source/calender.jpeg";
                imgbtnCalendar.CausesValidation = false;
                InvFromCalendar.ID = "InvFromCalendar";
                InvFromCalendar.PopupButtonID = "imgbtnCalendar";
                //ceLicenseFrom.Format = "dd/MM/yyyy";
                InvFromCalendar.Format = "dd/MM/yyyy";
                InvFromCalendar.TargetControlID = "txtInvDate";
                txtInvToDate.ID = "txtInvToDate";
                txtInvToDate.MaxLength = 10;
                txtInvToDate.Text = "";
                rfvTxtToDate.ID = "rfvTxtToDate";
                rfvTxtToDate.ControlToValidate = "txtInvToDate";
                rfvTxtToDate.ErrorMessage = "*";
                rfvTxtToDate.ForeColor = Color.Red;
                imgbtnToCalendar.ID = "imgbtnToCalendar";
                imgbtnToCalendar.ImageUrl = "/Source/calender.jpeg";
                imgbtnToCalendar.CausesValidation = false;
                InvToCalendar.ID = "InvToCalendar";
                InvToCalendar.PopupButtonID = "imgbtnToCalendar";
                InvToCalendar.Format = "dd/MM/yyyy";
                InvToCalendar.TargetControlID = "txtInvToDate";
                dtplfromdate.ID = "dtplfromdate";
                dtplfromdate.DateOnly = true;
                dtplfromdate.IsRequiredField = true;
                //asplfrom. = "asplfrom";
                asplfrom.ControlID = "dtplfromdate";
                asplfrom.EventName = "DateChanged";
                lblplfromdate.ID = "lblplfromdate";
                lblplfromdate.Text = "PriceList Valid From";
                lbltodate.ID = "lbltodate";
                lbltodate.Text = "PriceList Valid To";              
                dtpltodate.ID = "dtpltodate";
                dtpltodate.DateOnly = true;
                dtpltodate.IsRequiredField = true;
                lblPricelistCurrency.ID = "lblPricelistCurrency";
                lblPricelistCurrency.Text = "PriceList Currency";
                lblCurrencyType.ID = "lblCurrencyType";
                lblCurrencyType.Text = "Billing Currency";
                lblTaxProfile.ID = "lblTaxProfile";
                lblTaxProfile.Text = " Tax Profile";
                ddlCurrencyType.ID = "ddlCurrencyType";
                ddlCurrencyType.AutoPostBack = true;
                ddlCurrencyType.SelectedIndexChanged += new EventHandler(ddlCurrencyType_SelectedIndexChanged);
                LoadDDLDate();
                lblsez.ID = "lblsez";
                lblsez.Text = "SEZ Status";
                rbsezno.ID = "rbsezno";
                rbsezno.Text = "No";
                rbsezno.GroupName = "sez";
                rbsezyes.ID = "rbsezyes";
                rbsezyes.Text = "Yes";
                rbsezyes.GroupName = "sez";
                rqCurrency.ID = "rqCurrency";
                rqCurrency.ControlToValidate = "ddlCurrencyType";
                rqCurrency.ErrorMessage = "Required";
                rqCurrency.ForeColor = Color.Red;
               
                lblCreditPeriod.ID = "lblCreditPeriod";
                lblCreditPeriod.Text = "Credit Period";
                ddlCreditPeeriod.ID = "ddlCreditPeeriod";
                rqCreditPeriod.ID = "rqCreditPeriod";
                rqCreditPeriod.ControlToValidate = "ddlCreditPeeriod";
                rqCreditPeriod.ErrorMessage = "Required";
                rqCreditPeriod.ForeColor = Color.Red;
                rqCreditPeriod.InitialValue = "-1";
                ddlPricelstcurrency.ID = "ddlPricelstcurrency";
                ddlPricelstcurrency.AutoPostBack = true;
                ddlPricelstcurrency.SelectedIndexChanged += new EventHandler(ddlPricelstcurrency_SelectedIndexChanged);
                rqPricelstcurrency.ID = "rqPricelstcurrency";
                rqPricelstcurrency.ControlToValidate = "ddlPricelstcurrency";
                rqPricelstcurrency.ErrorMessage = "Required";
                rqPricelstcurrency.ForeColor = Color.Red;
                rqPricelstcurrency.InitialValue = "-1";
                chkstpiyes.ID = "chkstpiyes";
                chkstpiyes.Text = "Yes";
                chkstpiyes.Enabled = false;

                chkstpino.ID = "chkstpino";
                chkstpino.Text = "No";
                chkstpino.Enabled = false;
                lblCreditLimit.ID = "lblCreditLimit";
                lblCreditLimit.Text = "Credit Limit";
                txtcreditlimit.ID = "txtcreditlimit";
                txtcreditlimit.MaxLength = 10;
                rqCreditLimit.ID = "rqCreditLimit";
                rqCreditLimit.ErrorMessage = "*";
                rqCreditLimit.ControlToValidate = "txtcreditlimit";
                rqCreditLimit.ForeColor = Color.Red;
              
                lblPam.ID = "lblPam";
                lblPam.Text = "PAM";
                ddlpam.ID = "ddlpam";
                rqpam.ID = "rqpam";
                rqpam.ControlToValidate = "ddlpam";
                rqpam.ErrorMessage = "Required";
                rqpam.ForeColor = Color.Red;
                rqpam.InitialValue = "-1";
                loadPartnerManagers();
                lblRegion.ID = "lblRegion";
                lblRegion.Text = "Region";
                ddlRegion.ID = "ddlRegion";
                rqRegion.ID = "rqRegion";
                rqRegion.ControlToValidate = "ddlRegion";
                rqRegion.ErrorMessage = "Required";
                rqRegion.ForeColor = Color.Red;
                rqRegion.InitialValue = "-1";
                LoadRegion();
                pnlEnrollHistory.ID = "pnlEnrollHistory";
                pnlEnrollHistory.Height = Unit.Pixel(150);
                pnlEnrollHistory.ScrollBars = ScrollBars.Auto;
                gvEnrollHistory.ID = "gvEnrollHistory";
                gvEnrollHistory.EmptyDataText = "No History of Enrollment NOs";
                pnlEnrollHistory.Visible = false;
                gvEnrollHistory.Visible = false;
                tblEnrollHistory.Visible = false;
                chkEnrollHistory.ID = "chkEnrollHistory";
                chkEnrollHistory.Text = "View Enrollment History";
                chkEnrollHistory.AutoPostBack = true;
                chkEnrollHistory.CheckedChanged += new EventHandler(chkEnrollHistory_CheckedChanged);
                chkSameBillCOn.ID = "chkSameBillCOn";
                chkSameBillCOn.Text = "Same as Usage SPOC";
                chkSameBillCOn.AutoPostBack = true;
                chkSameBillCOn.CheckedChanged += new EventHandler(chkSameBillCOn_CheckedChanged);
                chkSameBillEsc.ID = "chkSameBillEsc";
                chkSameBillEsc.Text = "Same as Usage SPOC";
                chkSameBillEsc.AutoPostBack = true;
                chkSameBillEsc.CheckedChanged += new EventHandler(chkSameBillEsc_CheckedChanged);
                chkSameUSeEsc.ID = "chkSameUSeEsc";
                chkSameUSeEsc.Text = "Same as Usage SPOC";
                chkSameUSeEsc.AutoPostBack = true;
                chkSameUSeEsc.CheckedChanged += new EventHandler(chkSameUSeEsc_CheckedChanged);
                tblEnrollHistory.ID = "tblEnrollHistory";
                tblEnrollHistory.Width = Unit.Percentage(100);
                tblEnrollHistory.BorderColor = ColorTranslator.FromHtml("#8CC3FF");
                tblEnrollHistory.BackColor = ColorTranslator.FromHtml("#ffffff");
                tblEnrollHistory.BorderStyle = BorderStyle.Solid;
                tblEnrollHistory.BorderWidth = Unit.Pixel(1);
                tblEnrollHistory.CellPadding = 0;
                tblEnrollHistory.HorizontalAlign = HorizontalAlign.Center;
                tblMain.ID = "tblMain";
                tblMain.Width = Unit.Percentage(100);
                tblMain.BorderColor = ColorTranslator.FromHtml("#8CC3FF");
                tblMain.BackColor = ColorTranslator.FromHtml("#ffffff");
                tblMain.BorderStyle = BorderStyle.Solid;
                tblMain.BorderWidth = Unit.Pixel(1);
                tblMain.CellPadding = 0;
                tblMain.HorizontalAlign = HorizontalAlign.Center;
                tblViewPartner.ID = "tblViewPartner";
                tblViewPartner.Width = Unit.Percentage(90);
                tblViewPartner.BorderColor = ColorTranslator.FromHtml("#8CC3FF");
                tblViewPartner.BorderStyle = BorderStyle.Solid;
                tblViewPartner.BorderWidth = Unit.Pixel(1);
                tblViewPartner.CellPadding = 5;
                tblViewPartner.HorizontalAlign = HorizontalAlign.Center;
                tblSearch.ID = "tblSearch";
                tblSearch.Width = Unit.Percentage(75);
                tblSearch.BorderColor = ColorTranslator.FromHtml("#8CC3FF");
                tblSearch.BorderStyle = BorderStyle.Solid;
                tblSearch.BorderWidth = Unit.Pixel(1);
                tblSearch.CellPadding = 5;
                tblSearch.HorizontalAlign = HorizontalAlign.Center;
                lblStatus.ID = "lblStatus";
                //lblStatus.Text = "";
                #region view Partner Controls
                //View Partner
                gvPartner.ID = "gvPartner";
                hdnDelPartner.ID = "hdnDelPartner";
                pnlPartner.ID = "pnlPartner";
                lblSrchCompany.ID = "lblSrchCompany";
                lblSrchCompany.Text = "Partner Company Name";
                txtSrchCompany.ID = "txtSrchCompany";
                lblSrchBizVertical.ID = "lblSrchBizVertical";
                lblSrchBizVertical.Text = "Business Vertical";
                ddlSrchBizVertical.ID = "ddlSrchBizVertical";
                lblSrchLicensePrice.ID = "lblSrchLicensePrice";
                lblSrchLicensePrice.Text = "PriceList";
                ddlSrchLicensePrice.ID = "ddlSrchLicensePrice";
                lblSrchStatus.ID = "lblSrchStatus";
                lblSrchStatus.Text = "Status";
                ddlSrchStatus.ID = "ddlSrchStatus";
                lblExpiryDate.ID = "lblExpiryDate";
                lblExpiryDate.Text = "Month & Year of Expiry";
                txtExpiryDate.ID = "txtExpiryDate";
                imgCalExpiry.ID = "imgCalExpiry";
                imgCalExpiry.ImageUrl = "/Source/calender.jpeg";
                CalExpiryDate.ID = "CalExpiryDate";
                CalExpiryDate.Format = "MM/yyyy";
                CalExpiryDate.TargetControlID = "txtExpiryDate";
                CalExpiryDate.PopupButtonID = "imgCalExpiry";
                btnSearch.ID = "btnSearch";
                btnSearch.Text = "Search";
                btnSearch.ForeColor = Color.White;
                btnSearch.BackColor = ColorTranslator.FromHtml("#0869D6");
                btnSearch.CausesValidation = false;
                btnDelete.ID = "btnDelete";
                btnDelete.Text = "Delete";
                btnDelete.CausesValidation = false;
                btnDelete.ForeColor = Color.White;
                btnDelete.BackColor = ColorTranslator.FromHtml("#0869D6");
                btnAddPartner.ID = "btnAddPartner";
                btnAddPartner.Text = "Add partner";
                btnAddPartner.CausesValidation = false;
                btnAddPartner.ForeColor = Color.White;
                btnAddPartner.BackColor = ColorTranslator.FromHtml("#0869D6");
                #endregion
                #region Add Partner Control Initialization
                #region Add Table Controls
                tblPartnerDetail.ID = "tblPartnerDetail";
                tblPartnerDetail.Width = Unit.Percentage(85);
                tblPartnerDetail.BorderColor = ColorTranslator.FromHtml("#8CC3FF");
                tblPartnerDetail.BorderStyle = BorderStyle.Solid;
                tblPartnerDetail.BorderWidth = Unit.Pixel(1);
                tblPartnerDetail.CellPadding = 5;
                tblPartnerDetail.HorizontalAlign = HorizontalAlign.Center;
                tblPartnerDetail.Visible = false;
                tblPricingPatner.ID = "tblPricingPatner";
                tblPricingPatner.Width = Unit.Percentage(100);
                tblPricingPatner.HorizontalAlign = HorizontalAlign.Left;
                tblPricingPatner.Visible = false;
                tblProductYear.ID = "tblProductYear";
                tblProductYear.Width = Unit.Percentage(100);
                tblProductYear.HorizontalAlign = HorizontalAlign.Left;
                tblProductYear.Visible = false;
                tblAlternateContact1.ID = "tblAlternateContact1";
                tblAlternateContact1.Width = Unit.Percentage(100);
                tblAlternateContact1.HorizontalAlign = HorizontalAlign.Left;
                tblAlternateContact1.Visible = false;
                tblAlternateContact1.BorderColor = ColorTranslator.FromHtml("#8CC3FF");
                tblAlternateContact1.BorderStyle = BorderStyle.Solid;
                tblAlternateContact1.BorderWidth = Unit.Pixel(1);
                tblAlternateContact2.ID = "tblAlternateContact2";
                tblAlternateContact2.Width = Unit.Percentage(100);
                tblAlternateContact2.HorizontalAlign = HorizontalAlign.Left;
                tblAlternateContact2.Visible = false;
                tblAlternateContact2.BorderColor = ColorTranslator.FromHtml("#8CC3FF");
                tblAlternateContact2.BorderStyle = BorderStyle.Solid;
                tblAlternateContact2.BorderWidth = Unit.Pixel(1);
                tblBillingContact.ID = "tblBillingContact";
                tblBillingContact.Width = Unit.Percentage(100);
                tblBillingContact.HorizontalAlign = HorizontalAlign.Left;
                tblBillingContact.Visible = false;
                tblBillingContact.BorderColor = ColorTranslator.FromHtml("#8CC3FF");
                tblBillingContact.BorderStyle = BorderStyle.Solid;
                tblBillingContact.BorderWidth = Unit.Pixel(1);
                tblBillingEscContact.ID = "tblBillingEscContact";
                tblBillingEscContact.Width = Unit.Percentage(100);
                tblBillingEscContact.HorizontalAlign = HorizontalAlign.Left;
                tblBillingEscContact.Visible = false;
                tblBillingEscContact.BorderColor = ColorTranslator.FromHtml("#8CC3FF");
                tblBillingEscContact.BorderStyle = BorderStyle.Solid;
                tblBillingEscContact.BorderWidth = Unit.Pixel(1);
                tblProductYear.ID = "tblProductYear";
                tblProductYear.Width = Unit.Percentage(100);
                tblProductYear.HorizontalAlign = HorizontalAlign.Left;
                tblProductYear.Visible = false;
                #endregion
                #region Partner Details
                lblSPLANo.ID = "lblSPLANo";
                lblSPLANo.Text = "SPLA No.";
                lblStar.ID = "lblStar";
                lblStar.Text = "*";
                lblStar.ForeColor = Color.Red;
                lblStar.Visible = true;
                txtSPLANo.ID = "txtSPLANo";
                txtSPLANo.MaxLength = 15;
                rqPartnerCode.ID = "rqPartnerCode";
                rqPartnerCode.ControlToValidate = "txtSPLANo";
                rqPartnerCode.ErrorMessage = "Required";
                rqPartnerCode.ForeColor = Color.Red;
                lblEnrollmentNo.ID = "lblEnrollmentNo";
                lblEnrollmentNo.Text = "Enrollment No.";
                txtEnrollmentNo.ID = "txtEnrollmentNo";
                txtEnrollmentNo.MaxLength = 15;
                rqenrollmentNo.ID = "rqenrollmentNo";
                rqenrollmentNo.ControlToValidate = "txtEnrollmentNo";
                rqenrollmentNo.ErrorMessage = "Required";
                rqenrollmentNo.ForeColor = Color.Red;
                regnumbers.ID = "regnumbers";
                regnumbers.ControlToValidate = "txtEnrollmentNo";
                regnumbers.ErrorMessage = "Enter only numbers";
                regnumbers.ValidationExpression = "^[0-9]*$";
                regnumbers.ForeColor = Color.Red;

                lblMBSCNo.ID = "lblMBSCNo";
                lblMBSCNo.Text = "MBSA No.";
                txtMBSCNo.ID = "txtMBSCNo";
                txtMBSCNo.MaxLength = 15;
                rqMBSCNo.ID = "rqMBSCNo";
                rqMBSCNo.ControlToValidate = "txtMBSCNo";
                rqMBSCNo.ErrorMessage = "Required";
                rqMBSCNo.ForeColor = Color.Red;
                lblMPNNo.ID = "lblMPNNo";
                lblMPNNo.Text = "MPN No.";
                txtMPNNo.ID = "txtMPNNo";
                txtMPNNo.MaxLength = 15;
                rqMPNNo.ID = "rqMPNNo";
                rqMPNNo.ControlToValidate = "txtMPNNo";
                rqMPNNo.ErrorMessage = "Required";
                rqMPNNo.ForeColor = Color.Red;
                lblPartnerCompanyName.ID = "lblPartnerCompanyName";
                lblPartnerCompanyName.Text = "Company Name";
                txtPartnerCompanyName.ID = "txtPartnerCompanyName";
                txtPartnerCompanyName.MaxLength = 100;
                rqPartnerCompanyName.ID = "rqPartnerCompanyName";
                rqPartnerCompanyName.ControlToValidate = "txtPartnerCompanyName";
                rqPartnerCompanyName.ErrorMessage = "Required";
                rqPartnerCompanyName.ForeColor = Color.Red;
                lblPartnerAuthName.ID = "lblPartnerAuthName";
                lblPartnerAuthName.Text = "Authorized Signatory's Name";
                txtPartnerAuthName.ID = "txtPartnerAuthName";
                txtPartnerAuthName.MaxLength = 100;
                rqPartnerAuthName.ID = "rqPartnerAuthName";
                rqPartnerAuthName.ControlToValidate = "txtPartnerAuthName";
                rqPartnerAuthName.ErrorMessage = "Required";
                rqPartnerAuthName.ForeColor = Color.Red;
                lblPartnerDesignation.ID = "lblPartnerDesignation";
                lblPartnerDesignation.Text = "Designation";
                txtPartnerDesignation.ID = "txtPartnerDesignation";
                txtPartnerDesignation.MaxLength = 100;
                rqPartnerDesignation.ID = "rqPartnerDesignation";
                rqPartnerDesignation.ControlToValidate = "txtPartnerDesignation";
                rqPartnerDesignation.ErrorMessage = "Required";
                rqPartnerDesignation.ForeColor = Color.Red;
                lblPartnerFromDate.ID = "lblPartnerFromDate";
                lblPartnerFromDate.Text = "Validity of License Agreement";
                txtPartnerFromDate.ID = "txtPartnerFromDate";
                txtPartnerFromDate.MaxLength = 10;
                txtPartnertoDate.MaxLength = 10;
                txtPartnertoDate.ID = "txtPartnertoDate";
                ceLicenseFrom.ID = "ceLicenseFrom";
                ceLicenseFrom.Format = "dd/MM/yyyy";
                ceLicenseFrom.TargetControlID = "txtPartnerFromDate";
                ceLicenseFrom.PopupButtonID = "imgCalenderfrm";
                imgCalenderfrm.ID = "imgCalenderfrm";
                imgCalenderfrm.ImageUrl = "/Source/calender.jpeg";
                ceLicenseTo.ID = "ceLicenseTo";
                ceLicenseTo.Format = "dd/MM/yyyy";
                ceLicenseTo.TargetControlID = "txtPartnertoDate";
                ceLicenseTo.PopupButtonID = "imgCalenderto";
                imgCalenderto.ID = "imgCalenderto";
                imgCalenderto.ImageUrl = "/Source/calender.jpeg";
                rqLicenseFrmDate.ID = "rqLicenseFrmDate";
                rqLicenseFrmDate.ControlToValidate = "txtPartnerFromDate";
                rqLicenseFrmDate.ErrorMessage = "Required";
                rqLicenseFrmDate.ForeColor = Color.Red;
                rqLicenseToDate.ID = "rqLicenseToDate";
                rqLicenseToDate.ControlToValidate = "txtPartnertoDate";
                rqLicenseToDate.ErrorMessage = "Required";
                rqLicenseToDate.ForeColor = Color.Red;
                reLicenseDate.ID = "reLicenseDate";
                reLicenseDate.ControlToValidate = "txtPartnerFromDate";
                reLicenseDate.ErrorMessage = "Invalid Date";
                reLicenseDate.ForeColor = Color.Red;
                reLicenseDate.ValidationExpression = @"(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d";
                reLicenseToDate.ID = "reLicenseToDate";
                reLicenseToDate.ControlToValidate = "txtPartnertoDate";
                reLicenseToDate.ErrorMessage = "Invalid Date";
                reLicenseToDate.ForeColor = Color.Red;
                reLicenseToDate.ValidationExpression = @"(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d";
                cmpPartDate.ID = "cmpPartDate";
                cmpPartDate.ControlToValidate = "txtPartnerFromDate";
                cmpPartDate.ControlToCompare = "txtPartnertoDate";
                cmpPartDate.Operator = ValidationCompareOperator.LessThan;
                cmpPartDate.Type = ValidationDataType.Date;
                cmpPartDate.ErrorMessage = "To Date should be greater than From Date";
                cmpPartDate.ForeColor = Color.Red;
                #endregion
                #region Parnter Address Controls
                lblPartnerEmailID.ID = "lblPartnerEmailID";
                lblPartnerEmailID.Text = "Email ID";
                txtPartnerEmailID.ID = "txtPartnerEmailID";
                txtPartnerEmailID.MaxLength = 100;
                rqPartnerEmailID.ID = "rqPartnerEmailID";
                rqPartnerEmailID.ControlToValidate = "txtPartnerEmailID";
                rqPartnerEmailID.ErrorMessage = "Required";
                rqPartnerEmailID.ForeColor = Color.Red;
                //rqPartnerEmailID.Display = ValidatorDisplay.None;
                rePartnerEmailID.ID = "rePartnerEmailID";
                rePartnerEmailID.ControlToValidate = "txtPartnerEmailID";
                rePartnerEmailID.ErrorMessage = "Enter valid mail ID Eg: a@a.com";
                rePartnerEmailID.ForeColor = Color.Red;
                //rePartnerEmailID.ValidationExpression=@"^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$";
                rePartnerEmailID.ValidationExpression = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|" + @"0-9]+([_][a-z|0-9]+)*)?@.[a-z|0-9|]*([-][a-z|0-9]+)*\.([a-z]" + @"[a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$";
                // rePartnerEmailID.Display = ValidatorDisplay.None;
                lblPartnerAddress.ID = "lblPartnerAddress";
                lblPartnerAddress.Text = "Corporate Office Address";
                txtPartnerAddress.ID = "txtPartnerAddress";
                txtPartnerAddress.MaxLength = 250;
                rqPartnerAddress.ID = "rqPartnerAddress";
                rqPartnerAddress.ControlToValidate = "txtPartnerAddress";
                rqPartnerAddress.ErrorMessage = "Required";
                rqPartnerAddress.ForeColor = Color.Red;
                lblPartnerAddress1.ID = "lblPartnerAddress 1";
                lblPartnerAddress1.Text = "Corporate Office Address1";
                txtPartnerAddress1.ID = "txtPartnerAddress1";
                txtPartnerAddress1.MaxLength = 200;
                lblPartnerCity.ID = "lblPartnerCity";
                lblPartnerCity.Text = "City";
                txtPartnerCity.ID = "txtPartnerCity";
                txtPartnerCity.MaxLength = 50;
                rqPartnerCity.ID = "rqPartnerCity";
                rqPartnerCity.ControlToValidate = "txtPartnerCity";
                rqPartnerCity.ErrorMessage = "Required";
                rqPartnerCity.ForeColor = Color.Red;
                lblPartnerState.ID = "lblPartnerState";
                lblPartnerState.Text = "State";
                ddlPartnerState.ID = "ddlPartnerState";
                rqPartnerState.ID = "rqPartnerState";
                rqPartnerState.ControlToValidate = "ddlPartnerState";
                rqPartnerState.ErrorMessage = "Required";
                rqPartnerState.ForeColor = Color.Red;
                rqPartnerState.InitialValue = "-1";
                lblTelephone.ID = "lblTelephone";
                lblTelephone.Text = "Telephone No";
                txtTelephone.ID = "txtTelephone";
                txtTelephone.MaxLength = 15;
                rqPartnerPhone.ID = "rqPartnerPhone";
                rqPartnerPhone.ControlToValidate = "txtTelephone";
                rqPartnerPhone.ErrorMessage = "Required";
                rqPartnerPhone.ForeColor = Color.Red;
                //rqPartnerPhone.Display = ValidatorDisplay.None;
                rePartnerPhone.ID = "rePartnerPhone";
                rePartnerPhone.ControlToValidate = "txtTelephone";
                rePartnerPhone.ErrorMessage = "Enter a Valid Phone No. Eg: 044-22334455";
                rePartnerPhone.ForeColor = Color.Red;
                rePartnerPhone.ValidationExpression = @"^[0-9]\d{2,4}-\d{6,8}$";
                txtPartnerCompanyName.Enabled = true;
                lblPartnerFax.ID = "lblPartnerFax";
                lblPartnerFax.Text = "Fax";
                txtPartnerFax.ID = "txtPartnerFax";
                txtPartnerFax.MaxLength = 15;
                rePartnerFax.ID = "rePartnerFax";
                rePartnerFax.ControlToValidate = "txtPartnerFax";
                rePartnerFax.ErrorMessage = "Enter a valid Phone No. Eg: 044-22334455";
                rePartnerFax.ForeColor = Color.Red;
                rePartnerFax.ValidationExpression = @"^[0-9]\d{2,4}-\d{6,8}$";
                lblPartnerMobile.ID = "lblPartnerMobile";
                lblPartnerMobile.Text = "Mobile";
                txtPartnerMobile.ID = "txtPartnerMobile";
                txtPartnerMobile.MaxLength = 10;
                rePartnerMobile.ControlToValidate = "txtPartnerMobile";
                rePartnerMobile.ErrorMessage = "Enter a valid Mobile No.";
                rePartnerMobile.ForeColor = Color.Red;
                rePartnerMobile.ValidationExpression = @"^((\+)?(\d{2}[-]))?(\d{10}){1}?$";
                #endregion
                #region Shipping Details
                lblShippingContact.ID = "lblShippingContact";
                lblShippingContact.Text = "Shipping Contact Person";
                txtShippingContact.ID = "txtShippingContact";
                txtShippingContact.MaxLength = 100;
                lblShippingAddress.ID = "lblShippingAddress";
                lblShippingAddress.Text = "Shipping Address";
                txtShippingAddress.ID = "txtShippingAddress";
                lblShippingAddress1.ID = "lblShippingAddress1";
                lblShippingAddress1.Text = "Shipping Address 1";
                txtShippingAddress1.ID = "txtShippingAddress1";
                txtShippingAddress1.MaxLength = 200;
                lblShippingCity.ID = "lblShippingCity";
                lblShippingCity.Text = "Shipping City";
                txtShippingCity.ID = "txtShippingCity";
                txtShippingCity.MaxLength = 100;
                lblShippingState.ID = "lblShippingState";
                lblShippingState.Text = "Shipping State";
                ddlShippingState.ID = "ddlShippingState";
                lblShippingTelephone.ID = "lblShippingTelephone";
                lblShippingTelephone.Text = "Telephone No";
                txtShippingTelephone.ID = "txtShippingTelephone";
                txtShippingTelephone.MaxLength = 15;
                reShippingTelephone.ID = "reShippingTelephone";
                reShippingTelephone.ControlToValidate = "txtShippingTelephone";
                reShippingTelephone.ErrorMessage = "Enter a Valid Phone No. Eg: 044-22334455";
                reShippingTelephone.ForeColor = Color.Red;
                reShippingTelephone.ValidationExpression = @"^[0-9]\d{2,4}-\d{6,8}$";
                lblShippingFax.ID = "lblShippingFax";
                lblShippingFax.Text = "Fax";
                txtShippingFax.ID = "txtShippingFax";
                txtShippingFax.MaxLength = 15;
                reShippingFax.ID = "reShippingFax";
                reShippingFax.ControlToValidate = "txtShippingFax";
                reShippingFax.ErrorMessage = "Enter a Valid FAX No. Eg: 044-22334455";
                reShippingFax.ForeColor = Color.Red;
                reShippingFax.ValidationExpression = @"^[0-9]\d{2,4}-\d{6,8}$";
                lblShippingMobile.ID = "lblShippingMobile";
                lblShippingMobile.Text = "Mobile";
                txtShippingMobile.ID = "txtShippingMobile";
                txtShippingMobile.MaxLength = 10;
                reShippingMobile.ID = "reShippingMobile";
                reShippingMobile.ControlToValidate = "txtShippingMobile";
                reShippingMobile.ErrorMessage = "InValid";
                reShippingMobile.ForeColor = Color.Red;
                reShippingMobile.ValidationExpression = @"^((\+)?(\d{2}[-]))?(\d{10}){1}?$";
                lblShippingEmail.ID = "lblShippingEmail";
                lblShippingEmail.Text = "Shipping Contact Email ID";
                txtShippingEmail.ID = "txtShippingEmail";
                txtShippingEmail.MaxLength = 100;
                reShippingEmail.ID = "reShippingEmail";
                reShippingEmail.ControlToValidate = "txtShippingEmail";
                reShippingEmail.ErrorMessage = "Invalid";
                reShippingEmail.ForeColor = Color.Red;
                reShippingEmail.ValidationExpression = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|" + @"0-9]+([_][a-z|0-9]+)*)?@.[a-z|0-9|]*([-][a-z|0-9]+)*\.([a-z]" + @"[a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$";
                #endregion
                chkContact1.ID = "chkContact1";
                chkContact1.Text = "Usage SPOC";
                chkContact1.AutoPostBack = true;
                chkContact1.CausesValidation = false;
                chkContact2.ID = "chkContact2";
                chkContact2.Text = "Usage Escalation POC";
                chkContact2.AutoPostBack = true;
                chkContact2.CausesValidation = false;
                chkBillingContact.ID = "chkBillingContact";
                chkBillingContact.Text = "Billing Contact";
                chkBillingContact.AutoPostBack = true;
                chkBillingContact.CausesValidation = false;
                chkBillingEsculationContact.ID = "chkBillingEsculationContact";
                chkBillingEsculationContact.Text = "Billing Escalation Contact";
                chkBillingEsculationContact.AutoPostBack = true;
                chkBillingEsculationContact.CausesValidation = false;
                #region Communication Contact 1
                lblContact1Name.ID = "lblContact1Name";
                lblContact1Name.Text = "Usage Contact Name";
                txtContact1Name.ID = "txtContact1Name";
                txtContact1Name.MaxLength = 50;
                lblContact1phone.ID = "lblContact1phone";
                lblContact1phone.Text = "Usage Contact Phone";
                txtContact1phone.ID = "txtContact1phone";
                txtContact1phone.MaxLength = 15;
                rqConatct1pjone.ID = "rqConatct1pjone";
                rqConatct1pjone.ControlToValidate = "txtContact1phone";
                rqConatct1pjone.ErrorMessage = "Required";
                rqConatct1pjone.ForeColor = Color.Red;
                reContact1phone.ID = "reContact1phone";
                reContact1phone.ControlToValidate = "txtContact1phone";
                reContact1phone.ErrorMessage = "Enter a Valid Phone No. Eg: 044-22334455";
                reContact1phone.ForeColor = Color.Red;
                reContact1phone.ValidationExpression = @"^[0-9]\d{2,4}-\d{6,8}$";
                lblContact1Mobile.ID = "lblContact1Mobile";
                lblContact1Mobile.Text = "Usage Contact Mobile";
                txtContact1Mobile.ID = "txtContact1Mobile";
                txtContact1Mobile.MaxLength = 10;
                rqContact1MObile.ID = "rqContact1MObile";
                rqContact1MObile.ControlToValidate = "txtContact1Mobile";
                rqContact1MObile.ErrorMessage = "Required";
                rqContact1MObile.ForeColor = Color.Red;
                reContact1Mobile.ID = "reContact1Mobile";
                reContact1Mobile.ControlToValidate = "txtContact1Mobile";
                reContact1Mobile.ErrorMessage = "Invalid";
                reContact1Mobile.ForeColor = Color.Red;
                reContact1Mobile.ValidationExpression = @"^((\+)?(\d{2}[-]))?(\d{10}){1}?$";
                lblContact1Email.ID = "lblContact1Email";
                lblContact1Email.Text = "Usage Contact Email-ID";
                txtContact1Email.ID = "txtContact1Email";
                txtContact1Email.MaxLength = 100;
                rqContact1Email.ID = "rqContact1Email";
                rqContact1Email.ControlToValidate = "txtContact1Email";
                rqContact1Email.ErrorMessage = "Required";
                rqContact1Email.ForeColor = Color.Red;
                reContact1Email.ID = "reContact1Email";
                reContact1Email.ControlToValidate = "txtContact1Email";
                reContact1Email.ErrorMessage = "Invalid";
                reContact1Email.ForeColor = Color.Red;
                reContact1Email.ValidationExpression = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|" + @"0-9]+([_][a-z|0-9]+)*)?@.[a-z|0-9|]*([-][a-z|0-9]+)*\.([a-z]" + @"[a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$";
                #endregion
                #region Communication Contact 2
                lblContact2Name.ID = "lblContact2Name";
                lblContact2Name.Text = "Usage Escalation Contact Name";
                txtContact2Name.ID = "txtContact2Name";
                txtContact2Name.MaxLength = 100;
                lblContact2phone.ID = "lblContact2phone";
                lblContact2phone.Text = "Usage Escalation Contact Phone";
                txtContact2phone.ID = "txtContact2phone";
                txtContact2phone.MaxLength = 15;
                rqconatact2phone.ID = "rqconatact2phone";
                rqconatact2phone.ControlToValidate = "txtContact2phone";
                rqconatact2phone.ErrorMessage = "Required";
                rqconatact2phone.ForeColor = Color.Red;
                reContact2phone.ID = "reContact2phone";
                reContact2phone.ControlToValidate = "txtContact2phone";
                reContact2phone.ErrorMessage = "Enter a Valid Phone No. Eg: 044-22334455";
                reContact2phone.ForeColor = Color.Red;
                reContact2phone.ValidationExpression = @"^[0-9]\d{2,4}-\d{6,8}$";
                lblContact2Mobile.ID = "lblContact2Mobile";
                lblContact2Mobile.Text = "Usage Excalation Contact Mobile";
                txtContact2Mobile.ID = "txtContact2Mobile";
                txtContact2Mobile.MaxLength = 10;
                rqConatact2Mobile.ID = "rqConatact2Mobile";
                rqConatact2Mobile.ControlToValidate = "txtContact2Mobile";
                rqConatact2Mobile.ErrorMessage = "Required";
                rqConatact2Mobile.ForeColor = Color.Red;
                reContact2Mobile.ID = "reContact2Mobile";
                reContact2Mobile.ControlToValidate = "txtContact2Mobile";
                reContact2Mobile.ErrorMessage = "Invalid";
                reContact2Mobile.ForeColor = Color.Red;
                reContact2Mobile.ValidationExpression = @"^((\+)?(\d{2}[-]))?(\d{10}){1}?$";
                lblContact2Email.ID = "lblContact2Email";
                lblContact2Email.Text = "Usage Escalation Contact Email-ID";
                txtContact2Email.ID = "txtContact2Email";
                txtContact2Email.MaxLength = 100;
                rqConatact2Email.ID = "rqConatact2Email";
                rqConatact2Email.ControlToValidate = "txtContact2Email";
                rqConatact2Email.ErrorMessage = "Required";
                rqConatact2Email.ForeColor = Color.Red;
                reContact2Email.ID = "reContact2Email";
                reContact2Email.ControlToValidate = "txtContact2Email";
                reContact2Email.ErrorMessage = "Invalid";
                reContact2Email.ForeColor = Color.Red;
                reContact2Email.ValidationExpression = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|" + @"0-9]+([_][a-z|0-9]+)*)?@.[a-z|0-9|]*([-][a-z|0-9]+)*\.([a-z]" + @"[a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$";
                #endregion
                #region Billing Contact
                lblBillingName.ID = "lblBillingName";
                lblBillingName.Text = "Billing Contact Name";
                txtBillingName.ID = "txtBillingName";
                txtBillingName.MaxLength = 50;
                rqBillingName.ID = "rqBillingName";
                rqBillingName.ControlToValidate = "txtBillingName";
                rqBillingName.ErrorMessage = "Required";
                rqBillingName.ForeColor = Color.Red;
                lblBillingphone.ID = "lblBillingphone";
                lblBillingphone.Text = "Billing Contact Phone";
                txtBillingphone.ID = "txtBillingphone";
                txtBillingphone.MaxLength = 15;
                rqBillingphone.ID = "rqBillingphone";
                rqBillingphone.ControlToValidate = "txtBillingphone";
                rqBillingphone.ErrorMessage = "Required";
                rqBillingphone.ForeColor = Color.Red;
                reBillingphone.ID = "reBillingphone";
                reBillingphone.ControlToValidate = "txtBillingphone";
                reBillingphone.ErrorMessage = "Enter a Valid Phone No. Eg: 044-22334455";
                reBillingphone.ForeColor = Color.Red;
                reBillingphone.ValidationExpression = @"^[0-9]\d{2,4}-\d{6,8}$";
                lblBillingMobile.ID = "lblBillingMobile";
                lblBillingMobile.Text = "Billing Contact Mobile";
                txtBillingMobile.ID = "txtBillingMobile";
                txtBillingMobile.MaxLength = 10;
                rqBillingMobile.ID = "rqBillingMobile";
                rqBillingMobile.ControlToValidate = "txtBillingMobile";
                rqBillingMobile.ErrorMessage = "Required";
                rqBillingMobile.ForeColor = Color.Red;
                reBillingMobile.ID = "reBillingMobile";
                reBillingMobile.ControlToValidate = "txtBillingMobile";
                reBillingMobile.ErrorMessage = "Invalid";
                reBillingMobile.ForeColor = Color.Red;
                reBillingMobile.ValidationExpression = @"^((\+)?(\d{2}[-]))?(\d{10}){1}?$";
                lblBillingEmail.ID = "lblBillingEmail";
                lblBillingEmail.Text = "Billing Contact Email-ID";
                txtBillingEmail.ID = "txtBillingEmail";
                txtBillingEmail.MaxLength = 100;
                rqBillingEmail.ID = "rqBillingEmail";
                rqBillingEmail.ControlToValidate = "txtBillingEmail";
                rqBillingEmail.ErrorMessage = "Required";
                rqBillingEmail.ForeColor = Color.Red;
                reBillingEmail.ID = "reBillingEmail";
                reBillingEmail.ControlToValidate = "txtBillingEmail";
                reBillingEmail.ErrorMessage = "Invalid";
                reBillingEmail.ForeColor = Color.Red;
                reBillingEmail.ValidationExpression = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|" + @"0-9]+([_][a-z|0-9]+)*)?@.[a-z|0-9|]*([-][a-z|0-9]+)*\.([a-z]" + @"[a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$";
                #region billesculation
                lblBillingexculationName.ID = "lblBillingexculationName";
                lblBillingexculationName.Text = "Billing Escaln. Contact Name";
                txtBillingeScName.ID = "txtBillingeScName";
                txtBillingeScName.MaxLength = 50;
                rqBillingEscName.ID = "rqBillingEscName";
                rqBillingEscName.ControlToValidate = "txtBillingeScName";
                rqBillingEscName.ErrorMessage = "Required";
                rqBillingEscName.ForeColor = Color.Red;
                lblBillingescphone.ID = "lblBillingescphone";
                lblBillingescphone.Text = "Billing Escaln. Contact Phone";
                txtBillingescphone.ID = "txtBillingescphone";
                txtBillingescphone.MaxLength = 15;
                rqBillingescphone.ID = "rqBillingescphone";
                rqBillingescphone.ControlToValidate = "txtBillingescphone";
                rqBillingescphone.ErrorMessage = "Required";
                rqBillingescphone.ForeColor = Color.Red;
                reBillingescphone.ID = "reBillingescphone";
                reBillingescphone.ControlToValidate = "txtBillingescphone";
                reBillingescphone.ErrorMessage = "Enter a Valid Phone No. Eg: 044-22334455";
                reBillingescphone.ForeColor = Color.Red;
                reBillingescphone.ValidationExpression = @"^[0-9]\d{2,4}-\d{6,8}$";
                lblBillingescMobile.ID = "lblBillingescMobile";
                lblBillingescMobile.Text = "Billing Escaln.Contact Mobile";
                txtBillingescMobile.ID = "txtBillingescMobile";
                txtBillingescMobile.MaxLength = 10;
                rqBillingescMobile.ID = "rqBillingescMobile";
                rqBillingescMobile.ControlToValidate = "txtBillingescMobile";
                rqBillingescMobile.ErrorMessage = "Required";
                rqBillingescMobile.ForeColor = Color.Red;
                reBillingescMobile.ID = "reBillingescMobile";
                reBillingescMobile.ControlToValidate = "txtBillingescMobile";
                reBillingescMobile.ErrorMessage = "Invalid";
                reBillingescMobile.ForeColor = Color.Red;
                reBillingescMobile.ValidationExpression = @"^((\+)?(\d{2}[-]))?(\d{10}){1}?$";
                lblBillingescEmail.ID = "lblBillingescEmail";
                lblBillingescEmail.Text = "Billing Escaln.Contact Email-ID";
                txtBillingescEmail.ID = "txtBillingescEmail";
                txtBillingescEmail.MaxLength = 100;
                rqBillingescEmail.ID = "rqBillingescEmail";
                rqBillingescEmail.ControlToValidate = "txtBillingescEmail";
                rqBillingescEmail.ErrorMessage = "Required";
                rqBillingescEmail.ForeColor = Color.Red;
                reBillingescEmail.ID = "reBillingescEmail";
                reBillingescEmail.ControlToValidate = "txtBillingescEmail";
                reBillingescEmail.ErrorMessage = "Invalid";
                reBillingescEmail.ForeColor = Color.Red;
                reBillingescEmail.ValidationExpression = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|" + @"0-9]+([_][a-z|0-9]+)*)?@.[a-z|0-9|]*([-][a-z|0-9]+)*\.([a-z]" + @"[a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$";
                #endregion
                #endregion
                #region Misc partner controls
                lblbizVertical.ID = "lblbizVertical";
                lblbizVertical.Text = "Business Vertical";
                ddlBizVertical.ID = "ddlBizVertical";
                rqBizVertical.ID = "rqBizVertical";
                rqBizVertical.ControlToValidate = "ddlBizVertical";
                rqBizVertical.ErrorMessage = "Required";
                rqBizVertical.ForeColor = Color.Red;
                rqBizVertical.InitialValue = "-1";
                lblUserName.ID = "lblUserName";
                lblUserName.Text = "User Name";
                txtUserName.ID = "txtUserName";
                txtUserName.MaxLength = 100;
                rqUserName.ID = "rqUserName";
                rqUserName.ControlToValidate = "txtUserName";
                rqUserName.ErrorMessage = "Required";
                rqUserName.ForeColor = Color.Red;
                lblPassword.ID = "lblPassword";
                lblPassword.Text = "Password";
                txtPassword.ID = "txtPassword";
                txtPassword.MaxLength = 12;
                txtPassword.TextMode = TextBoxMode.Password;
                rqPassword.ID = "rqPassword";
                rqPassword.ControlToValidate = "txtPassword";
                rqPassword.ErrorMessage = "Required";
                rqPassword.ForeColor = Color.Red;
                //pwdStrength.ID = "pwdStrength";
                //pwdStrength.TargetControlID = "txtPassword";
                //pwdStrength.PreferredPasswordLength = 8;
                //pwdStrength.MinimumNumericCharacters = 1;
                //pwdStrength.StrengthIndicatorType = StrengthIndicatorTypes.Text;
                //pwdStrength.TextStrengthDescriptions = "Weak; Not Good; Good";
                //pwdStrength.DisplayPosition = DisplayPosition.RightSide;
                //pwdStrength.StrengthStyles = "TextStrengthWeak; TextStrengthNotGood; TextStrengthGood";
                rePwdValidator.ID = "rePwdValidator";
                rePwdValidator.ControlToValidate = "txtPassword";
                rePwdValidator.ErrorMessage = "Min 8 chars & Max 15 chars";
                rePwdValidator.ValidationExpression = @"^.{8,15}$";
                //rePwdValidator.ValidationExpression = @"(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{4,8})$"; (Atleast 1 char, 1 number)
                DataTable dtsubamt = SPLAAdminHelper.GetSubscriptionAmount();
                lblSubscriptionAmt.ID = "lblSubscriptionAmt";
                lblSubscriptionAmt.Text = "Subscription Amount";
                txtSubscriptionAmt.ID = "txtSubscriptionAmt";
                txtSubscriptionAmt.Text = "0";
                //if (dtsubamt.Rows.Count > 0)
                //{
                //    txtSubscriptionAmt.Text = dtsubamt.Rows[0]["SubscriptionAmount"].ToString();
                //}
                txtSubscriptionAmt.Width = Unit.Pixel(100);
                txtSubscriptionAmt.MaxLength = 10;
                reSubscriptionAmt.ID = "reSubscriptionAmt";
                reSubscriptionAmt.ValidationExpression = @"^[0-9]+(\.[0-9]{1,2})?$";//"(0[1-9]|[12][0-9]|3[01])";
                reSubscriptionAmt.ErrorMessage = "Invalid";
                reSubscriptionAmt.ControlToValidate = "txtSubscriptionAmt";
                               
              
                DataTable dtdate = SPLAAdminHelper.GetUsageDate();
                lblfrmDate.ID = "lblfrmDate";
                lblfrmDate.Text = "Monthly Usage Submission End Date";
                txtfrmDate.ID = "txtfrmDate";
                txtfrmDate.MaxLength = 2;
                txtfrmDate.Width = Unit.Pixel(20);
                txtfrmDate.Text = dtdate.Rows[0]["Date"].ToString();
                if (dtdate.Rows.Count > 0)
                {
                    ddlDate.SelectedValue = dtdate.Rows[0]["Date"].ToString();
                }
                rqfrmDate.ID = "rqfrmDate";
                rqfrmDate.ControlToValidate = "txtfrmDate";
                rqfrmDate.ErrorMessage = "*";
                rqfrmDate.ForeColor = Color.Red;
                rgvfrmDate.ID = "rgvfrmDate";
                rgvfrmDate.MinimumValue = "1";
                rgvfrmDate.MaximumValue = "31";
                rgvfrmDate.Type = ValidationDataType.Integer;
                rgvfrmDate.ErrorMessage = "Invalid";
                rgvfrmDate.ControlToValidate = "txtfrmDate";
                rgvfrmDate.ForeColor = Color.Red;
                //DataTable dtusage = SPLAAdminHelper.GetSubmissionDate();
                txttoDate.ID = "txttoDate";
                txttoDate.MaxLength = 2;
                txttoDate.Width = Unit.Pixel(20);
                //txttoDate.Text = dtusage.Rows[0]["UsageDate"].ToString();
                rqtoDate.ID = "rqtoDate";
                rqtoDate.ControlToValidate = "txttoDate";
                rqtoDate.ErrorMessage = "*";
                rqtoDate.ForeColor = Color.Red;
                rgvtoDate.ID = "rgvtoDate";
                rgvtoDate.MinimumValue = "1";
                rgvtoDate.MaximumValue = "31";
                rgvtoDate.Type = ValidationDataType.Integer;
                rgvtoDate.ErrorMessage = "Invalid";
                rgvtoDate.ControlToValidate = "txttoDate";
                rgvtoDate.ForeColor = Color.Red;
                cmpDate.ID = "cmpDate";
                cmpDate.ControlToValidate = "txtfrmDate";
                cmpDate.ControlToCompare = "txttoDate";
                cmpDate.Operator = ValidationCompareOperator.LessThanEqual;
                cmpDate.Type = ValidationDataType.Integer;
                cmpDate.ErrorMessage = "To Date should be greater than From Date";
                cmpDate.ForeColor = Color.Red;
                lblActive.ID = "lblActive";
                lblActive.Text = "Active";
                chkActive.ID = "chkActive";
                chkActive.Checked = true;
                lblMedia.ID = "lblMedia";
                lblMedia.Text = "Media";
                chkMediatype.ID = "chkMediatype";
                chkMediatype.Checked = true;
                lblThreeYearPrice.ID = "lblThreeYearPrice";
                lblThreeYearPrice.Text = "Three Year Price";
                chkThreeYrPrice.ID = "chkThreeYrPrice";
                chkThreeYrPrice.Checked = true;
                lblPricingPartner.ID = "lblPricingPartner";
                lblPricingPartner.Text = "Pricing for the Partner";
                ddlpricingPartner.ID = "ddlpricingPartner";
                ddlpricingPartner.AutoPostBack = true;
                rqPricing.ID = "rqPricing";
                rqPricing.ControlToValidate = "ddlpricingPartner";
                rqPricing.ErrorMessage = "Select any Price Type";
                rqPricing.ForeColor = Color.Red;
                rqPricing.InitialValue = "-1";
                lblRegFee.ID = "lblRegFee";
                lblRegFee.Text = "Registration Fee";
                rdoRegFee.ID = "rdoRegFee";
                rdoRegFee.Text = "Applicable";
                rdoRegFee.Checked = true;
                rdoRegFee.GroupName = "grpRegFee";
                rdoRegFeeNone.ID = "rdoRegFeeNone";
                rdoRegFeeNone.Text = "Not Applicable";
                rdoRegFeeNone.GroupName = "grpRegFee";
                lblLicenseType.ID = "lblLicenseType";
                lblLicenseType.Text = "PriceList";
                rdoLicenseType.ID = "rdoLicenseType";
                rdoLicenseType.Width = Unit.Pixel(120);
                rdoLicenseType.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
                rdoLicenseType.AutoPostBack = true;
                rqLicenseType.ID = "rqLicenseType";
                rqLicenseType.ErrorMessage = "License Type Required";
                rqLicenseType.ControlToValidate = "rdoLicenseType";
                //rqLicenseType.Display = ValidatorDisplay.None;
                rqLicenseType.ForeColor = Color.Red;
                lblProductYear.ID = "lblProductYear";
                lblProductYear.Text = "Year Of the Product";
                rdoProductYear.ID = "rdoProductYear";
                rdoProductYear.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
                rqProductYear.ID = "rqProductYear";
                rqProductYear.ErrorMessage = "Select any Product Year";
                rqProductYear.ControlToValidate = "rdoProductYear";
                //rqProductYear.Display = ValidatorDisplay.None;
                rqProductYear.ForeColor = Color.Red;
                lblpaymentType.ID = "lblpaymentType";
                lblpaymentType.Text = "Subscription Payment Option";
                ddlPaymentType.ID = "ddlPaymentType";
                ddlPaymentType.AutoPostBack = true;
                ddlPaymentType.SelectedIndexChanged += new EventHandler(ddlPaymentType_SelectedIndexChanged);
                ddlPaymentMonth.ID = "ddlPaymentMonth";
                lblPriority.ID = "lblPriority";
                lblPriority.Text = "Priority";
                ddlPriority.ID = "ddlPriority";
                rqPriority.ID = "rqPriority";
                rqPriority.ControlToValidate = "ddlPriority";
                rqPriority.ErrorMessage = "Select any Priority";
                rqPriority.ForeColor = Color.Red;
                rqPriority.InitialValue = "-1";
                //rqPriority.Display = ValidatorDisplay.None;
                hdnPartnerId.ID = "hdnPartnerId";
                btnSave.ID = "btnSave";
                btnSave.Text = "Update";
                btnSave.ForeColor = Color.White;
                btnSave.BackColor = ColorTranslator.FromHtml("#0869D6");
                btnSave.CausesValidation = true;
                btnSave.Width = Unit.Pixel(100);
                btnCancel.ID = "btnCancel";
                btnCancel.Text = "Cancel";
                btnCancel.ForeColor = Color.White;
                btnCancel.BackColor = ColorTranslator.FromHtml("#0869D6");
                btnCancel.CausesValidation = false;
                btnCancel.Width = Unit.Pixel(100);
                #endregion
                #endregion
                #region Events Handler
                this.btnDelete.Click += new EventHandler(btnDelete_Click);
                this.btnAddPartner.Click += new EventHandler(btnAddPartner_Click);
                //this.btnEditPartner.Click += new EventHandler(btnEditPartner_Click);
                this.btnSave.Click += new EventHandler(btnSave_Click);
                this.btnCancel.Click += new EventHandler(btnCancel_Click);
                this.btnSearch.Click += new EventHandler(btnSearch_Click);
                gvPartner.RowCreated += new System.Web.UI.WebControls.GridViewRowEventHandler(gvPartner_RowCreated);
                gvPartner.RowEditing += new GridViewEditEventHandler(gvPartner_RowEditing);
                this.InitGridView(ref gvPartner, "Partner");
                chkContact1.CheckedChanged += new EventHandler(chkContact1_CheckedChanged);
                chkContact2.CheckedChanged += new EventHandler(chkContact2_CheckedChanged);
                chkBillingContact.CheckedChanged += new EventHandler(chkBillingContact_CheckedChanged);
                chkBillingEsculationContact.CheckedChanged += new EventHandler(chkBillingEsculationContact_CheckedChanged);
                rdoLicenseType.SelectedIndexChanged += new EventHandler(rdoLicenseType_SelectedIndexChanged);
                ddlpricingPartner.SelectedIndexChanged += new EventHandler(ddlpricingPartner_SelectedIndexChanged);
                ddlpricingPartner.AutoPostBack = true;
                // <script type=’text/javascript’>_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;</script>
                string script;
                //Confirm delete for Partners
                script = "";
                script += "if(confirm('" + System.Configuration.ConfigurationSettings.AppSettings["ConfirmDelPartner"].ToString() + "'))";
                script += "{";
                script += "document.getElementById('" + base.ClientID + "_hdnDelPartner').value = 1;";
                script += "}";
                script += "else";
                script += "{";
                script += "document.getElementById('" + base.ClientID + "_hdnDelPartner').value = 0;";
                script += "}";
                btnDelete.Attributes.Add("onclick", script);
                #endregion
                // Check if user is authorized - Admin
                if (!CheckUserAuthorized())
                    HttpContext.Current.Response.Redirect("/default.aspx", false);
                loadBizVerticals(ddlSrchBizVertical);
                loadPricing(ddlSrchLicensePrice);
                loadStatus(ddlSrchStatus);
                rdoLicenseType.Items.Clear();
                loadLicenseType(rdoLicenseType);
                loadLicensePricing(ddlpricingPartner);
                rdoProductYear.Items.Clear();
                string script1 = "";
                script1 += "if(!(window.event.keyCode==46||window.event.keyCode==48||window.event.keyCode==49  ||window.event.keyCode==50||window.event.keyCode==51  ||event.keyCode==52||window.event.keyCode==53  ||window.event.keyCode==54||window.event.keyCode==55  ||window.event.keyCode==56||window.event.keyCode==57  || window.event.keyCode == 8 || window.event.keyCode == 37))  {    window.event.returnValue=false;  }";
                script1 += "if(window.event.keyCode==222 ||window.event.charCode==39)";
                script1 += "{window.event.returnValue=false;}";
                txtMBSCNo.Attributes.Add("onkeypress", script1);
                txtMPNNo.Attributes.Add("onkeypress", script1);
                //txtTelephone.Attributes.Add("onkeypress", script1);
               // txtShippingTelephone.Attributes.Add("onkeypress", script1);
               // txtContact2phone.Attributes.Add("onkeypress", script1);
                //txtContact1phone.Attributes.Add("onkeypress", script1);
                //txtBillingphone.Attributes.Add("onkeypress", script1);
                //txtBillingescphone.Attributes.Add("onkeypress", script1);               
                txtEnrollmentNo.Attributes.Add("onkeypress", script1);
                txttdds.Attributes.Add("onkeypress", script1);
                txtSPLANo.Attributes.Add("onkeypress", script1);
                txtSubscriptionAmt.Attributes.Add("onkeypress", script1);
                txtcreditlimit.Attributes.Add("onkeypress", script1);
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }

        }
        void chkSameUSeEsc_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (chkSameUSeEsc.Checked)
                {
                    txtContact2Name.Text = txtContact1Name.Text;
                    txtContact2Email.Text = txtContact1Email.Text;
                    txtContact2Mobile.Text = txtContact1Mobile.Text;
                    txtContact2phone.Text = txtContact1phone.Text;
                }
                else
                {
                    txtContact2Name.Text = "";
                    txtContact2Email.Text = "";
                    txtContact2Mobile.Text ="";
                    txtContact2phone.Text ="";
                }
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        void chkSameBillEsc_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (chkSameBillEsc.Checked)
                {
                    txtBillingeScName.Text = txtContact1Name.Text;
                    txtBillingescEmail.Text = txtContact1Email.Text;
                    txtBillingescMobile.Text = txtContact1Mobile.Text;
                    txtBillingescphone.Text = txtContact1phone.Text;
                }
                else
                {
                    txtBillingeScName.Text ="";
                    txtBillingescEmail.Text = "";
                    txtBillingescMobile.Text = "";
                    txtBillingescphone.Text ="";
                }
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        void chkSameBillCOn_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (chkSameBillCOn.Checked)
                {
                    txtBillingName.Text = txtContact1Name.Text;
                    txtBillingEmail.Text = txtContact1Email.Text;
                    txtBillingMobile.Text = txtContact1Mobile.Text;
                    txtBillingphone.Text = txtContact1phone.Text;
                }
                else
                {
                    txtBillingName.Text = "";
                    txtBillingEmail.Text = "";
                    txtBillingMobile.Text ="";
                    txtBillingphone.Text = "";
                }
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        void chkBillingEsculationContact_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (chkBillingEsculationContact.Checked)
                    tblBillingEscContact.Visible = true;
                else
                    tblBillingEscContact.Visible = false;
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        void ddlCurrencyType_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (ddlCurrencyType.SelectedItem.ToString().Contains("US"))
                {
                    chkstpino.Checked = true;
                    chkstpiyes.Checked = false;
                }
                if (!ddlCurrencyType.SelectedItem.ToString().Contains("US"))
                {
                    chkstpino.Checked = false;
                    chkstpiyes.Checked = true;
                }
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        void ddlPricelstcurrency_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (rdoLicenseType.Items.Count > 0)
                {
                    for (int i = 0; i < rdoLicenseType.Items.Count; i++)
                    {
                        rdoLicenseType.Items[i].Selected = false;
                    }
                }
                string currency = ddlPricelstcurrency.SelectedItem.ToString().Substring(0, 3);
                //lblCurrencyType.Text = currency.ToString();
                ddlCurrencyType.DataSource = SPLAAdminHelper.GetCurrencybyPriceList(currency);
                ddlCurrencyType.DataTextField = "ConversionType";
                ddlCurrencyType.DataValueField = "ConversionType";
                ddlCurrencyType.DataBind();
                if (ddlCurrencyType.Items.Count == 0)
                {
                    DisplayMessage("Please upload exchange rates and then select Billing Currencies", MessageType.Warning);
                }
                //ddlCurrencyType.Items.Insert(0, new ListItem("Select", "-1"));
                if (currency.Contains("USD"))
                {
                    ddlCurrencyType.Items.Insert(1, new ListItem("INR", "INR"));
                }
                if (currency.Contains("INR"))
                {
                    ddlCurrencyType.Items.Insert(1, new ListItem("USD", "USD"));
                }
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        void ddlPaymentType_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                DataTable dtsubamt = SPLAAdminHelper.GetSubscriptionAmount();
                DataTable dtyramt = SPLAAdminHelper.GetYearlySubscriptionAmount();
                if (ddlPaymentType.SelectedItem.ToString() == "Monthly")
                {
                    if (dtsubamt.Rows.Count > 0)
                    {
                        txtSubscriptionAmt.Text = dtsubamt.Rows[0]["SubscriptionAmount"].ToString();
                    }
                }
                else if ((ddlPaymentType.SelectedItem.ToString() == "Yearly"))
                {
                    txtSubscriptionAmt.Text = dtyramt.Rows[0]["SubscriptionAmount"].ToString();
                }
                else if ((ddlPaymentType.SelectedItem.ToString() == "None"))
                {
                    txtSubscriptionAmt.Text = "0";
                }
                else
                {
                    txtSubscriptionAmt.Text = dtsubamt.Rows[0]["SubscriptionAmount"].ToString();
                }
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        void chkEnrollHistory_CheckedChanged(object sender, EventArgs e)
        {
            if (chkEnrollHistory.Checked == true)
            {
                pnlEnrollHistory.Visible = true;
                gvEnrollHistory.Visible = true;
                int id = Convert.ToInt32(Page.Session["ID"].ToString());
                gvEnrollHistory.DataSource = SPLAAdminHelper.GetEnrollmentNo(id);
                gvEnrollHistory.DataBind();
            }
            if (chkEnrollHistory.Checked == false)
            {
                pnlEnrollHistory.Visible = false;
                gvEnrollHistory.Visible = false;
            }
        }
        private void LoadDDLDate()
        {
            ddlDate.Items.Insert(0, new ListItem("Select", "-1"));
            ddlDate.Items.Insert(1, new ListItem("1", "1"));
            ddlDate.Items.Insert(2, new ListItem("2", "2"));
            ddlDate.Items.Insert(3, new ListItem("3", "3"));
            ddlDate.Items.Insert(4, new ListItem("4", "4"));
            ddlDate.Items.Insert(5, new ListItem("5", "5"));
            ddlDate.Items.Insert(6, new ListItem("6", "6"));
            ddlDate.Items.Insert(7, new ListItem("7", "7"));
            ddlDate.Items.Insert(8, new ListItem("8", "8"));
            ddlDate.Items.Insert(9, new ListItem("9", "9"));
            ddlDate.Items.Insert(10, new ListItem("10", "10"));
            ddlDate.Items.Insert(11, new ListItem("11", "11"));
            ddlDate.Items.Insert(12, new ListItem("12", "12"));
            ddlDate.Items.Insert(13, new ListItem("13", "13"));
            ddlDate.Items.Insert(14, new ListItem("14", "14"));
            ddlDate.Items.Insert(15, new ListItem("15", "15"));
            ddlDate.Items.Insert(16, new ListItem("16", "16"));
            ddlDate.Items.Insert(17, new ListItem("17", "17"));
            ddlDate.Items.Insert(18, new ListItem("18", "18"));
            ddlDate.Items.Insert(19, new ListItem("19", "19"));
            ddlDate.Items.Insert(20, new ListItem("20", "20"));
            ddlDate.Items.Insert(21, new ListItem("21", "21"));
            ddlDate.Items.Insert(22, new ListItem("22", "22"));
            ddlDate.Items.Insert(23, new ListItem("23", "23"));
            ddlDate.Items.Insert(24, new ListItem("24", "24"));
            ddlDate.Items.Insert(25, new ListItem("25", "25"));
            ddlDate.Items.Insert(26, new ListItem("26", "26"));
            ddlDate.Items.Insert(27, new ListItem("27", "27"));
            ddlDate.Items.Insert(28, new ListItem("28", "28"));
            ddlDate.Items.Insert(29, new ListItem("29", "29"));
            ddlDate.Items.Insert(30, new ListItem("30", "30"));
            ddlDate.Items.Insert(31, new ListItem("31", "31"));
        }
        private void LoadRegion()
        {
            try
            {
                ddlRegion.DataSource = SPLAAdminHelper.GetRegion();
                ddlRegion.DataTextField = "Region";
                ddlRegion.DataValueField = "ID";
                ddlRegion.DataBind();
                ddlRegion.Items.Insert(0, new ListItem("Select", "-1"));
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        #endregion
        #region Create Child controls
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            if (ScriptManager.GetCurrent(this.Page) == null)
            {
                ScriptManager scriptHandler = new ScriptManager();
                scriptHandler.ID = "scriptHandler";
                scriptHandler.EnablePartialRendering = true;
                this.Controls.Add(scriptHandler);
            }
            #region Ajax Update Panel
            this.EnsureUpdatePanelFixups();
            UpdatePanel up1 = new UpdatePanel();
            up1.ID = "UpdatePanel1";
            up1.ChildrenAsTriggers = true;
            up1.UpdateMode = UpdatePanelUpdateMode.Conditional;
            up1.Update();
            UpdatePanel up2 = new UpdatePanel();
            up2.ID = "UpdatePanel2";
            up2.ChildrenAsTriggers = true;
            up2.UpdateMode = UpdatePanelUpdateMode.Conditional;
            up2.Update();
            UpdatePanel up3 = new UpdatePanel();
            up3.ID = "UpdatePanel3";
            up3.ChildrenAsTriggers = true;
            up3.UpdateMode = UpdatePanelUpdateMode.Conditional;
            up3.Update();
            UpdatePanel up4 = new UpdatePanel();
            up4.ID = "UpdatePanel4";
            up4.ChildrenAsTriggers = true;
            up4.UpdateMode = UpdatePanelUpdateMode.Conditional;
            up4.Update();
            UpdatePanel up5 = new UpdatePanel();
            up5.ID = "UpdatePanel5";
            up5.ChildrenAsTriggers = true;
            up5.UpdateMode = UpdatePanelUpdateMode.Conditional;
            up5.Update();
            #endregion
            #region TableRows and TableCells
            TableRow tr = new TableRow();
            TableCell tc = new TableCell();
            TableCell tc1 = new TableCell();
            TableCell tc2 = new TableCell();
            TableCell tc3 = new TableCell();
            #endregion

            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc.Controls.Add(chkEnrollHistory);
            pnlEnrollHistory.Controls.Add(gvEnrollHistory);
            tc2.Controls.Add(pnlEnrollHistory);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc2);
            tblEnrollHistory.Rows.Add(tr);
            #region Search Partners
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc.BackColor = ColorTranslator.FromHtml("#8CC3FF");
            tc.ForeColor = ColorTranslator.FromHtml("#ffffff");
            tc.Font.Bold = true;
            tc.Font.Size = FontUnit.Small;
            tc.ColumnSpan = 4;
            tc.HorizontalAlign = HorizontalAlign.Center;
            tc.Text = "Search Partners";
            tr.Cells.Add(tc);
            tblSearch.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Controls.Add(lblSrchCompany);
            tc1.Controls.Add(txtSrchCompany);
            tc2.Controls.Add(lblSrchBizVertical);
            tc3.Controls.Add(ddlSrchBizVertical);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblSearch.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Controls.Add(lblExpiryDate);
            tc1.Controls.Add(txtExpiryDate);
            tc1.Controls.Add(imgCalExpiry);
            tc1.Controls.Add(CalExpiryDate);
            tc2.Controls.Add(lblSrchLicensePrice);
            tc3.Controls.Add(ddlSrchLicensePrice);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblSearch.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc.Controls.Add(lblSrchStatus);
            tc1.Controls.Add(ddlSrchStatus);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tblSearch.Rows.Add(tr);
            //Save,Cancel Buttons
            tr = new TableRow();
           tc = new TableCell();
            tc.ColumnSpan = 4;
            tc.HorizontalAlign = HorizontalAlign.Center;
            Literal LTsrch = new Literal();
            LTsrch.Text = "&nbsp;&nbsp;&nbsp;&nbsp;";
            tc.Controls.Add(btnSearch);
            tc.Controls.Add(LTsrch);
            tr.Cells.Add(tc);
            tblSearch.Rows.Add(tr);
            #endregion
            #region View Partner Control
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc.BackColor = ColorTranslator.FromHtml("#8CC3FF");
            tc.ForeColor = ColorTranslator.FromHtml("#ffffff");
            tc.Font.Bold = true;
            tc.Font.Size = FontUnit.Small;
            tc.ColumnSpan = 2;
            tc.HorizontalAlign = HorizontalAlign.Center;
            tc.Text = "Partners List";
            tr.Cells.Add(tc);
            tblViewPartner.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc.ColumnSpan = 2;
            tc.HorizontalAlign = HorizontalAlign.Center;
            pnlPartner.Height = Unit.Pixel(250);
            pnlPartner.Controls.Add(gvPartner);
            pnlPartner.ScrollBars = ScrollBars.Auto;
            tc.Controls.Add(pnlPartner);
            tr.Cells.Add(tc);
            tblViewPartner.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc.ColumnSpan = 2;
            tc.HorizontalAlign = HorizontalAlign.Center;
            Literal ltSpace = new Literal();
            ltSpace.Text = "&nbsp;&nbsp;&nbsp;";
            tc.Controls.Add(btnAddPartner);
            tc.Controls.Add(ltSpace);
            tc.Controls.Add(btnDelete);
            tc.Controls.Add(hdnDelPartner);
            tr.Cells.Add(tc);
            Literal ltnewline = new Literal();
            ltnewline.Text = "<br/>";
            tblViewPartner.Rows.Add(tr);
            #endregion
            #region Add Partner Details
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc.BackColor = ColorTranslator.FromHtml("#8CC3FF");
            tc.ForeColor = ColorTranslator.FromHtml("#ffffff");
            tc.Font.Bold = true;
            tc.Font.Size = FontUnit.Small;
            tc.ColumnSpan = 4;
            tc.HorizontalAlign = HorizontalAlign.Center;
            tc.Text = "Partner Details";
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc.BackColor = ColorTranslator.FromHtml("#8CC3FF");
            tc.ForeColor = ColorTranslator.FromHtml("#ffffff");
            tc.Font.Bold = true;
            tc.Font.Size = FontUnit.XSmall;
            tc.ColumnSpan = 4;
            tc.HorizontalAlign = HorizontalAlign.Left;
            tc.Text = "Agreement Details";
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            Literal LtStar = new Literal();
            LtStar.Text = "<span style=\"color: red;\">*</span>";
            Literal LtStar1 = new Literal();
            LtStar1.Text = "<span style=\"color: red;\">*</span>";
            tc.Width = Unit.Percentage(25);
            tc1.Width = Unit.Percentage(25);
            tc2.Width = Unit.Percentage(25);
            tc3.Width = Unit.Percentage(25);
            tc.Controls.Add(lblSPLANo);
            tc.Controls.Add(LtStar);
            tc1.Controls.Add(txtSPLANo);
            tc1.Controls.Add(rqPartnerCode);
            //tc1.Controls.Add(VCEPartnerCode);
            tc2.Controls.Add(lblEnrollmentNo);
            tc2.Controls.Add(LtStar1);
            tc3.Controls.Add(txtEnrollmentNo);
            tc3.Controls.Add(rqenrollmentNo);
            tc3.Controls.Add(regnumbers);
            tr.CssClass = "evenRow";
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            Literal LtStare = new Literal();
            LtStare.Text = "<span style=\"color: red;\">*</span>";
            Literal LtStar1e = new Literal();
            LtStar1e.Text = "<span style=\"color: red;\">*</span>";
            tc.Width = Unit.Percentage(25);
            tc1.Width = Unit.Percentage(25);
            tc2.Width = Unit.Percentage(25);
            tc3.Width = Unit.Percentage(25);
            tc.Controls.Add(lblMBSCNo);
            tc1.Controls.Add(txtMBSCNo);
            //tc1.Controls.Add(rqMBSCNo);
            //tc1.Controls.Add(VCEPartnerCode);
            tc2.Controls.Add(lblMPNNo);
            tc3.Controls.Add(txtMPNNo);
            //tc3.Controls.Add(rqMPNNo);
            //tc3.Controls.Add(VCEenrollmentNo);
           // tr.CssClass = "evenRow";
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);


            tr = new TableRow();
            tc = new TableCell();
            tc.ColumnSpan = 4;
            tc.Controls.Add(tblEnrollHistory);
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc1.ColumnSpan = 3;
            Literal LtStar2 = new Literal();
            LtStar2.Text = "<span style=\"color: red;\">*</span>";
            Literal LTFrm = new Literal();
            LTFrm.Text = "From&nbsp;&nbsp;";
            tc.Controls.Add(lblPartnerFromDate);
            tc.Controls.Add(LtStar2);
            tc1.Controls.Add(LTFrm);
            tc1.Controls.Add(txtPartnerFromDate);
            tc1.Controls.Add(imgCalenderfrm);
            tc1.Controls.Add(ceLicenseFrom);
            tc1.Controls.Add(rqLicenseFrmDate);
            //tc1.Controls.Add(reLicenseDate);
            Literal LTTo = new Literal();
            LTTo.Text = "To&nbsp;&nbsp;";
            Literal LTdate = new Literal();
            LTdate.Text = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
            tc1.Controls.Add(LTTo);
            tc1.Controls.Add(txtPartnertoDate);
            tc1.Controls.Add(imgCalenderto);
            tc1.Controls.Add(ceLicenseTo);
            tc1.Controls.Add(rqLicenseToDate);
            //tc1.Controls.Add(reLicenseToDate);
            tc1.Controls.Add(LTdate);
            //tc1.Controls.Add(cmpPartDate);
            tr.CssClass = "oddRow";
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc.BackColor = ColorTranslator.FromHtml("#8CC3FF");
            tc.ForeColor = ColorTranslator.FromHtml("#ffffff");
            tc.Font.Bold = true;
            tc.Font.Size = FontUnit.XSmall;
            tc.ColumnSpan = 4;
            tc.HorizontalAlign = HorizontalAlign.Left;
            tc.Text = "Company Details";
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tr.CssClass = "evenRow";
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            Literal LtStar3 = new Literal();
            LtStar3.Text = "<span style=\"color: red;\">*</span>";
            Literal LtStar4 = new Literal();
            LtStar4.Text = "<span style=\"color: red;\">*</span>";
            tc.Controls.Add(lblPartnerCompanyName);
            tc.Controls.Add(LtStar3);
            tc1.Controls.Add(txtPartnerCompanyName);
            tc1.Controls.Add(rqPartnerCompanyName);
            // tc1.Controls.Add(VCEPartnerCompanyName);
            tc2.Controls.Add(lblPartnerAuthName);
            tc2.Controls.Add(LtStar4);
            tc3.Controls.Add(txtPartnerAuthName);
            tc3.Controls.Add(rqPartnerAuthName);
            //tc3.Controls.Add(VCEPartnerAuthName);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            Literal LtStar5 = new Literal();
            LtStar5.Text = "<span style=\"color: red;\">*</span>";
            Literal LtStar6 = new Literal();
            LtStar6.Text = "<span style=\"color: red;\">*</span>";
            tc.Controls.Add(lblPartnerDesignation);
            tc.Controls.Add(LtStar5);
            tc1.Controls.Add(txtPartnerDesignation);
            tc1.Controls.Add(rqPartnerDesignation);
            //tc1.Controls.Add(VCEPartnerDesignation);
            tc2.Controls.Add(lblPartnerEmailID);
            tc2.Controls.Add(LtStar6);
            tc3.Controls.Add(txtPartnerEmailID);
            tc3.Controls.Add(rqPartnerEmailID);
            //tc3.Controls.Add(VCErqPartnerEmailID);
            tc3.Controls.Add(rePartnerEmailID);
            //tc3.Controls.Add(VCErePartnerEmailID);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tr.CssClass = "evenRow";
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            Literal LtStar7 = new Literal();
            LtStar7.Text = "<span style=\"color: red;\">*</span>";
            tc.Controls.Add(lblPartnerAddress);
            tc.Controls.Add(LtStar7);
            tc1.Controls.Add(txtPartnerAddress);
            tc1.Controls.Add(rqPartnerAddress);
            //tc1.Controls.Add(VCEPartnerAddress);
            tc2.Controls.Add(lblPartnerAddress1);
            tc3.Controls.Add(txtPartnerAddress1);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            Literal LtStar8 = new Literal();
            LtStar8.Text = "<span style=\"color: red;\">*</span>";
            Literal LtStar9 = new Literal();
            LtStar9.Text = "<span style=\"color: red;\">*</span>";
            tc.Controls.Add(lblPartnerCity);
            tc.Controls.Add(LtStar8);
            tc1.Controls.Add(txtPartnerCity);
            tc1.Controls.Add(rqPartnerCity);
            //tc1.Controls.Add(VCEPartnerCity);
            tc2.Controls.Add(lblPartnerState);
            tc2.Controls.Add(LtStar9);
            tc3.Controls.Add(ddlPartnerState);
            tc3.Controls.Add(rqPartnerState);
            //tc3.Controls.Add(VCEPartnerState);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tr.CssClass = "evenRow";
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            Literal LtStar10 = new Literal();
            LtStar10.Text = "<span style=\"color: red;\">*</span>";
            tc.Controls.Add(lblTelephone);
            tc.Controls.Add(LtStar10);
            tc1.Controls.Add(txtTelephone);
            tc1.Controls.Add(rqPartnerPhone);
            //tc1.Controls.Add(VCEPartnerPhone);
            tc1.Controls.Add(rePartnerPhone);
            //tc1.Controls.Add(VCErePartnerPhone);
            tc2.Controls.Add(lblPartnerFax);
            tc3.Controls.Add(txtPartnerFax);
            tc3.Controls.Add(rePartnerFax);
            //tc3.Controls.Add(VCErePartnerFax);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Controls.Add(lblPartnerMobile);
            tc1.Controls.Add(txtPartnerMobile);
            tc1.Controls.Add(rePartnerMobile);
            tc2.Controls.Add(lblbizVertical);
            tc3.Controls.Add(ddlBizVertical);
            tc3.Controls.Add(rqBizVertical);
            tr.Cells.Add(tc);
           tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);

            tr = new TableRow();
            tr.CssClass = "evenRow";
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Controls.Add(lblRegion);
            tc1.Controls.Add(ddlRegion);
            tc1.Controls.Add(rqRegion);
            tc2.Controls.Add(lblPam);
            tc3.Controls.Add(ddlpam);
            tc3.Controls.Add(rqpam);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc.BackColor = ColorTranslator.FromHtml("#8CC3FF");
            tc.ForeColor = ColorTranslator.FromHtml("#ffffff");
            tc.Font.Bold = true;
            tc.Font.Size = FontUnit.XSmall;
            tc.ColumnSpan = 4;
            tc.HorizontalAlign = HorizontalAlign.Left;
            tc.Text = "Shipping Details";
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tr.CssClass = "evenRow";
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Controls.Add(lblShippingContact);
            tc1.Controls.Add(txtShippingContact);
            tc2.Controls.Add(lblShippingEmail);
            tc3.Controls.Add(txtShippingEmail);
            tc3.Controls.Add(reShippingEmail);
            // tc3.Controls.Add(VCEreShippingEmail);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Controls.Add(lblShippingAddress);
            tc1.Controls.Add(txtShippingAddress);
            tc2.Controls.Add(lblShippingAddress1);
            tc3.Controls.Add(txtShippingAddress1);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tr.CssClass = "evenRow";
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Controls.Add(lblShippingCity);
            tc1.Controls.Add(txtShippingCity);
            tc2.Controls.Add(lblShippingState);
            tc3.Controls.Add(ddlShippingState);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Controls.Add(lblShippingTelephone);
            tc1.Controls.Add(txtShippingTelephone);
            tc1.Controls.Add(reShippingTelephone);
            //tc1.Controls.Add(VCEreShippingTelephone);
            tc2.Controls.Add(lblShippingMobile);
            tc3.Controls.Add(txtShippingMobile);
            tc3.Controls.Add(reShippingMobile);
            //tc3.Controls.Add(VCEreShippingMobile);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc.BackColor = ColorTranslator.FromHtml("#8CC3FF");
            tc.ForeColor = ColorTranslator.FromHtml("#ffffff");
            tc.Font.Bold = true;
            tc.Font.Size = FontUnit.XSmall;
            tc.ColumnSpan = 4;
            tc.HorizontalAlign = HorizontalAlign.Left;
            tc.Text = "Contact Details";
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tr.CssClass = "evenRow";
            tc = new TableCell();
            //tc1 = new TableCell();
            //tc2 = new TableCell();
            //tc3 = new TableCell();
            tc.ColumnSpan = 4;
            Literal LTSFrmcc = new Literal();
            Literal LTSTocc = new Literal();
            Literal LTSTocc1 = new Literal();
            LTSFrmcc.Text = "&nbsp;&nbsp;";
            LTSTocc.Text = "&nbsp;&nbsp;";
            LTSTocc1.Text = "&nbsp;&nbsp;";
            tc.Controls.Add(chkContact1);
            tc.Controls.Add(LTSFrmcc);
            tc.Controls.Add(chkContact2);
            tc.Controls.Add(LTSTocc);
            tc.Controls.Add(chkBillingContact);
            tc.Controls.Add(LTSTocc1);
            tc.Controls.Add(chkBillingEsculationContact);
            tr.Cells.Add(tc);
            //tr.Cells.Add(tc1);
            //tr.Cells.Add(tc2);
            //tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            #region Contact Details 1
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Width = Unit.Percentage(25);
            tc1.Width = Unit.Percentage(25);
            tc2.Width = Unit.Percentage(25);
            tc3.Width = Unit.Percentage(25);
            tc.Controls.Add(lblContact1Name);
            tc1.Controls.Add(txtContact1Name);
            tc2.Controls.Add(lblContact1Email);
            tc3.Controls.Add(txtContact1Email);
            tc3.Controls.Add(rqContact1Email);
            tc3.Controls.Add(reContact1Email);
            ///tc3.Controls.Add(VCEreContact1Email);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblAlternateContact1.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Width = Unit.Percentage(25);
            tc1.Width = Unit.Percentage(25);
            tc2.Width = Unit.Percentage(25);
            tc3.Width = Unit.Percentage(25);
            tc.Controls.Add(lblContact1phone);
            tc1.Controls.Add(txtContact1phone);
            tc1.Controls.Add(rqConatct1pjone);
            tc1.Controls.Add(reContact1phone);
            // tc1.Controls.Add(VCEreContact1phone);
            tc2.Controls.Add(lblContact1Mobile);
            tc3.Controls.Add(txtContact1Mobile);
            //tc3.Controls.Add(rqContact1MObile);
            tc3.Controls.Add(reContact1Mobile);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblAlternateContact1.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.ColumnSpan = 4;
            tc.Controls.Add(tblAlternateContact1);
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);
            #endregion
            #region Contact Details 2
            tr = new TableRow();
            tc = new TableCell();
            tc.Width = Unit.Percentage(25);
            tc.Controls.Add(chkSameUSeEsc);
            tr.Cells.Add(tc);
            tblAlternateContact2.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Width = Unit.Percentage(25);
            tc1.Width = Unit.Percentage(25);
            tc2.Width = Unit.Percentage(25);
            tc3.Width = Unit.Percentage(25);
            tc.Controls.Add(lblContact2Name);
            tc1.Controls.Add(txtContact2Name);
            tc2.Controls.Add(lblContact2Email);
            tc3.Controls.Add(txtContact2Email);
            tc3.Controls.Add(reContact2Email);
            tc3.Controls.Add(rqConatact2Email);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblAlternateContact2.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Width = Unit.Percentage(25);
            tc1.Width = Unit.Percentage(25);
            tc2.Width = Unit.Percentage(25);
            tc3.Width = Unit.Percentage(25);
            tc.Controls.Add(lblContact2phone);
            tc1.Controls.Add(txtContact2phone);
            tc1.Controls.Add(reContact2phone);
            tc1.Controls.Add(rqconatact2phone);
            tc2.Controls.Add(lblContact2Mobile);
            tc3.Controls.Add(txtContact2Mobile);
            tc3.Controls.Add(reContact2Mobile);
            //tc3.Controls.Add(rqConatact2Mobile);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblAlternateContact2.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.ColumnSpan = 4;
            tc.Controls.Add(tblAlternateContact2);
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);
            #endregion
            #region Billing Contact Details
            tr = new TableRow();
            tc = new TableCell();
            tc.Width = Unit.Percentage(25);
            tc.Controls.Add(chkSameBillCOn);
            tr.Cells.Add(tc);
           tblBillingContact.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Width = Unit.Percentage(25);
            tc1.Width = Unit.Percentage(25);
            tc2.Width = Unit.Percentage(25);
            tc3.Width = Unit.Percentage(25);
            tc.Controls.Add(lblBillingName);
            tc1.Controls.Add(txtBillingName);
            tc1.Controls.Add(rqBillingName);
            tc2.Controls.Add(lblBillingEmail);
            tc3.Controls.Add(txtBillingEmail);
            tc3.Controls.Add(reBillingEmail);
            tc3.Controls.Add(rqBillingEmail);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblBillingContact.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Width = Unit.Percentage(25);
            tc1.Width = Unit.Percentage(25);
            tc2.Width = Unit.Percentage(25);
            tc3.Width = Unit.Percentage(25);
            tc.Controls.Add(lblBillingphone);
            tc1.Controls.Add(txtBillingphone);
            tc1.Controls.Add(reBillingphone);
            tc1.Controls.Add(rqBillingphone);
            tc2.Controls.Add(lblBillingMobile);
            tc3.Controls.Add(txtBillingMobile);
            tc3.Controls.Add(reBillingMobile);
            //tc3.Controls.Add(rqBillingMobile);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblBillingContact.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.ColumnSpan = 4;
            tc.Controls.Add(tblBillingContact);
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);
            #endregion
            #region BillingEsc
            tr = new TableRow();
            tc = new TableCell();
            tc.Width = Unit.Percentage(25);
            tc.Controls.Add(chkSameBillEsc);
            tr.Cells.Add(tc);
            tblBillingEscContact.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Width = Unit.Percentage(25);
            tc1.Width = Unit.Percentage(25);
            tc2.Width = Unit.Percentage(25);
            tc3.Width = Unit.Percentage(25);
            tc.Controls.Add(lblBillingexculationName);
            tc1.Controls.Add(txtBillingeScName);
            tc1.Controls.Add(rqBillingEscName);
            tc2.Controls.Add(lblBillingescEmail);
            tc3.Controls.Add(txtBillingescEmail);
            tc3.Controls.Add(reBillingescEmail);
            tc3.Controls.Add(rqBillingescEmail);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblBillingEscContact.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Width = Unit.Percentage(25);
            tc1.Width = Unit.Percentage(25);
            tc2.Width = Unit.Percentage(25);
            tc3.Width = Unit.Percentage(25);
            tc.Controls.Add(lblBillingescphone);
            tc1.Controls.Add(txtBillingescphone);
            tc1.Controls.Add(reBillingescphone);
            tc1.Controls.Add(rqBillingescphone);
            tc2.Controls.Add(lblBillingescMobile);
            tc3.Controls.Add(txtBillingescMobile);
            tc3.Controls.Add(reBillingescMobile);
            //tc3.Controls.Add(rqBillingescMobile);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblBillingEscContact.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.ColumnSpan = 4;
            tc.Controls.Add(tblBillingEscContact);
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);
            #endregion
            #region Media - old
            //tr = new TableRow();
            //tc = new TableCell();
            //tc1 = new TableCell();
            //tc1.ColumnSpan = 3;
            //tc.Controls.Add(lblbizVertical);
            //tc1.Controls.Add(ddlBizVertical);
            ////tc1.Controls.Add(ddlPartnerManager);
            //tr.Cells.Add(tc);
            //tr.Cells.Add(tc1);
            //tblPartnerDetail.Rows.Add(tr);

            //tr = new TableRow();
            //tr.CssClass = "evenRow";
            //tc = new TableCell();
            //tc1 = new TableCell();
            //tc2 = new TableCell();
            //tc3 = new TableCell();
            //Literal LTSFrm = new Literal();
            //Literal LTSTo = new Literal();
            //LTSFrm.Text = "From&nbsp;&nbsp;&nbsp;&nbsp;";
            //Literal LtStar13 = new Literal();
            //LtStar13.Text = "<span style=\"color: red;\">*</span>";
            ////tc1.Controls.Add(VCEreDiscount);
            //tc.Controls.Add(lblMedia);
            //tc1.Controls.Add(chkMediatype);
            //tc2.Controls.Add(lblfrmDate);
            //tc2.Controls.Add(LtStar13);
            //tc3.Controls.Add(LTSFrm);
            //tc3.Controls.Add(txtfrmDate);
            //tc3.Controls.Add(rqfrmDate);
            //tc3.Controls.Add(rgvfrmDate);
            ////tc3.Controls.Add(VCErgvfrmDate);
            //LTSTo.Text = "&nbsp;&nbsp;&nbsp;To&nbsp;";
            //tc3.Controls.Add(LTSTo);
            //tc3.Controls.Add(txttoDate);
            //tc3.Controls.Add(rqtoDate);
            //tc3.Controls.Add(rgvtoDate);
            ////tc3.Controls.Add(VCErgvtoDate);
            //tc3.Controls.Add(cmpDate);
            ////tc3.Controls.Add(VCEDate);
            //tr.Cells.Add(tc2);
            //tr.Cells.Add(tc3);
            //tr.Cells.Add(tc);
            //tr.Cells.Add(tc1);
            //tblPartnerDetail.Rows.Add(tr);
            #endregion
            //tr = new TableRow();
            //tc = new TableCell();
            //tc1 = new TableCell();
            //tc2 = new TableCell();
            //tc3 = new TableCell();
            Literal LTSFrm = new Literal();
            ////Literal LTSTo = new Literal();
            LTSFrm.Text = "&nbsp;&nbsp;&nbsp;&nbsp;";
            ////Literal LtStar13 = new Literal();
            ////LtStar13.Text = "<span style=\"color: red;\">*</span>";
            //tc.Controls.Add(lblbizVertical);
            //tc1.Controls.Add(ddlBizVertical);
            //tc1.Controls.Add(rqBizVertical);         
            //tr.Cells.Add(tc);
            //tr.Cells.Add(tc1);           
            //tblPartnerDetail.Rows.Add(tr);

            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc.BackColor = ColorTranslator.FromHtml("#8CC3FF");
            tc.ForeColor = ColorTranslator.FromHtml("#ffffff");
            tc.Font.Bold = true;
            tc.Font.Size = FontUnit.XSmall;
            tc.ColumnSpan = 4;
            tc.HorizontalAlign = HorizontalAlign.Left;
            tc.Text = " PriceList Details";
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tr.CssClass = "evenRow";
            tc = new TableCell();
            tc1 = new TableCell();
            tc.Controls.Add(lblPricelistCurrency);
            tc1.Controls.Add(ddlPricelstcurrency);
            tc1.Controls.Add(rqPricelstcurrency);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            Literal LtStar14 = new Literal();
            LtStar14.Text = "<span style=\"color: red;\">*</span>";
            tc.Width = Unit.Percentage(25);
            tc.HorizontalAlign = HorizontalAlign.Left;
            tc1.Width = Unit.Percentage(25);
            tc1.HorizontalAlign = HorizontalAlign.Left;
            tc2.Width = Unit.Percentage(25);
            tc2.HorizontalAlign = HorizontalAlign.Left;
            tc3.HorizontalAlign = HorizontalAlign.Left;
            tc.Controls.Add(lblLicenseType);
            tc.Controls.Add(LtStar14);
            tc1.Controls.Add(rdoLicenseType);
            tc2.Controls.Add(ddlpricingPartner);
            tc2.Controls.Add(rqPricing);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tr.CssClass = "evenRow";
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            Literal LtStarrplto = new Literal();
            LtStarrplto.Text = "<span style=\"color: red;\">*</span>";
            Literal LtStarrplfrom = new Literal();
            LtStarrplfrom.Text = "<span style=\"color: red;\">*</span>";
            tc.Width = Unit.Percentage(25);
            tc.HorizontalAlign = HorizontalAlign.Left;
            tc1.Width = Unit.Percentage(25);
            tc1.HorizontalAlign = HorizontalAlign.Left;
            tc2.Width = Unit.Percentage(25);
            tc2.HorizontalAlign = HorizontalAlign.Left;
            tc3.Width = Unit.Percentage(25);
            tc3.HorizontalAlign = HorizontalAlign.Left;
            tc.Controls.Add(lblplfromdate);
            tc.Controls.Add(LtStarrplfrom);
            tc1.Controls.Add(txtInvDate);
            tc1.Controls.Add(InvFromCalendar);
            tc1.Controls.Add(imgbtnCalendar);
            tc1.Controls.Add(rfvTxtDate);
            tc2.Controls.Add(lbltodate);
            tc3.Controls.Add(txtInvToDate);
            tc3.Controls.Add(InvToCalendar);
            tc3.Controls.Add(imgbtnToCalendar);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);

            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            Literal LtStarre = new Literal();
            LtStarre.Text = "<span style=\"color: red;\">*</span>";
            tc.Width = Unit.Percentage(25);
            tc.HorizontalAlign = HorizontalAlign.Left;
            tc1.Width = Unit.Percentage(25);
            tc1.HorizontalAlign = HorizontalAlign.Left;
            tc2.Width = Unit.Percentage(25);
            tc2.HorizontalAlign = HorizontalAlign.Left;
            tc.Controls.Add(lblfrmDate);
            tc.Controls.Add(LtStarre);
            tc1.Controls.Add(LTSFrm);
            tc1.Controls.Add(ddlDate);
            //tc1.Controls.Add(rqfrmDate);       
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc.BackColor = ColorTranslator.FromHtml("#8CC3FF");
            tc.ForeColor = ColorTranslator.FromHtml("#ffffff");
            tc.Font.Bold = true;
            tc.Font.Size = FontUnit.XSmall;
            tc.ColumnSpan = 4;
            tc.HorizontalAlign = HorizontalAlign.Left;
            tc.Text = "Registration/Subscription Payment Details";
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);

            tr = new TableRow();
            tr.CssClass = "evenRow";
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            //Literal LtStar14 = new Literal();
            //LtStar14.Text = "<span style=\"color: red;\">*</span>";
            tc.Width = Unit.Percentage(25);
            tc.HorizontalAlign = HorizontalAlign.Left;
            tc1.Width = Unit.Percentage(25);
            tc1.HorizontalAlign = HorizontalAlign.Left;
            tc2.Width = Unit.Percentage(25);
            tc2.HorizontalAlign = HorizontalAlign.Left;
            tc3.HorizontalAlign = HorizontalAlign.Left;
            tc.Controls.Add(lblpaymentType);
            tc1.Controls.Add(ddlPaymentType);
            tc2.Controls.Add(lblSubscriptionAmt);
            tc3.Controls.Add(txtSubscriptionAmt);
            tc3.Controls.Add(reSubscriptionAmt);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tr.CssClass = "evenRow";
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Controls.Add(lblRegFee);
            tc1.Controls.Add(rdoRegFee);
            tc1.Controls.Add(rdoRegFeeNone);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tblPartnerDetail.Rows.Add(tr);

            #region Pricing Partner changed by Vinitha.K from March 2011
            tr = new TableRow();
            tr.CssClass = "oddRow";
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            Literal LtStar15 = new Literal();
            LtStar15.Text = "<span style=\"color: red;\">*</span>";
            tc.Width = Unit.Percentage(25);
            tc.HorizontalAlign = HorizontalAlign.Left;
            tc1.Width = Unit.Percentage(25);
            tc1.HorizontalAlign = HorizontalAlign.Left;
            tc2.Width = Unit.Percentage(25);
            tc2.HorizontalAlign = HorizontalAlign.Left;
            tc3.HorizontalAlign = HorizontalAlign.Left;
            tc.Controls.Add(lblThreeYearPrice);
            tc1.Controls.Add(chkThreeYrPrice);
            tc2.Controls.Add(lblPricingPartner);
            //tc3.Controls.Add(VCErqPricing);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPricingPatner.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc.ColumnSpan = 4;
            tc.Controls.Add(tblPricingPatner);
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);
            #endregion

            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc.BackColor = ColorTranslator.FromHtml("#8CC3FF");
            tc.ForeColor = ColorTranslator.FromHtml("#ffffff");
            tc.Font.Bold = true;
            tc.Font.Size = FontUnit.XSmall;
            tc.ColumnSpan = 4;
            tc.HorizontalAlign = HorizontalAlign.Left;
            tc.Text = "Payment Details";
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);

            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Controls.Add(lblCreditPeriod);
            tc1.Controls.Add(ddlCreditPeeriod);
            tc1.Controls.Add(rqCreditPeriod);
            tc2.Controls.Add(lblCreditLimit);
            tc3.Controls.Add(txtcreditlimit);
            tc3.Controls.Add(rqCreditLimit);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);

            tr = new TableRow();
            tr.CssClass = "evenRow";
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();          
            tc.Controls.Add(lblCurrencyType);
            tc1.Controls.Add(ddlCurrencyType);
            tc1.Controls.Add(rqCurrency);
            tc2.Controls.Add(lblTaxProfile);
            tc3.Controls.Add(chkstpiyes);
            tc3.Controls.Add(chkstpino);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            tc.Controls.Add(lblsez);
            tc1.Controls.Add(rbsezyes);
            tc1.Controls.Add(rbsezno);
            tc2.Controls.Add(lbltds);
            tc3.Controls.Add(txttdds);
            tc3.Controls.Add(rfvtds);
            tc3.Controls.Add(rfv);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc.BackColor = ColorTranslator.FromHtml("#8CC3FF");
            tc.ForeColor = ColorTranslator.FromHtml("#ffffff");
            tc.Font.Bold = true;
            tc.Font.Size = FontUnit.XSmall;
            tc.ColumnSpan = 4;
            tc.HorizontalAlign = HorizontalAlign.Left;
            tc.Text = "Partner Login Details";
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
            Literal LtStar11 = new Literal();
            LtStar11.Text = "<span style=\"color: red;\">*</span>";
           Literal LtStar12 = new Literal();
            LtStar12.Text = "<span style=\"color: red;\">*</span>";
            tc.Controls.Add(lblUserName);
            tc.Controls.Add(LtStar11);
            tc1.Controls.Add(txtUserName);
            tc1.Controls.Add(rqUserName);
            //tc1.Controls.Add(VCEUserName);
            tc2.Controls.Add(lblPassword);
            tc2.Controls.Add(LtStar12);
            tc3.Controls.Add(txtPassword);
            tc3.Controls.Add(rqPassword);
           //tc3.Controls.Add(VCEPassword);
            //tc3.Controls.Add(pwdStrength);
            tc3.Controls.Add(rePwdValidator);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tr.CssClass = "evenRow";
            tc = new TableCell();
            tc1 = new TableCell();
            tc2 = new TableCell();
            tc3 = new TableCell();
           Literal LtStar17 = new Literal();
            LtStar17.Text = "<span style=\"color: red;\">*</span>";
            tc.Controls.Add(lblActive);
            tc1.Controls.Add(chkActive);
            tc2.Controls.Add(lblPriority);
            tc2.Controls.Add(LtStar17);
            tc3.Controls.Add(ddlPriority);
            tc3.Controls.Add(rqPriority);
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tblPartnerDetail.Rows.Add(tr);


            tr = new TableRow();
            tc = new TableCell();
            tc.ColumnSpan = 4;
            tc.HorizontalAlign = HorizontalAlign.Center;
            tc.Controls.Add(btnSave);
            Literal ltSpace2 = new Literal();
            ltSpace2.Text = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
            tc.Controls.Add(ltSpace2);
            tc.Controls.Add(btnCancel);
            tc.Controls.Add(hdnPartnerId);
            tr.Cells.Add(tc);
            tblPartnerDetail.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            //up5.Triggers.Add(asplfrom);
            //up5.ContentTemplateContainer.Controls.Add(tblPartnerDetail);
            tc.Controls.Add(tblPartnerDetail);
            tblMain.Rows.Add(tr);
            #endregion
            #region Main table control
            //Add views,Menu to Main table
            tr = new TableRow();
            tc = new TableCell();
            tc.VerticalAlign = VerticalAlign.Top;
            up1.ContentTemplateContainer.Controls.Add(tblSearch);
            tc.Controls.Add(up1);
            tr.Cells.Add(tc);
            tblMain.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc.VerticalAlign = VerticalAlign.Top;
            up2.ContentTemplateContainer.Controls.Add(tblViewPartner);
            tc.Controls.Add(up2);
            tr.Cells.Add(tc);
            tblMain.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc.Width = Unit.Percentage(15);
            tc.VerticalAlign = VerticalAlign.Top;
            //up3.Triggers.Add(asplfrom);
            up3.ContentTemplateContainer.Controls.Add(tblPartnerDetail);
            tc.Controls.Add(up3);
            tr.Cells.Add(tc);
            tblMain.Rows.Add(tr);
            tr = new TableRow();
            tc = new TableCell();
            tc.HorizontalAlign = HorizontalAlign.Center;
            up4.ContentTemplateContainer.Controls.Add(lblStatus);
            tc.Controls.Add(up4);
            //tc.Controls.Add(lblStatus);
            tr.Cells.Add(tc);
            tblMain.Rows.Add(tr);
            this.Controls.Add(tblMain);
            #endregion
        }
        #endregion
        #region Gridview methods
        private void InitGridView(ref GridView grdView, string Type)
        {
            string st = "";
            string LicenseExpiry = "";
            try
            {
                //lblStatus.Text = "";
                DataTable dt = null;
                grdView.DataSource = null;
                grdView.AutoGenerateColumns = false;
                grdView.DataBind();
                grdView.Columns.Clear();
                grdView.CellPadding = 0;
                grdView.CellSpacing = 0;
                grdView.BorderStyle = BorderStyle.Solid;
                grdView.BorderWidth = Unit.Pixel(1);
                grdView.BorderColor = ColorTranslator.FromHtml("#869D6"); ;
                //grdView.HeaderStyle.BackColor = ColorTranslator.FromHtml("#869D6");
                //grdView.HeaderStyle.ForeColor = ColorTranslator.FromHtml("#ffffff");
                grdView.HeaderStyle.BackColor = ColorTranslator.FromHtml("#8CC3FF");
                grdView.HeaderStyle.ForeColor = ColorTranslator.FromHtml("#ffffff");
                grdView.Width = Unit.Percentage(100);
                #region View Partners/ Partner search
                if (Type == "Partner" || Type == "PartnerSearch")
                {
                    //Load all Partners
                    if (Type == "Partner")
                        dt = SPLAAdminHelper.GetAllPartners();
                    //Load partners based on search criteria
                    else if (Type == "PartnerSearch")
                    {
                        st = txtSrchCompany.Text;
                        if ((st == null) || (st.Length <= 0))
                            st = "";
                        if (txtExpiryDate.Text != "")
                            LicenseExpiry = txtExpiryDate.Text;
                        dt = SPLAAdminHelper.SearchPartners(st, Convert.ToInt32(ddlSrchBizVertical.SelectedValue), ddlSrchLicensePrice.SelectedItem.ToString(), Convert.ToInt32(ddlSrchStatus.SelectedValue), LicenseExpiry);
                    }
                    BoundField bfield;
                    grdView.AllowSorting = true;
                    if (dt.Rows.Count > 0)
                    {
                        TemplateField tmplCol = new TemplateField();
                        tmplCol.HeaderText = "Select";
                        tmplCol.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                        tmplCol.ItemTemplate = new CreateItemTemplateCheckBox("chkboxPartner", false);
                        grdView.Columns.Add(tmplCol);

                        bfield = new BoundField();
                        bfield.DataField = "PartnerId";
                        bfield.HeaderText = "Partner ID";
                        grdView.Columns.Add(bfield);
                        bfield = new BoundField();
                        bfield.DataField = "PartnerCompanyName";
                        bfield.HeaderText = "Company Name";
                        grdView.Columns.Add(bfield);

                        bfield = new BoundField();
                        bfield.DataField = "PartnerAuthorisedName";
                        bfield.HeaderText = "Authorized Person";
                        grdView.Columns.Add(bfield);
                        bfield = new BoundField();
                        bfield.DataField = "PartnerDesignation";
                        bfield.HeaderText = "Partner Designation";
                        grdView.Columns.Add(bfield);
                        bfield = new BoundField();
                        bfield.DataField = "PartnerEmailID";
                        bfield.HeaderText = "Email ID";
                        grdView.Columns.Add(bfield);
                        bfield = new BoundField();
                        bfield.DataField = "SPLANo";
                        bfield.HeaderText = "Microsoft SPLA No";
                        grdView.Columns.Add(bfield);
                        bfield = new BoundField();
                        bfield.DataField = "EnrollmentNo";
                        bfield.HeaderText = "Enrollment No";
                        grdView.Columns.Add(bfield);
                        bfield = new BoundField();
                        bfield.DataField = "Active";
                        bfield.HeaderText = "Active";
                        grdView.Columns.Add(bfield);
                        bfield = new BoundField();
                        bfield.DataField = "ExpiryDate";
                        bfield.HeaderText = "Expiry Date";
                        grdView.Columns.Add(bfield);
                        CommandField cfield = new CommandField();
                        cfield.ButtonType = ButtonType.Image;
                        cfield.EditImageUrl = "/Source/edit.gif";
                        cfield.HeaderText = "Edit";
                        cfield.ShowEditButton = true;
                        grdView.Columns.Add(cfield);
                        grdView.DataSource = dt;
                        grdView.AllowPaging = false;
                        //grdView.Columns[1].Visible = false;
                        pnlPartner.Visible = true;
                        grdView.Visible = true;
                        grdView.DataBind();
                        btnDelete.Visible = true;
                        if (grdView.Rows.Count > 0)
                        {
                            for (int i = 0; i < grdView.Rows.Count; i++)
                            {
                                if (grdView.Rows[i].Cells[8].Text == "True")
                                {
                                    grdView.Rows[i].Cells[8].Text = "Active";
                                }
                                else
                                {
                                    grdView.Rows[i].Cells[8].Text = "InActive";
                                }
                            }
                        }
                    }
                    else
                    {
                        DisplayMessage("No Partners found", MessageType.Information);
                        pnlPartner.Visible = false;
                        grdView.Visible = false;
                        btnDelete.Visible = false;
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                //DisplayMessage(":"+"val"+st+":"+st.Length, MessageType.Warning );
                DisplayErroMessage(ex);
            }
        }
        private void gvPartner_RowCreated(object sender, GridViewRowEventArgs e)
        {
            e.Row.Cells[1].Visible = false;
            e.Row.Cells[7].Visible = false;
        }
        protected void gvPartner_RowEditing(object sender, GridViewEditEventArgs e)
        {
            // Edit Partner
            try
            {
                int ROWCount = gvPartner.Rows.Count;
                string i = gvPartner.Rows[e.NewEditIndex].Cells[1].Text.ToString();
                int partnerId = 0;
                partnerId = Convert.ToInt32(gvPartner.Rows[e.NewEditIndex].Cells[1].Text);
                Page.Session["ID"] = partnerId;
                lblStatus.Text = "";
                tblPartnerDetail.Visible = true;
                loadPartnerDetails(partnerId);
                btnSave.Text = "Update";
                hdnPartnerId.Value = partnerId + "";
                ClearGridCheckBox();
                txtPartnerCompanyName.Enabled = false;
                tblViewPartner.Visible = false;
                tblSearch.Visible = false;
                tblEnrollHistory.Visible = true;
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        #endregion
        #region Button click events
        #region Save Button
        private void btnSave_Click(object sender, EventArgs e)
        {
            string operation = "ADD";
            SPWeb web = SPControl.GetContextWeb(Context);
            SPUser sUser = web.CurrentUser;
            userID = sUser.ID;
            decimal SubscriptionAmt = 0;
            DateTime dttoDate = DateTime.Now;
            DateTime dtFrmDate = DateTime.Now;
            DateTime dtplendDate = DateTime.Now;
            DateTime dtplFrmDate = DateTime.Now;
            int regFee = 0;
            int partnerId = 0;
            //object returnValue = null;
            //int ThreeYrPrice = 0;
            try
            {
                IFormatProvider provider = new System.Globalization.CultureInfo("en-GB", true);
                //String datetime = txtPartnerFromDate.Text.Trim();
                //dtFrmDate = DateTime.Parse(datetime, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
                //String datetime1 = txtPartnertoDate.Text.Trim();
                //dttoDate = DateTime.Parse(datetime1, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
                //IFormatProvider provider1 = new System.Globalization.CultureInfo("en-GB", true);
                //String datetime2 = txtInvDate.Text;
                //dtplFrmDate = DateTime.Parse(datetime2, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
                //dtplFrmDate = Convert.ToDateTime(datetime2);
                //String datetime3 = txtInvToDate.Text;
                //dtplendDate = DateTime.Parse(datetime3, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
                //dtplendDate = Convert.ToDateTime(datetime3);
                //string str = ddlpricingPartner.SelectedValue.ToString();
                //str = ddlpricingPartner.SelectedItem.ToString();
                //str = ddlpricingPartner.SelectedItem.Text;
                //str = ddlpricingPartner.SelectedItem.Value.ToString();
                //str = ddlpricingPartner.SelectedIndex.ToString();
                //string PriceListType = null;
                //if ((rdoLicenseType.SelectedIndex == 0) && tblPricingPatner.Visible == true)
                //{
                //    if (ddlpricingPartner.SelectedValue != "-1" && rdoProductYear.SelectedValue != "-1")
                //    {
                //        if (ddlpricingPartner.SelectedValue == "SpecialPrice" || ddlpricingPartner.SelectedValue == "ThreeYearPrice")
                //        {
                //            PriceListType = ddlpricingPartner.SelectedValue;
                //        }
                //        else
                //        {
                //            PriceListType = ddlpricingPartner.SelectedValue + " " + rdoProductYear.SelectedValue;
                //        }
                //        returnValue = SPLAAdminHelper.GetPriceListType(PriceListType);
                //    }
                //}
                //else if((rdoLicenseType.SelectedIndex == 1) && tblPricingPatner.Visible == false)
                //{
                //    PriceListType = rdoLicenseType.SelectedItem.Text + " " + rdoProductYear.SelectedValue;
                //    returnValue = SPLAAdminHelper.GetPriceListType(PriceListType);
                //}
                //int Mediatype = 0;
                //if (chkMediatype.Checked)
                //    Mediatype = 1;
                //if ((ddlpricingPartner.SelectedIndex == 1) && (chkThreeYrPrice.Checked))
                //    ThreeYrPrice = 1;
                //else if ((ddlpricingPartner.SelectedIndex == 2) && (chkThreeYrPrice.Checked))
                //    ThreeYrPrice = 2;
                int stpi = 0;
                if (chkstpiyes.Checked == true)
                {
                    stpi = 1;
                }
                else
                {
                    stpi = 0;
                }
                if (rdoRegFee.Checked == true)
                    regFee = 1;
                if (btnSave.Text == "Update")
                {
                    operation = "EDIT";
                    partnerId = Convert.ToInt32(hdnPartnerId.Value);
                }
                if (txtSubscriptionAmt.Text != "")
                {
                    SubscriptionAmt = Convert.ToDecimal(txtSubscriptionAmt.Text);
                }
                else
                {
                    SubscriptionAmt = 0;
                }
                string sez = "";
                if (rbsezno.Checked)
                {
                    sez = "No";
                }
                else if (rbsezyes.Checked)
                {
                    sez = "Yes";
                }
                else
                {
                    sez = "No";
                }
                string license = "";
                if (rdoLicenseType.SelectedIndex == 0)
                {
                    license = "Corporate";
                }
                if (rdoLicenseType.SelectedIndex == 1)
                {
                    license = "Academic";
                }
                if (operation == "ADD")
                {
                    SPLAAdminHelper.AddUpdatePartner(operation, partnerId, txtSPLANo.Text, txtPartnerCompanyName.Text,
                                                      txtPartnerAuthName.Text, txtPartnerDesignation.Text, txtPartnerEmailID.Text,
                                                      txtPartnerAddress.Text, txtPartnerAddress1.Text, txtPartnerCity.Text, Convert.ToInt32(ddlPartnerState.SelectedValue.ToString()),
                                                      txtTelephone.Text, txtPartnerFax.Text, txtPartnerMobile.Text, txtShippingContact.Text,
                                                      txtShippingAddress.Text, txtShippingAddress1.Text, txtShippingCity.Text, Convert.ToInt32(ddlShippingState.SelectedValue.ToString()),
                                                     txtShippingTelephone.Text, txtShippingFax.Text, txtShippingMobile.Text, txtShippingEmail.Text,
                                                      txtEnrollmentNo.Text, Convert.ToInt32(ddlBizVertical.SelectedValue.ToString()),txtPartnerFromDate.Text,
                                                      txtPartnertoDate.Text,Convert.ToInt32(ddlDate.SelectedValue.ToString()), txtUserName.Text, txtPassword.Text,
                                                      ddlpricingPartner.SelectedValue.ToString(), Convert.ToInt32(chkActive.Checked),
                                                      Convert.ToInt32(ddlPaymentType.SelectedValue.ToString()), regFee,
                                                      Convert.ToInt32(ddlPriority.SelectedValue.ToString()), userID,
                                                      SubscriptionAmt, txtContact1Name.Text, txtContact1Email.Text, txtContact1phone.Text, txtContact1Mobile.Text,
                                                      txtContact2Name.Text, txtContact2Email.Text, txtContact2phone.Text, txtContact2Mobile.Text, txtBillingName.Text, txtBillingEmail.Text, txtBillingphone.Text, txtBillingMobile.Text, ddlCreditPeeriod.SelectedValue.ToString(), txtcreditlimit.Text, stpi, ddlRegion.SelectedValue.ToString(), ddlpam.SelectedValue.ToString(), ddlCurrencyType.SelectedItem.ToString(), ddlPricelstcurrency.SelectedItem.ToString(), sez, txtMBSCNo.Text, txtMPNNo.Text, license, txtBillingeScName.Text, txtBillingescphone.Text, txtBillingescEmail.Text, txtBillingescMobile.Text,txtInvDate.Text,txtInvToDate.Text,Convert.ToInt32(txttdds.Text));
                }
                if (operation == "EDIT")
                {
                     //DateTime todate;
                     //if (!string.IsNullOrEmpty(txtInvToDate.Text))
                     //{
                     //    todate = Convert.ToDateTime(txtInvToDate.Text);
                     //}
                     //else
                     //{
                     //    todate = DateTime.Today.Date;
                     //}
                   
                    SPLAAdminHelper.PushPartnertoHIstory(partnerId);
                    SPLAAdminHelper.AddUpdatePartner(operation, partnerId, txtSPLANo.Text, txtPartnerCompanyName.Text,
                                                      txtPartnerAuthName.Text, txtPartnerDesignation.Text, txtPartnerEmailID.Text,
                                                      txtPartnerAddress.Text, txtPartnerAddress1.Text, txtPartnerCity.Text, Convert.ToInt32(ddlPartnerState.SelectedValue.ToString()),
                                                      txtTelephone.Text, txtPartnerFax.Text, txtPartnerMobile.Text, txtShippingContact.Text,
                                                      txtShippingAddress.Text, txtShippingAddress1.Text, txtShippingCity.Text, Convert.ToInt32(ddlShippingState.SelectedValue.ToString()),
                                                      txtShippingTelephone.Text, txtShippingFax.Text, txtShippingMobile.Text, txtShippingEmail.Text,
                                                      txtEnrollmentNo.Text, Convert.ToInt32(ddlBizVertical.SelectedValue.ToString()),txtPartnerFromDate.Text,
                                                      txtPartnertoDate.Text, Convert.ToInt32(ddlDate.SelectedValue.ToString()), txtUserName.Text, txtPassword.Text,
                                                      ddlpricingPartner.SelectedValue.ToString(), Convert.ToInt32(chkActive.Checked),
                                                      Convert.ToInt32(ddlPaymentType.SelectedValue.ToString()), regFee,
                                                      Convert.ToInt32(ddlPriority.SelectedValue.ToString()), userID,
                                                      SubscriptionAmt, txtContact1Name.Text, txtContact1Email.Text, txtContact1phone.Text, txtContact1Mobile.Text,
                                                      txtContact2Name.Text, txtContact2Email.Text, txtContact2phone.Text, txtContact2Mobile.Text, txtBillingName.Text, txtBillingEmail.Text, txtBillingphone.Text, txtBillingMobile.Text, ddlCreditPeeriod.SelectedValue.ToString(), txtcreditlimit.Text, stpi, ddlRegion.SelectedValue.ToString(), ddlpam.SelectedValue.ToString(), ddlCurrencyType.SelectedItem.ToString(), ddlPricelstcurrency.SelectedItem.ToString(), sez, txtMBSCNo.Text, txtMPNNo.Text, license, txtBillingeScName.Text, txtBillingescphone.Text, txtBillingescEmail.Text, txtBillingescMobile.Text, txtInvDate.Text, txtInvToDate.Text, Convert.ToInt32(txttdds.Text));
                }
                DisplayMessage("Partner details saved successfully", MessageType.Information);
                tblPartnerDetail.Visible = false;
                tblViewPartner.Visible = true;
                tblSearch.Visible = true;
                hdnPartnerId.Value = "0";
                InitGridView(ref gvPartner, "Partner");
            }
            catch (Exception ex)
            {
                if (ex.Message.StartsWith("SPLA number,"))
                    DisplayMessage(ex.Message, MessageType.Warning);
                else
                    DisplayErroMessage(ex);
            }
        }
        #endregion
        #region Cancel Button
        private void btnCancel_Click(object sender, EventArgs e)
        {
            try
            {
                // Hide Partner detail table
                lblStatus.Text = "";
                tblPartnerDetail.Visible = false;
                loadBizVerticals(ddlSrchBizVertical);
                loadPricing(ddlSrchLicensePrice);
                //loadMediaPricing(ddlSrchMediaPrice);
                loadStatus(ddlSrchStatus);
                txtSrchCompany.Text = "";
                tblViewPartner.Visible = true;
                tblSearch.Visible = true;
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        #endregion
        #region Add Partner
        private void btnAddPartner_Click(object sender, EventArgs e)
        {
            try
            {
                txtPartnerCompanyName.Enabled = true;
                //Load the Add Partner form
                //tblLicenseType.Visible = true;
                tblPartnerDetail.Visible = true;
                tblViewPartner.Visible = false;
                tblSearch.Visible = false;
                btnSave.Text = "Save";
                tblEnrollHistory.Visible = false;
                chkBillingContact.Checked = true;
                chkBillingEsculationContact.Checked = true;
                chkContact1.Checked = true;
                chkContact2.Checked = true;
               
                    tblBillingContact.Visible = true;
               
                  tblBillingEscContact.Visible = true;
               
                    tblAlternateContact1.Visible = true;
               
                    tblAlternateContact2.Visible = true;
              
                loadBizVerticals(ddlBizVertical);
                //loadPricing(ddlpricingPartner);
                loadLicensePricing(ddlpricingPartner);
                //loadMediaPricing(ddlpricingMedia);
                loadPaymentType();
                loadPriority();
                loadState(ddlPartnerState);
                loadState(ddlShippingState);
                loadCreditPeriod();
             
                loadPriceListCurrencies();
                loadCurrencies();
                //loadProductYears(rdoProductYear);
                loadMonths();
                ddlBizVertical.Items.RemoveAt(0);
                ddlBizVertical.Items.Insert(0, new ListItem("Select", "-1"));
                ddlpricingPartner.Items.RemoveAt(0);
                ddlpricingPartner.Items.Insert(0, new ListItem("Select", "-1"));
                //ddlpricingMedia.Items.RemoveAt(0);
                //ddlpricingMedia.Items.Insert(0, new ListItem("Select", "-1"));
                //lblStatus.Text = "";
                ClearControls();
                ClearGridCheckBox();
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        private void loadCurrencies()
        {
            try
            {
                ddlCurrencyType.DataSource = SPLAAdminHelper.GetCurrency();
                ddlCurrencyType.DataTextField = "ConversionType";
                ddlCurrencyType.DataValueField = "ConversionType";
                ddlCurrencyType.DataBind();
                //ddlCurrencyType.Items.Insert(0, new ListItem("Select", "-1"));
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        private void loadPriceListCurrencies()
        {
            try
            {
                ddlPricelstcurrency.DataSource = SPLAAdminHelper.ShowActiveCurrency();
                ddlPricelstcurrency.DataTextField = "Currency";
                ddlPricelstcurrency.DataValueField = "Currency";
                ddlPricelstcurrency.DataBind();
                ddlPricelstcurrency.Items.Insert(0, new ListItem("Select", "-1"));
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        private void loadCreditPeriod()
        {
            try
            {
                DataSet ds = SPLAAdminHelper.GetallCreditPeriod();
                ddlCreditPeeriod.DataSource = ds.Tables[0];
                ddlCreditPeeriod.DataTextField = "Period";
                ddlCreditPeeriod.DataValueField = "ID";
                ddlCreditPeeriod.DataBind();
                ddlCreditPeeriod.Items.Insert(0, new ListItem("Select", "-1"));
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        #endregion
        #region Delete Button
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //Delete partners
            int selectedCount = 0;
            try
            {
                // If deletion is confirmed by the user, perform delete
                if (hdnDelPartner.Value == "1")
                {
                    for (int i = 0; i < gvPartner.Rows.Count; i++)
                    {
                        CheckBox chk = (CheckBox)gvPartner.Rows[i].Cells[1].FindControl("chkboxPartner");
                        if (chk != null)
                        {
                            if (chk.Checked)
                            {
                                selectedCount++;
                                SPLAAdminHelper.DeletePartnerByID(Convert.ToInt32(gvPartner.Rows[i].Cells[1].Text));
                            }
                        }
                    }
                    InitGridView(ref gvPartner, "Partner");
                    if (selectedCount == 0)
                        DisplayMessage("Please select atleast one record to delete", MessageType.Warning);
                    else
                    {
                        DisplayMessage("Partner details Deleted successfully", MessageType.Information);
                    }
                }
                hdnDelPartner.Value = "0";
                tblPartnerDetail.Visible = false;
                ClearGridCheckBox();
                loadBizVerticals(ddlSrchBizVertical);
                loadPricing(ddlSrchLicensePrice);
                //loadMediaPricing(ddlSrchMediaPrice);
                loadStatus(ddlSrchStatus);
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        #endregion
        #region Search Button
        private void btnSearch_Click(object sender, EventArgs e)
        {
            lblStatus.Text = "";
            this.InitGridView(ref gvPartner, "PartnerSearch");
            tblPartnerDetail.Visible = false;
        }
        #endregion
        #endregion
        #region Partner Manager
        protected void loadPartnerManagers()
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                DataTable dtLoadUser = new DataTable();
                dtLoadUser.Columns.Add("ID");
                dtLoadUser.Columns.Add("Name");
                string Groupname = string.Empty;
                Groupname = System.Configuration.ConfigurationSettings.AppSettings["PartnerManagerGroupName"].ToString();
                try
                {
                    using (SPSite site = new SPSite(SPContext.Current.Web.Url))
                    {
                        using (SPWeb web = site.OpenWeb())
                        {
                            SPGroup sGroup = web.SiteGroups[Groupname];
                            SPUserCollection userGroup = sGroup.Users;
                            int i = 0;
                            foreach (SPUser user in userGroup)
                            {
                                dtLoadUser.Rows.Add(dtLoadUser.NewRow());
                                dtLoadUser.Rows[i]["ID"] = user.ID;
                                dtLoadUser.Rows[i]["Name"] = user.Name;
                                i++;
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    throw;
                }
                ddlpam.DataSource = dtLoadUser;
                ddlpam.DataValueField = "ID";
                ddlpam.DataTextField = "Name";
                ddlpam.DataBind();
                ddlpam.Items.Insert(0, new ListItem("Select", "-1"));
            });
        }
        #endregion
        #region All Private methods
        #region Contact Address Check for Add Partner
        private void chkBillingContact_CheckedChanged(object sender, EventArgs e)
        {
            if (chkBillingContact.Checked)
                tblBillingContact.Visible = true;
            else
                tblBillingContact.Visible = false;
        }
        private void chkContact2_CheckedChanged(object sender, EventArgs e)
        {
            if (chkContact2.Checked)
                tblAlternateContact2.Visible = true;
            else
                tblAlternateContact2.Visible = false;
        }
        private void chkContact1_CheckedChanged(object sender, EventArgs e)
        {
            if (chkContact1.Checked)
                tblAlternateContact1.Visible = true;
            else
                tblAlternateContact1.Visible = false;
       }
        #endregion
        #region SelectedIndexChanged
        private void ddlpricingPartner_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((ddlpricingPartner.SelectedIndex == 1) || (ddlpricingPartner.SelectedIndex == 2))
            {
                tblProductYear.Visible = true;
                rdoProductYear.Items.Clear();
                loadProductYears(rdoProductYear);
                chkThreeYrPrice.Visible = true;
                lblThreeYearPrice.Visible = true;
                chkThreeYrPrice.Checked = true;
            }
            else
            {
                tblProductYear.Visible = false;
                rdoProductYear.Items.Clear();
                chkThreeYrPrice.Visible = false;
                lblThreeYearPrice.Visible = false;
            }
        }
        private void rdoLicenseType_SelectedIndexChanged(object sender, EventArgs e)
        {
            int LicenseType = 0;
            if (rdoLicenseType.SelectedIndex == 0)
            {
                //LicenseType = Convert.ToInt32(rdoLicenseType.SelectedValue);
                //for (int i = ddlpricingPartner.Items.Count - 1; i >= 0; i--)
                //    ddlpricingPartner.Items.RemoveAt(i);
                //ddlpricingPartner.DataSource = SPLAAdminHelper.GetSearchCriteriaLicense("License", "Corporate");
                //ddlpricingPartner.DataTextField = "PriceListName";
                //ddlpricingPartner.DataValueField = "PriceListName";
                //ddlpricingPartner.DataBind();
                //ddlpricingPartner.Items.Insert(0, new ListItem("Select", "-1"));
                string currency = ddlPricelstcurrency.SelectedItem.ToString();
                if (currency.Contains("India"))
                {
                    currency = "Indian Rupee";
                }
                if (currency.Contains("Dollar"))
                {
                    currency = "US Dollar";
                }
                ddlpricingPartner.DataSource = SPLAAdminHelper.GetPriceListName_License("Corporate", currency);
                ddlpricingPartner.DataTextField = "PriceListName";
                ddlpricingPartner.DataValueField = "PriceListName";
                ddlpricingPartner.DataBind();
                ddlpricingPartner.Items.Insert(0, new ListItem("Select", "-1"));
            }
            else if (rdoLicenseType.SelectedIndex == 1)
            {
                //LicenseType = Convert.ToInt32(rdoLicenseType.SelectedValue);
                //for (int i = ddlpricingPartner.Items.Count - 1; i >= 0; i--)
                //    ddlpricingPartner.Items.RemoveAt(i);
                //ddlpricingPartner.DataSource = SPLAAdminHelper.GetSearchCriteriaLicense("License", "Academic");
                //ddlpricingPartner.DataTextField = "PriceListName";
                //ddlpricingPartner.DataValueField = "PriceListName";
                //ddlpricingPartner.DataBind();
                //ddlpricingPartner.Items.Insert(0, new ListItem("Select", "-1"));
                string currency = ddlPricelstcurrency.SelectedItem.ToString();
                if (currency.Contains("India"))
                {
                    currency = "Indian Rupee";
                }
                if (currency.Contains("Dollar"))
                {
                    currency = "US Dollar";
                }
                ddlpricingPartner.DataSource = SPLAAdminHelper.GetPriceListName_License("Academic", currency);
                ddlpricingPartner.DataTextField = "PriceListName";
                ddlpricingPartner.DataValueField = "PriceListName";
                ddlpricingPartner.DataBind();
                ddlpricingPartner.Items.Insert(0, new ListItem("Select", "-1"));
            }
        }
        #endregion
        #region load Partner Details
        public void loadPartnerDetails(int partnerID)
        {
            string[] price;
            try
            {
                DataTable dt = SPLAAdminHelper.GetPartnerByID(partnerID);
                if (dt.Rows.Count > 0)
                {
                    if ((dt.Rows[0]["SPLANo"].ToString() == null) || (dt.Rows[0]["SPLANo"].ToString() == ""))
                    {
                        txtSPLANo.Text = "YETTOGET";
                    }
                    else
                    {
                        txtSPLANo.Text = dt.Rows[0]["SPLANo"].ToString();
                    }
                    txtEnrollmentNo.Text = dt.Rows[0]["EnrollmentNo"].ToString();
                    txtMBSCNo.Text = dt.Rows[0]["MBSCNo"].ToString();
                    txtMPNNo.Text = dt.Rows[0]["MPNNo"].ToString();
                    txtPartnerFromDate.Text = dt.Rows[0]["LicenseFromDate"].ToString();
                    txtPartnertoDate.Text = dt.Rows[0]["LicenseToDate"].ToString();
                    txtPartnerCompanyName.Text = dt.Rows[0]["PartnerCompanyName"].ToString();
                    txtPartnerAuthName.Text = dt.Rows[0]["PartnerAuthorisedName"].ToString();
                    txtPartnerDesignation.Text = dt.Rows[0]["PartnerDesignation"].ToString();
                    txtPartnerEmailID.Text = dt.Rows[0]["PartnerEmailID"].ToString();
                    txtPartnerAddress.Text = dt.Rows[0]["PartnerAddress"].ToString();
                    txtPartnerAddress1.Text = dt.Rows[0]["PartnerAddress1"].ToString();
                    txtPartnerCity.Text = dt.Rows[0]["PartnerCity"].ToString();
                    txtTelephone.Text = dt.Rows[0]["PartnerTelephone"].ToString();
                    txtPartnerFax.Text = dt.Rows[0]["PartnerFax"].ToString();
                    txtPartnerMobile.Text = dt.Rows[0]["PartnerMobile"].ToString();
                    txtShippingEmail.Text = dt.Rows[0]["ShippingEmail"].ToString();
                    txtShippingContact.Text = dt.Rows[0]["ShippingContact"].ToString();
                    txtShippingAddress.Text = dt.Rows[0]["ShippingAddress"].ToString();
                    txtShippingAddress1.Text = dt.Rows[0]["ShippingAddress1"].ToString();
                    txtShippingCity.Text = dt.Rows[0]["ShippingCity"].ToString();
                    txtShippingTelephone.Text = dt.Rows[0]["ShippingTelephone"].ToString();
                    txtShippingFax.Text = dt.Rows[0]["ShippingFax"].ToString();
                    txtShippingMobile.Text = dt.Rows[0]["ShippingMobile"].ToString();
                    //txtSPLANo.Text = dt.Rows[0]["MicroSoftPartnerNumber"].ToString();
                    txtUserName.Text = dt.Rows[0]["userName"].ToString();
                    txtPassword.Attributes.Add("value", dt.Rows[0]["Password"].ToString());
                    //txtfrmDate.Text = dt.Rows[0]["FromDate"].ToString();
                    txttoDate.Text = dt.Rows[0]["ToDate"].ToString();
                    txtSubscriptionAmt.Text = dt.Rows[0]["SubscriptionAmount"].ToString();
                    txtContact1Name.Text = dt.Rows[0]["ContactName1"].ToString();
                    txtContact1Email.Text = dt.Rows[0]["ContactEmailId1"].ToString();
                    txtContact1phone.Text = dt.Rows[0]["ContactPhone1"].ToString();
                    txtContact1Mobile.Text = dt.Rows[0]["ContactMobile1"].ToString();
                    txtContact2Name.Text = dt.Rows[0]["ContactName2"].ToString();
                    txtContact2Email.Text = dt.Rows[0]["ContactEmailId2"].ToString();
                    txtContact2phone.Text = dt.Rows[0]["ContactPhone2"].ToString();
                    txtContact2Mobile.Text = dt.Rows[0]["ContactMobile2"].ToString();
                    txtBillingName.Text = dt.Rows[0]["BillingName"].ToString();
                    txtBillingEmail.Text = dt.Rows[0]["BillingEmailId"].ToString();
                    txtBillingphone.Text = dt.Rows[0]["BillingPhone"].ToString();
                    txtBillingMobile.Text = dt.Rows[0]["BillingMobile"].ToString();
                    txtBillingeScName.Text = dt.Rows[0]["BiilingEscContactName"].ToString();
                    txtBillingescEmail.Text = dt.Rows[0]["BillingEscContactEmail"].ToString();
                    txtBillingescphone.Text = dt.Rows[0]["BillingEscContactPhone"].ToString();
                    txtBillingescMobile.Text = dt.Rows[0]["BillingEscContactMob"].ToString();
                    txtcreditlimit.Text = dt.Rows[0]["CreditLimit"].ToString();
                    //ddlCreditPeeriod.SelectedValue = dt.Rows[0]["CreditPeriod"].ToString();
                    txttdds.Text = dt.Rows[0]["TDSRebate"].ToString();
                    if (dt.Rows[0]["STPI"].ToString() == "1")
                    {
                        chkstpiyes.Checked = true;
                        chkstpino.Checked = false;
                    }
                    else
                    {
                        chkstpiyes.Checked = false;
                        chkstpino.Checked = true;
                    }
                   
                    if (dt.Rows[0]["SEZStatus"].ToString() == "Yes")
                    {
                        rbsezyes.Checked = true;
                        rbsezno.Checked = false;
                    }
                    else if (dt.Rows[0]["SEZStatus"].ToString() == "No")
                    {
                        rbsezno.Checked = true;
                        rbsezyes.Checked = false;
                    }
                    else
                   {
                        rbsezyes.Checked = false;
                    }
                    if ((txtContact1Name.Text != "") || (txtContact1Email.Text != "") || (txtContact1phone.Text != "") || (txtContact1Mobile.Text != ""))
                    {
                        chkContact1.Checked = true;
                        tblAlternateContact1.Visible = true;
                    }
                    else
                    {
                        chkContact1.Checked = false;
                        tblAlternateContact1.Visible = false;
                    }
                    if ((txtContact2Name.Text != "") || (txtContact2Email.Text != "") || (txtContact2phone.Text != "") || (txtContact2Mobile.Text != ""))
                    {
                        chkContact2.Checked = true;
                        tblAlternateContact2.Visible = true;
                    }
                    else
                    {
                        chkContact2.Checked = false;
                        tblAlternateContact2.Visible = false;
                    }
                    if ((txtBillingName.Text != "") || (txtBillingEmail.Text != "") || (txtBillingphone.Text != "") || (txtBillingMobile.Text != ""))
                    {
                        chkBillingContact.Checked = true;
                        tblBillingContact.Visible = true;
                    }
                    else
                    {
                        chkBillingContact.Checked = false;
                        tblBillingContact.Visible = false;
                    }
                    //if (dt.Rows[0]["Media"].ToString() == "1")
                    //{
                    //    chkMediatype.Checked = true;
                    //}
                    //else
                    //{
                    //    chkMediatype.Checked = false;
                    //}
                   
                    loadPriceListCurrencies();
                    loadCurrencies();
                    loadCreditPeriod();
                    tblPricingPatner.Visible = false;
                    tblProductYear.Visible = false;
                    loadBizVerticals(ddlBizVertical);
                    loadLicensePricing(ddlpricingPartner);
                    //loadMediaPricing(ddlpricingMedia);
                    loadPaymentType();
                    loadPriority();
                    loadState(ddlPartnerState);
                    loadState(ddlShippingState);
                    loadMonths();
                    //rdoProductYear.Items.Clear();
                    //loadProductYears(rdoProductYear);
                    //if (dt.Rows[0]["BusinessVerticalId"].ToString() != null)
                    // ddlBizVertical.SelectedValue = dt.Rows[0]["BusinessVerticalId"].ToString();
                    if (dt.Rows[0]["PartnerState"].ToString() != null)
                        ddlPartnerState.Text = dt.Rows[0]["PartnerState"].ToString();
                    if (dt.Rows[0]["ShippingState"].ToString() != null)
                        ddlShippingState.Text = dt.Rows[0]["ShippingState"].ToString();
                    if (dt.Rows[0]["Active"].ToString() == "True")
                        chkActive.Checked = true;
                    else
                        chkActive.Checked = false;
                    if (dt.Rows[0]["RegistrationFee"].ToString() == "1")
                        rdoRegFee.Checked = true;
                    else
                        rdoRegFeeNone.Checked = false;
                    if (dt.Rows[0]["RegistrationFee"].ToString() == "1")
                        rdoRegFee.Checked = true;
                    else
                        rdoRegFeeNone.Checked = true;
                    if (dt.Rows[0]["PaymentType"].ToString() != null)
                        ddlPaymentType.SelectedValue = dt.Rows[0]["PaymentType"].ToString();
                    //if (dt.Rows[0]["yearlyMonth"].ToString() != null)
                    //   ddlPaymentMonth.SelectedValue = dt.Rows[0]["YearlyMonth"].ToString();
                    txtInvDate.Text = dt.Rows[0]["PLValidFrom"].ToString();
                    txtInvToDate.Text = dt.Rows[0]["PLValidTo"].ToString();
                    ddlBizVertical.SelectedValue = dt.Rows[0]["BusinessVerticalId"].ToString();
                    ddlDate.SelectedValue = dt.Rows[0]["ToDate"].ToString();
                    ddlCreditPeeriod.SelectedValue = dt.Rows[0]["CreditPeriod"].ToString();
                    ddlPriority.SelectedValue = dt.Rows[0]["Priority"].ToString();
                   
                    ddlpam.SelectedValue = dt.Rows[0]["PAM"].ToString();
                    ddlRegion.SelectedValue = dt.Rows[0]["Region"].ToString();
                    ddlpricingPartner.SelectedValue = dt.Rows[0]["PriceList"].ToString();
                    ddlPricelstcurrency.SelectedValue = dt.Rows[0]["PricelistCurrency"].ToString();
                   
                    string currency1 = ddlPricelstcurrency.SelectedItem.ToString().Substring(0, 3);
                    //lblCurrencyType.Text = currency.ToString();
                    ddlCurrencyType.Items.Clear();
                    ddlCurrencyType.DataSource = SPLAAdminHelper.GetCurrencybyPriceList(currency1);
                    ddlCurrencyType.DataTextField = "ConversionType";
                    ddlCurrencyType.DataValueField = "ConversionType";
                    ddlCurrencyType.DataBind();
                    if (ddlCurrencyType.Items.Count == 0)
                    {
                        DisplayMessage("Please upload exchange rates and then select Billing Currencies", MessageType.Warning);
                    }
                    //ddlCurrencyType.Items.Insert(0, new ListItem("Select", "-1"));
                    if (currency1.Contains("USD"))
                    {
                        ddlCurrencyType.Items.Insert(1, new ListItem("INR", "INR"));
                    }
                    if (currency1.Contains("INR"))
                    {
                        ddlCurrencyType.Items.Insert(1, new ListItem("USD", "USD"));
                    }
                    ddlCurrencyType.SelectedValue = dt.Rows[0]["BillingCurrency"].ToString();
                    if (dt.Rows[0]["License"].ToString() == "Corporate")
                    {
                        rdoLicenseType.SelectedIndex = 0;
                        ddlpricingPartner.Items.Clear();
                        string currency = ddlPricelstcurrency.SelectedItem.ToString();
                        if (currency.Contains("India"))
                        {
                            currency = "Indian Rupee";
                        }
                        if (currency.Contains("Dollar"))
                        {
                            currency = "US Dollar";
                        }
                        ddlpricingPartner.DataSource = SPLAAdminHelper.GetPriceListName_License("Corporate", currency);
                        ddlpricingPartner.DataTextField = "PriceListName";
                        ddlpricingPartner.DataValueField = "PriceListName";
                        ddlpricingPartner.DataBind();
                        ddlpricingPartner.Items.Insert(0, new ListItem("Select", "-1"));
                    }
                    if (dt.Rows[0]["License"].ToString() == "Academic")
                    {
                        rdoLicenseType.SelectedIndex = 1;
                        ddlpricingPartner.Items.Clear();
                        string currency = ddlPricelstcurrency.SelectedItem.ToString();
                        if (currency.Contains("India"))
                        {
                            currency = "Indian Rupee";
                        }
                        if (currency.Contains("Dollar"))
                        {
                            currency = "US Dollar";
                        }
                        ddlpricingPartner.DataSource = SPLAAdminHelper.GetPriceListName_License("Academic", currency);
                        ddlpricingPartner.DataTextField = "PriceListName";
                        ddlpricingPartner.DataValueField = "PriceListName";
                        ddlpricingPartner.DataBind();
                        ddlpricingPartner.Items.Insert(0, new ListItem("Select", "-1"));
                    }
                }
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        #endregion
        #region Clearcontrols
        private void ClearControls()
        {
            lblStatus.Text = "";
            txtfrmDate.Text = "";
            txtPartnerAddress.Text = "";
            txtPartnerAddress1.Text = "";
            txtPartnerAuthName.Text = "";
            txtPartnerCity.Text = "";
            txtSPLANo.Text = "";
            txtPartnerCompanyName.Text = "";
            txtPartnerDesignation.Text = "";
            txtPartnerEmailID.Text = "";
            txtPartnerFax.Text = "";
            txtPartnerFromDate.Text = "";
            txtPartnerMobile.Text = "";
            txtEnrollmentNo.Text = "";
            txtPartnertoDate.Text = "";
            txtPassword.Attributes.Add("value", "");
            txtShippingAddress.Text = "";
            txtShippingAddress1.Text = "";
            txtShippingCity.Text = "";
            txtShippingContact.Text = "";
            txtShippingEmail.Text = "";
            txtShippingFax.Text = "";
            txtShippingMobile.Text = "";
            txtShippingTelephone.Text = "";
            //txtSPLANo.Text = "";
            txtTelephone.Text = "";
            txtContact1Name.Text = "";
            txtContact1Email.Text = "";
            txtContact1phone.Text = "";
            txtContact1Mobile.Text = "";
            txtContact2Name.Text = "";
            txtContact2Email.Text = "";
            txtContact2phone.Text = "";
            txtContact2Mobile.Text = "";
            txtBillingName.Text = "";
            txtBillingEmail.Text = "";
            txtBillingphone.Text = "";
            txtBillingMobile.Text = "";
            chkContact1.Checked = false;
            tblAlternateContact1.Visible = false;
            chkContact2.Checked = false;
            tblAlternateContact2.Visible = false;
            chkBillingContact.Checked = false;
            tblBillingContact.Visible = false;
            txttoDate.Text = "";
            txtUserName.Text = "";
            txtcreditlimit.Text = "";
            txtMBSCNo.Text = "";
            txtMPNNo.Text = "";
            chkActive.Checked = true;
            chkMediatype.Checked = true;
            tblProductYear.Visible = false;
            tblPricingPatner.Visible = false;
            rdoLicenseType.ClearSelection();
            ddlRegion.SelectedValue = "-1";
            ddlpam.SelectedValue = "-1";
            txtInvDate.Text = "";
            txtInvToDate.Text = "";
            txtBillingescphone.Text = "";
            txtBillingescEmail.Text ="";
            txtBillingescMobile.Text ="";
            txtBillingeScName.Text ="";
            chkstpino.Checked = false;
            chkstpiyes.Checked = true;
        }
        #endregion
        #region ClearGridCheckBox
        private void ClearGridCheckBox()
        {
            int count = gvPartner.Rows.Count;
            if (count > 0)
            {
                for (int i = 0; i < gvPartner.Rows.Count; i++)
                {
                    CheckBox chkSelect = (CheckBox)gvPartner.Rows[i].Cells[1].FindControl("chkboxPartner");
                    chkSelect.Checked = false;
                }
            }
        }
        #endregion
        #region Load Partner Type
        protected void loadProductYears(RadioButtonList rdobtnList)
        {
            ListItem item = new ListItem();
            item.Text = "2003-2008";
            item.Value = "2003";
            rdobtnList.Items.Insert(0, item);
            item = new ListItem();
            item.Text = "Without 2003";
            item.Value = "2008";
            rdobtnList.Items.Insert(1, item);
        }
        #endregion
        #region Load License Type
        protected void loadLicenseType(RadioButtonList rdobtnList)
        {
            rdobtnList.Items.Clear();
            ListItem item = new ListItem();
            item.Text = "Corporate";
            item.Value = "1";
            rdobtnList.Items.Insert(0, item);
            item = new ListItem();
            item.Text = "Academic";
            item.Value = "2";
            rdobtnList.Items.Insert(1, item);
        }
        #endregion
        #region Load All DropDown Controls
        #region loadBizVerticals
       protected void loadBizVerticals(DropDownList ddlSrchBizVertical)
        {
            try
            {
                DataTable dtbiz = SPLAAdminHelper.GetSearchCriteria("BizVertical");
                if (dtbiz.Rows.Count > 0)
                {
                    ddlSrchBizVertical.DataSource = dtbiz;
                    ddlSrchBizVertical.DataTextField = "BV_BusinessVerticalMasterName";
                    ddlSrchBizVertical.DataValueField = "BV_BusinessVerticalMasterID";
                    ddlSrchBizVertical.DataBind();
                    ddlSrchBizVertical.Items.Insert(0, new ListItem("All", "-1"));
                }
                else
                {
                    DisplayMessage("Please Add Verticals usaing Master Application", MessageType.Warning);
                }
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        #endregion
        #region loadPricing
        protected void loadPricing(DropDownList ddlSrchLicensePrice)
        {
            try
            {
                DataTable dtprice = SPLAAdminHelper.GetSearchCriteria("LicensePrice");
                if (dtprice.Rows.Count > 0)
                {
                    ddlSrchLicensePrice.DataSource = dtprice;
                    ddlSrchLicensePrice.DataTextField = "PriceListName";
                    ddlSrchLicensePrice.DataValueField = "PriceListName";
                    ddlSrchLicensePrice.DataBind();
                    ddlSrchLicensePrice.Items.Insert(0, new ListItem("All", "-1"));
                }
                else
                {
                    DisplayMessage("Before Adding Partners,Please fill in Master Information and Upload/Create Pricelists.", MessageType.Warning);
                }
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        #endregion
        #region loadLicensePricing
        protected void loadLicensePricing(DropDownList ddlLicensePricing)
        {
            try
            {
                for (int i = ddlLicensePricing.Items.Count - 1; i >= 0; i--)
                    ddlLicensePricing.Items.RemoveAt(i);
                //ddlLicensePricing.Items.Insert(0, new ListItem("Select", "-1"));
                //ddlLicensePricing.Items.Insert(1, new ListItem("Kryptos Price", "Kryptos"));
                //ddlLicensePricing.Items.Insert(2, new ListItem("Microsoft Price", "Microsoft"));
                //ddlLicensePricing.Items.Insert(3, new ListItem("Special Price", "SpecialPrice"));
                //code added by Vinitha.K March 2011 as per new pricing changes
                ddlLicensePricing.DataSource = SPLAAdminHelper.GetSearchCriteria("LicensePrice");
                ddlLicensePricing.DataTextField = "PriceListName";
                ddlLicensePricing.DataValueField = "PriceListName";
                ddlLicensePricing.DataBind();
                ddlLicensePricing.Items.Insert(0, new ListItem("Select", "-1"));
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        #endregion
        #region loadStatus
        protected void loadStatus(DropDownList ddlSrchStatus)
        {
            try
            {
                for (int i = ddlSrchStatus.Items.Count - 1; i >= 0; i--)
                    ddlSrchStatus.Items.RemoveAt(i);
                ddlSrchStatus.Items.Insert(0, new ListItem("All", "-1"));
                ddlSrchStatus.Items.Insert(1, new ListItem("Active", "1"));
                ddlSrchStatus.Items.Insert(2, new ListItem("Inactive", "0"));
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        #endregion
        #region Load PaymentType
        protected void loadPaymentType()
        {
            try
            {
                ddlPaymentType.DataSource = SPLAAdminHelper.GetSearchCriteria("PaymentType");
                ddlPaymentType.DataTextField = "PT_TypeName";
                ddlPaymentType.DataValueField = "PT_TypeID";
                ddlPaymentType.DataBind();
                //ddlPaymentType.Items.Insert(0, new ListItem("Select", "-1"));
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        #endregion
        #region Load Priority
       protected void loadPriority()
        {
            try
            {
                DataSet ds = SPLAAdminHelper.GetPriority();
                ddlPriority.DataSource = ds.Tables[0];
                ddlPriority.DataTextField = "PR_PriorityDesc";
               ddlPriority.DataValueField = "PR_PriorityID";
                ddlPriority.DataBind();
                ddlPriority.Items.Insert(0, new ListItem("Select", "-1"));
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        #endregion
        #region Load State
        protected void loadState(DropDownList ddlState)
        {
            try
            {
                ddlState.DataSource = SPLAAdminHelper.GetSearchCriteria("State");
                ddlState.DataTextField = "ST_StateName";
                ddlState.DataValueField = "ST_StateID";
                ddlState.DataBind();
                ddlState.Items.Insert(0, new ListItem("Select", "-1"));
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        #endregion
        #region LoadMonths
        protected void loadMonths()
        {
            try
            {
                for (int i = ddlPaymentMonth.Items.Count - 1; i >= 0; i--)
                    ddlPaymentMonth.Items.RemoveAt(i);
                ddlPaymentMonth.Items.Insert(0, new ListItem("Select", "-1"));
                ddlPaymentMonth.Items.Insert(1, new ListItem("January", "1"));
                ddlPaymentMonth.Items.Insert(2, new ListItem("February", "2"));
                ddlPaymentMonth.Items.Insert(3, new ListItem("March", "3"));
                ddlPaymentMonth.Items.Insert(4, new ListItem("April", "4"));
                ddlPaymentMonth.Items.Insert(5, new ListItem("May", "5"));
                ddlPaymentMonth.Items.Insert(6, new ListItem("June", "6"));
                ddlPaymentMonth.Items.Insert(7, new ListItem("July", "7"));
                ddlPaymentMonth.Items.Insert(8, new ListItem("August", "8"));
                ddlPaymentMonth.Items.Insert(9, new ListItem("September", "9"));
                ddlPaymentMonth.Items.Insert(10, new ListItem("October", "10"));
                ddlPaymentMonth.Items.Insert(11, new ListItem("November", "11"));
                ddlPaymentMonth.Items.Insert(12, new ListItem("December", "12"));
            }
            catch (Exception ex)
            {
                DisplayErroMessage(ex);
            }
        }
        #endregion
        #endregion
        #endregion
        #region Error handling methods
        private enum MessageType
        {
            Information,
            Warning
        }
        private void DisplayErroMessage(Exception e)
        {
            // Display Error Message
            this.lblStatus.ForeColor = Color.Red;
            this.lblStatus.Text = "Application has encountered the problem. Report this message to your administrator. <br>" + e.Message + e.Source + e.StackTrace;
        }
        private void DisplayMessage(string Message, MessageType msgType)
        {
            // Display Warning Message
            if (msgType == MessageType.Information)
                this.lblStatus.ForeColor = Color.Blue;
            else
                this.lblStatus.ForeColor = Color.Red;
            this.lblStatus.Text = Message;
        }
        #endregion
        #region CheckAuthorization
        protected bool CheckUserAuthorized()
        {
            SPWeb web = SPControl.GetContextWeb(Context);
            SPUser currentUser = web.CurrentUser;
            int currentUserID = currentUser.ID;
            string Groupname = string.Empty;
            Groupname = System.Configuration.ConfigurationSettings.AppSettings["AdminGroupName"].ToString();
            try
            {
                using (SPSite site = new SPSite(SPContext.Current.Web.Url))
                {
                    using (web = site.OpenWeb())
                    {
                        SPGroup sGroup = web.SiteGroups[Groupname];
                        SPUserCollection userGroup = sGroup.Users;
                        foreach (SPUser user in userGroup)
                        {
                            if (user.ID == currentUserID)
                                return true;
                        }
                    }
                }
                return false;
            }
            catch (Exception)
            {
                throw;
            }
        }
        #endregion
        #region Ajax Update Code
        private void EnsureUpdatePanelFixups()
        {
            if (this.Page.Form != null)
            {
                string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];
                if (formOnSubmitAtt == "return _spFormOnSubmitWrapper();")
                {
                    this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
                }
            }
            ScriptManager.RegisterStartupScript(this, typeof(Partner), "UpdatePanelFixup", "_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;", true);
        }
        #endregion
    }
}