Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
85 views
Hi
Can anyone help. When i add the Telerik RadRotator and try to validate the page via the W3 i get an error around the Telerik_stylesheetTelerik_stylesheet (the '&' as invalid characters) :

Source that is rendered:
<link href="/WebResource.axd?d=pzW0F7qRjligh3huW8Me6ysIl8-JAoAZT5mUzk2tnZGAhzz8aPQ9dd36ZM7KrPF3Kdb8UVwT0Cglt0wTzFMHKGMmf6gWzunaRQL9N7658D01&t=633728032707031250" type="text/css" rel="stylesheet" class="Telerik_stylesheet" /> <link href="/WebResource.axd?d=pzW0F7qRjligh3huW8Me6ysIl8-JAoAZT5mUzk2tnZGAhzz8aPQ9dd36ZM7KrPF3Kdb8UVwT0Cglt0wTzFMHKGMmf6gWzunaRQL9N7658D01&t=633728032707031250" type="text/css" rel="stylesheet" class="Telerik_stylesheet" />

I have try to setting the following:
EnableEmbeddedBaseStylesheet="False"
EnableEmbeddedSkins="False"
EnableEmbeddedScripts="True"

And including the rotator css in the header. This makes the page valid however the rotator does not work.
Any help please would be most grateful.

Many thanks
TFFX

Fiko
Telerik team
 answered on 02 Apr 2009
1 answer
147 views
Hi

Scenario firstly:
We started on Q4 2006, upgraded to 2008 via zip  (supposedly)  certainly I changed the References in the dll refreshes to the new dll. (and changed / removed the version number from the aspx's and web.config

Now however, on 2009.1  I have several issues, which may well be, because I m running mixed versions. Notably the RadWindows don't allow tabs to change, rad editor menu items to fire etc.

Initially I downloaded the 2009 exe and ran setup  ....GAC errors everywhere. so Removed everything remotely Telerik from the GAC.
Then used the zip,  extracted it, and copied the folders  to Inetpub/wwwroot/Telerik_RadControls,...& added then to the toolbox.

The Bin at this point still has all dll's listed that have been used in the apps,  which reference  earlier versions of rad controls, which I would rather keep as there would be weeks spent in updating controls on all the pages in several apps.  (Also the default skin eg RADGrid is somewhat different, but I need the new functionalities, export to excel/pdf, rad editor exports etc.)

The web.Ui.dll and radgrid and editor all point to the  Inetpub/wwwroot/Telerik_RadControls/bin/Telerik.Web.UI.Dll, mlst still use something like

<%

@ Register TagPrefix="radG" Namespace="Telerik.WebControls" Assembly="RadGrid.Net2" %>

 


The Questions:
1)
Howcome the updated reference in the  bib/RadGrid.Net2.dll (refreshed with it's.dll.refresh changed to 

C:\Inetpub\wwwroot\Telerik_RadControls\bin\Telerik.Web.UI.dll

still shows the old version of the grid.

Is it the 

<

add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2008.2.723.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false"/>  under

 

<

httpHandlers>

 

in the web.config
with

<

assemblies>

 

....

<

add assembly="Telerik.Web.UI, Culture=neutral, PublicKeyToken=121FAE78165BA3D4"/>

 

(NO Version numbering) which allows this.

2)  What would i need to do, to ensure I can use both versions successfully?? 
  • Do i have to do work in the GAC  , or/and web.config, or/and
        C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\WebSiteName\
  • Should I (hopefully not)  uninstall 2006/2009 and start again?



many Thanks
Neal
Pavlina
Telerik team
 answered on 02 Apr 2009
7 answers
145 views

Hi,

My problem is as follows. I'm trying load dynamicaly load buttons in my page. I then want them to update a label (as a test). For the buttons I wish to use htmlbutton as I can change their content more easily. unfortunately when I try click those button nothing happens to the label although it's event is fired on the server. (break point is vs proves that). When I disable ajax. the label is updated. When I change to ordinary buttons. Everything works as expected, an ajax request is fired and the label is updated.

Why doen't the label update after pushing the htmlbutton?

            magischerSqlConnection.Open();  
            SqlCommand command = new SqlCommand("exec getTaskPaneItemAccess @userId", magischerSqlConnection);  
            command.Parameters.Add(new SqlParameter("userId", userId));  
            SqlDataReader reader = command.ExecuteReader();  
 
            while(reader.Read())  
            {  
                  
    /*           
                HtmlButton hb = new HtmlButton();
                hb.ServerClick += new EventHandler(hb_ServerClick);
                hb.InnerHtml = "<div style=\"width:180px;height:30px;\" ><img align=\"left\" src='/LoadImage.ashx?id=" + reader["taskPaneItemImage"].ToString() + "' /> " + reader["taskPaneItemName"].ToString() + "</div>";
                this.FindControl("rpv_" + reader["taskPaneName"].ToString()).Controls.Add(hb);
      */            
/*
                                Button hb = new Button();
                hb.Text = reader["taskPaneItemName"].ToString();
                hb.Click += new EventHandler(hb_Click);
                this.FindControl("rpv_" + reader["taskPaneName"].ToString()).Controls.Add(hb);
  */                
                RadAjaxManager1.AjaxSettings.AddAjaxSetting(hb, Label1);  
 
            }  
            magischerSqlConnection.Close();  
            BottomLeftPane.Scrolling = SplitterPaneScrolling.None;  
            BottomLeftPane.Height = numberOfTaskPanes * 36;  
        }  
 
        void hb_Click(object sender, EventArgs e)  
        {  
            Button hb = (Button)sender;  
            Label1.Text = hb.ClientID;  
        }  
 
        void hb_ServerClick(object sender, EventArgs e)  
        {  
            HtmlButton hb = (HtmlButton)sender;  
            Label1.Text = hb.ClientID;  
 
        }  
 
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Magischer._Default" %> 
 
<%@ Register assembly="Telerik.Web.UI, Version=2008.3.1105.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
    <title>Untitled Page</title> 
    <link href="controls.css" rel="stylesheet" type="text/css" /> 
      
    <script type="text/javascript">  
    //<!--  
    function OnClientItemClicking(sender, eventArgs)  
    {  
        var multipage = $find("MainTaskPages");  
        multipage.set_selectedIndex(eventArgs.get_item().get_index());  
    }  
    //--> 
    </script> 
 
</head> 
<body> 
    <form id="form1" runat="server">  
        <telerik:RadScriptManager ID="ScriptManager1" runat="server" EnableTheming="True">  
        </telerik:RadScriptManager> 
        
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
        </telerik:RadAjaxManager> 
        
        <telerik:RadAjaxPanel ID="MainFilterPanel" runat="server" height="55px" width="695px">  
            <telerik:RadComboBox ID="RadComboBox1" Runat="server" CssClass="floatLeft">  
            </telerik:RadComboBox> 
            <telerik:RadComboBox ID="RadComboBox3" Runat="server" CssClass="floatLeft">  
            </telerik:RadComboBox> 
            <telerik:RadComboBox ID="RadComboBox2" Runat="server" CssClass="floatLeft">  
            </telerik:RadComboBox> 
        </telerik:RadAjaxPanel> 
          
        <telerik:RadSplitter ID="MainSplitter" runat="server">  
            <telerik:RadPane ID="MainContentPane" runat="server" scrolling="none">  
                <telerik:RadSplitter ID="RadSplitter1" runat="server" BorderStyle="None" PanesBorderSize="0">  
                    <telerik:RadPane ID="TaskPane" runat="server" Width="198px" MinWidth="198" MaxWidth="600" Scrolling="None">  
                        <telerik:RadSplitter ID="RadSplitter2" runat="server" BorderStyle="None" PanesBorderSize="0" Height="100%" Orientation="Horizontal" > 
                            <telerik:RadPane ID="TopLeftPane" runat="server">  
                                <telerik:RadMultiPage ID="MainTaskPages" runat="server" SelectedIndex="0"   
                                    Height="100%" Width="100%" BackColor="White" BorderColor="#6593cf"   
                                    BorderStyle="Solid" BorderWidth="0px"></telerik:RadMultiPage> 
                            </telerik:RadPane> 
                            <telerik:RadSplitBar ID="RadSplitBar2" runat="server" CollapseMode="Backward" EnableResize="False" /> 
                            <telerik:RadPane ID="BottomLeftPane" runat="server" Height="120px">  
                                <telerik:RadPanelBar ID="MainTaskPaneBar" Runat="server"   
                                    ExpandMode="SingleExpandedItem" Skin="Office2007"   
                                    OnClientItemClicking="OnClientItemClicking" Width="100%" Height="100%">  
                                    <CollapseAnimation Type="None" Duration="100"></CollapseAnimation> 
                                    <ExpandAnimation Type="None" Duration="100"></ExpandAnimation> 
                                </telerik:RadPanelBar> 
                            </telerik:RadPane> 
                        </telerik:RadSplitter> 
                    </telerik:RadPane> 
                    <telerik:RadSplitBar ID="RadSplitBar1" runat="server" CollapseMode="Forward" EnableResize="False" /> 
                    <telerik:RadPane ID="RightPane" runat="server">  
                        <asp:Panel ID="Panel1" runat="server" Height="81px" Width="156px">  
                            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> 
                        </asp:Panel> 
                    </telerik:RadPane> 
                </telerik:RadSplitter> 
            </telerik:RadPane> 
        </telerik:RadSplitter> 
    </form> 
</body> 
</html> 
 
Pavel
Telerik team
 answered on 02 Apr 2009
5 answers
110 views
Hi,

I am getting the following error when the Ajax control is clicked after session timeout.

Unexpected ajax response was recieved from the server.
This may be caused by one of the following reasons:
    - Response.Redirect
    - Server.Transfer
    - Custom htto handler
    - Incorrect loading of an "Ajaxified" user control

Verify that you don't get a server side exception or any other undesired behaviour, when you set the EnableAjax property to false

Please help us resolve this error. It would be much appreciated if all the possible solutions are listed.

Thanks in advance..
Ramprasad.
Pavlina
Telerik team
 answered on 02 Apr 2009
1 answer
195 views
Hi
      I have used the User Control with in Grid . In this user control to have dynamic generation Controls.  When I Click the Grid Edit Mode that Time the User Control is Showing. I want to need that Dynamic Control id... So i go and get view source code that time the control Id is Generated.. the number of rows is displaying in the grid.. ok... Each and Every to have the different Id's But i want to common id.. Because i will increase the for loop and to do some process...

for example
I Click the fourth row

((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtSofaBed" + i.ToString()]) != null)

ok here each and every row  chancing the below bold areas like this one($ctl00$ctl13$)
((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtSofaBed" + i.ToString()]) != null)


My source Code is below Please Check to give me

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data;
using System.Collections;

using Microsoft.Practices.EnterpriseLibrary.Validation;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
using Microsoft.Practices.EnterpriseLibrary.Validation.Integration;
using Microsoft.Practices.EnterpriseLibrary.Validation.Integration.AspNet;


using Telerik.Web.UI;
using Com.JetSoft.JetSoftFramework.Property;
using Com.JetSoft.JetSoftComponent.Property;
using Com.JetSoft.JetSoftFramework.System;
using Com.JetSoft.JetSoftComponent.System;
using Com.JetSoft.JetSoftComponent.Contact;
using Com.JetSoft.JetSoftFramework.Contact;
using Com.JetSoft.Admin.Base;
using Resources;
using System.Configuration;

namespace JetSoftAdmin.UserControl
{
    public partial class PropertySearch : System.Web.UI.UserControl
    {
        #region "Page Level Declaration"
        AreaData areaData = new AreaData();
        AreaManager areaManager = new AreaManager();
        PropertyData propertyData = new PropertyData();
        Com.JetSoft.JetSoftComponent.Property.PropertyManager propertyManager = new Com.JetSoft.JetSoftComponent.Property.PropertyManager();       
        GeoAreasManager geoAreasManager = new GeoAreasManager();
        ContactData contactData = new ContactData();
        ContactManager contactManager = new ContactManager();
        CategoryManager categoryManager = new CategoryManager();
        AgreementTemplateData agreementTemplateData = new AgreementTemplateData();
        AgreementManager agreementManager = new AgreementManager();
        List<PropertyData> aPropertyDataList = null;      
        HiddenField hdnUtilitiesDetailsId = new HiddenField();
        long countBedrows;
        int j;
        int ValueSize;
        
        private Hashtable AmenitiedChecked
        {
            get
            {
                object res = ViewState["_cc"];
                if (res == null)
                {
                    res = new Hashtable();
                    ViewState["_cc"] = res;
                }

                return (Hashtable)res;
            }
        }


        #endregion

        /// <summary>
        /// Page Load Event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
                           
                txtPropertyId.Text = (JSSessionHandler.GetSessionValue("PropertyId").ToString());
                aPropertyDataList = propertyManager.GetPropertyByID(Convert.ToInt64(txtPropertyId.Text));
               
                ValueSize = Convert.ToInt32(ConfigurationSettings.AppSettings["PropertyDropDownValueSize"]);

        }


        //Page Prerenter Page

        protected void Page_PreRender(object sender, EventArgs e)
        {

            //Load Owner Agreement Data From DB
            LoadAgreementTemplateOwnerDataFromDB();

            //Load Renter Agreement Details Data From DB
            LoadAgreementTemplateRenterDataFromDB();

            //Load The Property Data's From DataBase to Page
            LoadPropertyFromDataBase();

            //Load the Utilities Details
            //LoadUtilitiesDetailsFromDB();

            //Load the Amentities Detials From DataBase
             LoadPropertyUtilitiesDetailFromDB();
             
            //Load Amenities Details From Page
           //LoadAmenitiesDetailsFromDB();         

           //Load The Amentities Details From DataBase
            LoadPropertyAmenitiesDetailFromDB();

            //Dynamic Bed Layout Details From Pages
            DynamicBedLayoutDetails();
        }


        public void LoadPropertyFromDataBase()
        {
            //load Master information From DB
            LoadMasterInformationFromDB();

            //Load the Property Informations Details From DataBase
            LoadPropertyDetailsFromDB();

            //Load the Contact Informations From DataBase
            LoadContactDetailsFromDB();

            //Load All Drop Down Data's From Page
            LoadAllDropDownPropertyDataFromDB();
             
        }

        #region "DropDown"


        //Load All DropDown Data's From Page
        public void LoadAllDropDownPropertyDataFromDB()
        {
            // load the Destination Details From DB
            LoadDestinationFromDB();

            //Load the Country Details From DB
            LoadCountryDetailsFromDB();

            //Load the State Details From DB
            LoadStateDetailsFromDB();

            //Load the Manager Details From DB
            LoadManagerDataFromDB();

            //Load the Owner Details From DB
            LoadOwnerDataFromDB();

            //Load the Refferal Agent Data From DB
            LoadRefferalAgentDataFromDB();

            //Load the Cleaning Company Data From DB
            LoadCleaningCompanyDataFromDB();

            //Load All Deposit Details for Charges
            LoadAllDepositFromDB();

            //Load All the Details from Page
            LoadAllGarageFromDB();

            //Load Feature Property From DB
            LoadAllPropertyFeatureFromDB();


            //Load Unit Type Data From Page
            LoadAllUnitTypeFromDB();

            //load Style From DB
            LoadAllPropertyStyleFromDB();


        
        }

        /// <summary>
        /// Load Destination Data From DataBase
        /// </summary>
        public void LoadDestinationFromDB()
        {
            try
            {
                IList<AreaData> areaSearch = new List<AreaData>();
                areaSearch = areaManager.GetDestinations();
                cmbMasterInfoDestination.DataSource = areaSearch;
                cmbMasterInfoDestination.DataTextField = "Name";
                cmbMasterInfoDestination.DataValueField = "ID";
                cmbMasterInfoDestination.DataBind();
                
                RadComboBoxItem cmbParentArea = new RadComboBoxItem();
                cmbParentArea.Text = " ";
                cmbMasterInfoDestination.Items.Insert(0, cmbParentArea);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
      

        /// <summary>
        /// Load the Country Data in Personal Info Tab
        /// </summary>
        public void LoadCountryDetailsFromDB()
        {
            try
            {
                //Show only active countries
                bool result = bool.Parse(AdminResource.boolTrue);
                IList<CountryData> listCountry = new List<CountryData>();
                listCountry = geoAreasManager.GetAllCountries(result);
                cmbPropertyAddressCountry.DataSource = listCountry;
                cmbPropertyAddressCountry.DataTextField = "Name";
                cmbPropertyAddressCountry.DataValueField = "ID";
                cmbPropertyAddressCountry.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }



        /// <summary>
        /// Load the Default US State
        /// </summary>

        public void LoadStateDetailsFromDB()
        {
            try
            {
                IList<StateData> StatesList = new List<StateData>();
                StatesList = geoAreasManager.GetStatesByCountryId(1);
                cmbPropertyAddressState.DataTextField = "Name";
                cmbPropertyAddressState.DataValueField = "ID";
                cmbPropertyAddressState.DataSource = StatesList;
                cmbPropertyAddressState.DataBind();
            }
            catch
            {
                //TODO : Implement the throw
            }
        }
        /// <summary>
        /// Load the All the Manager Data From Page
        /// </summary>
        public void LoadManagerDataFromDB()
        {

            IList<ContactData> contactData = new List<ContactData>();
            contactData = contactManager.GetAllManager();
            cmbContactManager.DataSource = contactData;
            cmbContactManager.DataTextField = "FullName";
            cmbContactManager.DataValueField = "ID";
            cmbContactManager.DataBind();

            RadComboBoxItem cmbmanager = new RadComboBoxItem();
            cmbmanager.Text = " ";
            cmbContactManager.Items.Insert(0, cmbmanager);
        }


        /// <summary>
        /// Load the Owner Detail for Contact Tab
        /// </summary>
        public void LoadOwnerDataFromDB()
        {
            IList<ContactData> contactData = new List<ContactData>();
            contactData = contactManager.GetAllOwner();
            cmbContactOwner.DataSource = contactData;
            cmbContactOwner.DataTextField = "FullName";
            cmbContactOwner.DataValueField = "ID";
            cmbContactOwner.DataBind();

            RadComboBoxItem cmbowner = new RadComboBoxItem();
            cmbowner.Text = " ";
            cmbContactOwner.Items.Insert(0, cmbowner);
        }



        /// <summary>
        /// Load the All Owner Agreements
        /// </summary>
        public void LoadAgreementTemplateOwnerDataFromDB()
        {
            IList<AgreementTemplateData> agreementData = new List<AgreementTemplateData>();
            agreementData = agreementManager.GetAllTemplateTypeById(1);
            cmbMasterInfoOwnerAgreement.DataSource = agreementData;
            cmbMasterInfoOwnerAgreement.DataTextField = "AgreementName";
            cmbMasterInfoOwnerAgreement.DataValueField = "ID";
            cmbMasterInfoOwnerAgreement.DataBind();

            RadComboBoxItem cmbagreement = new RadComboBoxItem();
            cmbagreement.Text = " ";
            cmbMasterInfoOwnerAgreement.Items.Insert(0, cmbagreement);
        }


        /// <summary>
        /// Load the All Renter Agreements
        /// </summary>
        public void LoadAgreementTemplateRenterDataFromDB()
        {
            IList<AgreementTemplateData> agreementData = new List<AgreementTemplateData>();
            agreementData = agreementManager.GetAllTemplateTypeById(2);
            cmbMasterInfoRenterAgreement.DataSource = agreementData;
            cmbMasterInfoRenterAgreement.DataTextField = "AgreementName";
            cmbMasterInfoRenterAgreement.DataValueField = "ID";
            cmbMasterInfoRenterAgreement.DataBind();

            RadComboBoxItem cmbRenterAgreement = new RadComboBoxItem();
            cmbRenterAgreement.Text = " ";
            cmbMasterInfoRenterAgreement.Items.Insert(0, cmbRenterAgreement);
        }


        /// <summary>
        /// Load the Refferal Agent Details Detail for Contact Tab
        /// </summary>
        public void LoadRefferalAgentDataFromDB()
        {
            IList<ContactData> contactData = new List<ContactData>();
            contactData = contactManager.GetAllReferralAgent();
            cmbContactRefferalAgent.DataSource = contactData;
            cmbContactRefferalAgent.DataTextField = "FullName";
            cmbContactRefferalAgent.DataValueField = "ID";
            cmbContactRefferalAgent.DataBind();

            RadComboBoxItem cmbrefferalAgent = new RadComboBoxItem();
            cmbrefferalAgent.Text = " ";
            cmbContactRefferalAgent.Items.Insert(0, cmbrefferalAgent);
        }

        /// <summary>
        /// Load the Cleaning Details Detail for Contact Tab
        /// </summary>
        public void LoadCleaningCompanyDataFromDB()
        {
            IList<ContactData> cleaningCompanyData = new List<ContactData>();
            cleaningCompanyData = contactManager.GetAllCleaningCompany();
            cmbContactsCleaningCompany.DataSource = cleaningCompanyData;
            cmbContactsCleaningCompany.DataTextField = "Company";
            cmbContactsCleaningCompany.DataValueField = "ID";
            cmbContactsCleaningCompany.DataBind();

            RadComboBoxItem cmbcleaningCompany = new RadComboBoxItem();
            cmbcleaningCompany.Text = " ";
            cmbContactsCleaningCompany.Items.Insert(0, cmbcleaningCompany);
        }

        /// <summary>
        /// Get All the Deposit From DB
        /// </summary>
        public void LoadAllDepositFromDB()
        {
            IList<SystemCategoryData> depositData = new List<SystemCategoryData>();
            depositData = categoryManager.GetAllDeposit();
            cmbChargesDeposit.DataSource = depositData;
            cmbChargesDeposit.DataTextField = "Name";
            cmbChargesDeposit.DataValueField = "ID";
            cmbChargesDeposit.DataBind();

            RadComboBoxItem cmbDeposit = new RadComboBoxItem();
            cmbDeposit.Text = " ";
            cmbChargesDeposit.Items.Insert(0, cmbDeposit);
        }

        /// <summary>
        /// Get All the Garage From DB
        /// </summary>
        public void LoadAllGarageFromDB()
        {
            IList<SystemCategoryData> garageData = new List<SystemCategoryData>();
            garageData = categoryManager.GetAllGarage();
            cmbDetailsHighGarage.DataSource = garageData;
            cmbDetailsHighGarage.DataTextField = "Name";
            cmbDetailsHighGarage.DataValueField = "ID";
            cmbDetailsHighGarage.DataBind();

            RadComboBoxItem cmbGarage = new RadComboBoxItem();
            cmbGarage.Text = " ";
            cmbDetailsHighGarage.Items.Insert(0, cmbGarage);
        }


        /// <summary>
        /// Get All the Garage From DB
        /// </summary>
        public void LoadAllPropertyFeatureFromDB()
        {
            IList<SystemCategoryData> propertyFeatureData = new List<SystemCategoryData>();
            propertyFeatureData = categoryManager.GetAllPropertyFeature();
            cmbDetailsFeature.DataSource = propertyFeatureData;
            cmbDetailsFeature.DataTextField = "Name";
            cmbDetailsFeature.DataValueField = "ID";
            cmbDetailsFeature.DataBind();

            RadComboBoxItem cmbGarage = new RadComboBoxItem();
            cmbGarage.Text = " ";
            cmbDetailsFeature.Items.Insert(0, cmbGarage);
        }


        /// <summary>
        /// Get All the Unit Type From DB
        /// </summary>
        public void LoadAllUnitTypeFromDB()
        {
            IList<SystemCategoryData> propertyUnitTypeData = new List<SystemCategoryData>();
            propertyUnitTypeData = categoryManager.GetAllUnitType();
            cmbDetailsUnitType.DataSource = propertyUnitTypeData;
            cmbDetailsUnitType.DataTextField = "Name";
            cmbDetailsUnitType.DataValueField = "ID";
            cmbDetailsUnitType.DataBind();

            RadComboBoxItem cmbUnitType = new RadComboBoxItem();
            cmbUnitType.Text = " ";
            cmbDetailsUnitType.Items.Insert(0, cmbUnitType);
        }

        /// <summary>
        /// Get All the Garage From DB
        /// </summary>
        public void LoadAllPropertyStyleFromDB()
        {
            IList<SystemCategoryData> propertyStyleData = new List<SystemCategoryData>();
            propertyStyleData = categoryManager.GetAllPropertyStyle();
            cmbDetailsStyle.DataSource = propertyStyleData;
            cmbDetailsStyle.DataTextField = "Name";
            cmbDetailsStyle.DataValueField = "ID";
            cmbDetailsStyle.DataBind();

            RadComboBoxItem cmbstyleType = new RadComboBoxItem();
            cmbstyleType.Text = "";
            cmbDetailsStyle.Items.Insert(0, cmbstyleType);
        }

        #endregion

        /// <summary>
        /// Load the Sub Area Details From Database
        /// </summary>
        /// <param name="o">Destination ID</param>
        /// <param name="e"></param>
        protected void cmbMasterInfoDestination_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            if (cmbMasterInfoArea.SelectedIndex != 0)
            {
                IList<AreaData> subAreaData = new List<AreaData>();
                subAreaData = areaManager.GetSubArea(Convert.ToInt64(cmbMasterInfoDestination.SelectedValue));
                cmbMasterInfoArea.DataSource = subAreaData;
                cmbMasterInfoArea.DataTextField = "Name";
                cmbMasterInfoArea.DataValueField = "ID";
                cmbMasterInfoArea.DataBind();

                RadComboBoxItem cmbSubArea = new RadComboBoxItem();
                cmbSubArea.Text = " ";
                cmbMasterInfoArea.Items.Insert(0, cmbSubArea);
            }
        }

        /// <summary>
        /// Load the Location Details From DataBase
        /// </summary>
        /// <param name="o">Area Id</param>
        /// <param name="e"></param>
        protected void cmbMasterInfoArea_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            if (cmbMasterInfoLocation.SelectedIndex != 0)
            {
                IList<AreaData> locationData = new List<AreaData>();
                locationData = areaManager.GetChildArea(Convert.ToInt64(cmbMasterInfoArea.SelectedValue));
                cmbMasterInfoLocation.DataSource = locationData;
                cmbMasterInfoLocation.DataTextField = "Name";
                cmbMasterInfoLocation.DataValueField = "ID";
                cmbMasterInfoLocation.DataBind();

                RadComboBoxItem cmbLocation = new RadComboBoxItem();
                cmbLocation.Text = " ";
                cmbMasterInfoLocation.Items.Insert(0, cmbLocation);
            }
        }


    

        /// <summary>
        /// Save the Data From DataBase
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateData())
                {
                    UpdatePropertiesDetails();        //Call the Update Functions              
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }


        /// <summary>
        /// Validate the entries before add/update the contact data
        /// </summary>
        /// <returns></returns>

        private bool ValidateData()
        {

            if ((cmbMasterInfoDestination.SelectedIndex == 0) || (cmbMasterInfoDestination.SelectedIndex == -1))
            {
                ValcmbMasterInfoDestination.Visible = true;
                ValcmbMasterInfoDestination.Text = "Destination is required!";
            }

            if ((cmbDetailsUnitType.SelectedIndex == 0) || (cmbDetailsUnitType.SelectedIndex == -1))
            {
                valpropertybedrooms.Visible = true;
                valpropertybedrooms.Text = "Unit Type is required!";
            }

            if ((cmbContactOwner.SelectedIndex == 0) || (cmbContactOwner.SelectedIndex == -1))
            {
                valOwner.Visible = true;
                valOwner.Text = "Owner is required!";
            }

            if ((cmbMasterInfoOwnerAgreement.SelectedIndex == 0) || (cmbMasterInfoOwnerAgreement.SelectedIndex == -1))
            {
                valcmbAgreementOwner.Visible = true;
                valcmbAgreementOwner.Text = "Owner On line Agreement is required!";

            }

            if ((cmbMasterInfoRenterAgreement.SelectedIndex == 0) || (cmbMasterInfoRenterAgreement.SelectedIndex == -1))
            {
                valCmbAgreementRenter.Visible = true;
                valCmbAgreementRenter.Text = "Rental Agreement is required!";

            }

            if ((cmbChargesDeposit.SelectedIndex == 0) || (cmbChargesDeposit.SelectedIndex == -1))
            {
                valChargesDeposit.Visible = true;
                valChargesDeposit.Text = "Deposit is required!";
            }

            if ((cmbChargesExitCleaningFee.SelectedIndex == 0) || (cmbChargesExitCleaningFee.SelectedIndex == -1))
            {
                valExitCleaningFee.Visible = true;
                valExitCleaningFee.Text = "Exit Cleaning Fee is required!";
            }
            //In addition to the mandatory & format validations, perform the data integrity
            //validations to check for duplicates, dependencies if any

            if (Page.IsValid)
            {

                try
                {
                    UserData sessionUser = (UserData)JSSessionHandler.GetSessionValue("UserData");
                    propertyData.Name = txtMasterInfoPropertyName.Text;

                }
                catch
                {

                }

            }

            return (Page.IsValid);

        }

        // Cancel the Process
        protected void BtnCancel_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Content/Property/SearchProperties.aspx");
        }

        protected void UpdatePropertiesDetails()
        {
            try
            {

                LoadMasterInformationDataFromPage();        // Load the Master Information Details from Page             
                loadDetailDataFromPage();                  //  Load Details Tab Details from Page
                LoadAmenitiesFromPage();                   //  Load The Amentities Details from PAge
                LoadUtilitiesDetailsFromPage();
                loadBedLayoutFromPage();
                LoadPropertyCotnactDataFromPage();

                UserData sessionUser = (UserData)JSSessionHandler.GetSessionValue("UserData");
                propertyData.CreatedBy = Convert.ToInt32(sessionUser.Id);
                propertyData.UpdatedBy = Convert.ToInt32(sessionUser.Id);
                propertyData.CreatedOn = new DateTime();
                propertyData.UpdatedOn = propertyData.CreatedOn;
                propertyData.Active = true;

                if ((cmbMasterInfoDestination.SelectedIndex == 0) || (cmbMasterInfoDestination.SelectedIndex == -1))
                {
                    ValcmbMasterInfoDestination.Visible = true;
                    ValcmbMasterInfoDestination.Text = "Destination is required!";
                }

                else if ((cmbDetailsUnitType.SelectedIndex == 0) || (cmbDetailsUnitType.SelectedIndex == -1))
                {
                    valpropertybedrooms.Visible = true;
                    valpropertybedrooms.Text = "Unit Type is required!";
                }

                else if ((cmbContactOwner.SelectedIndex == 0) || (cmbContactOwner.SelectedIndex == -1))
                {
                    valOwner.Visible = true;
                    valOwner.Text = "Owner is required!";
                }

                else if ((cmbMasterInfoOwnerAgreement.SelectedIndex == 0) || (cmbMasterInfoOwnerAgreement.SelectedIndex == -1))
                {
                    valcmbAgreementOwner.Visible = true;
                    valcmbAgreementOwner.Text = "Owner On line Agreement is required!";

                }

                else if ((cmbMasterInfoRenterAgreement.SelectedIndex == 0) || (cmbMasterInfoRenterAgreement.SelectedIndex == -1))
                {
                    valCmbAgreementRenter.Visible = true;
                    valCmbAgreementRenter.Text = "Rental Agreement is required!";

                }

                else if ((cmbChargesDeposit.SelectedIndex == 0) || (cmbChargesDeposit.SelectedIndex == -1))
                {
                    valChargesDeposit.Visible = true;
                    valChargesDeposit.Text = "Deposit is required!";
                }

                else if ((cmbChargesExitCleaningFee.SelectedIndex == 0) || (cmbChargesExitCleaningFee.SelectedIndex == -1))
                {
                    valExitCleaningFee.Visible = true;
                    valExitCleaningFee.Text = "Exit Cleaning Fee is required!";
                }

                else
                {
                    propertyManager.UpdateProperty(propertyData);
                    JSSessionHandler.RemoveSessionKey("msg");
                    JSSessionHandler.SetSessionValue("msg", Resources.AdminResource.msgPropertyAdd);
                    Response.Redirect("SearchProperties.aspx");

                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
               
            }

        }
        /// <summary>
        /// Load the Master Informations Details From Page
        /// </summary>
        protected void LoadMasterInformationDataFromPage()
        {
            try
            {

                propertyData.ID = Convert.ToInt64(txtPropertyId.Text);  

                if ((txtMasterInfoPropertyName.Text != null) && (txtMasterInfoPropertyName.Text != string.Empty))
                    propertyData.Name = txtMasterInfoPropertyName.Text;

                propertyData.Description = txtMasterInfoPropertyName.Text;
                propertyData.Exclusive = chkAddPropertyExclusive.Checked;

                if ((cmbMasterInfoDestination.SelectedIndex != 0) && (cmbMasterInfoDestination.SelectedIndex != -1))
                {
                    propertyData.Destination = Convert.ToInt64(cmbMasterInfoDestination.SelectedValue);
                }


                if ((cmbMasterInfoArea.SelectedIndex != 0) && (cmbMasterInfoArea.SelectedIndex != -1))
                {
                    propertyData.SubArea = Convert.ToInt64(cmbMasterInfoArea.SelectedValue);
                }


                if ((cmbMasterInfoLocation.SelectedIndex != 0) && (cmbMasterInfoLocation.SelectedIndex != -1))
                {
                    //  propertyData.Location = Convert.ToInt64(cmbMasterInfoLocation.SelectedValue);
                   
                }
                propertyData.Location = 5;
                propertyData.ForSale = true;

                if ((txtMasterIfnoSale.Text != null) && (txtMasterIfnoSale.Text != string.Empty))
                {
                    propertyData.SaleValue = Convert.ToDouble(txtMasterIfnoSale.Text);
                }

                if ((cmbMasterInfoOwnerAgreement.SelectedIndex != 0) && (cmbMasterInfoOwnerAgreement.SelectedIndex != -1))
                {
                    propertyData.OwnerAgreementTemplateID = Convert.ToInt64(cmbMasterInfoOwnerAgreement.SelectedValue);
                }
                if ((cmbMasterInfoRenterAgreement.SelectedIndex != 0) && (cmbMasterInfoRenterAgreement.SelectedIndex != -1))
                {
                    propertyData.RenterAgreementTemplateID = Convert.ToInt64(cmbMasterInfoRenterAgreement.SelectedValue);
                }

                propertyData.PhoneNumber1 = txtMasterIfnoTelephone1.Text;
                propertyData.PhoneNumber2 = txtMasterIfnoTelephone2.Text;
                propertyData.CommissionPercentage = Convert.ToSingle(txtMasterIfnoCommission.Text);
                propertyData.Active = chkMasterInfoActive.Checked;

                if ((txtChargesDeposit.Text != null) && (txtChargesDeposit.Text != string.Empty))
                    propertyData.Deposit = Convert.ToSingle(txtChargesDeposit.Text);

                if ((txtChargesDailyCleaningFee.Text != null) && (txtChargesDailyCleaningFee.Text != string.Empty))
                    propertyData.DailyCleaningFee = Convert.ToSingle(txtChargesDailyCleaningFee.Text);

                if ((txtChargesExitCleaningFee.Text != null) && (txtChargesExitCleaningFee.Text != string.Empty))
                    propertyData.ExitCleaningFee = Convert.ToSingle(txtChargesExitCleaningFee.Text);

                if ((txtChargesManagementFee.Text != null) && (txtChargesManagementFee.Text != string.Empty))
                    propertyData.ManagementFee = Convert.ToSingle(txtChargesManagementFee.Text);

                propertyData.ManagementFeeType = Convert.ToInt32(cmbChargesPercentageorDollar.SelectedValue);
                propertyData.ManagementFeePeriod = Convert.ToInt32(cmbChargesManagementPer.SelectedValue);
                propertyData.Version = 1;

                //Load the Master Information Details From Page
                LoadMasterInfoAddressDataFromPage();

            }
            catch (Exception ex)
            {
                throw ex;
                //TODO : Implement the Exceptions
            }

        }

        public void loadDetailDataFromPage()
        {
            UserData sessionUser = (UserData)JSSessionHandler.GetSessionValue("UserData");
            PropertyDetailData propertyDetailData = new PropertyDetailData();
            List<PropertyDetailData> listPropertyDetailData = new List<PropertyDetailData>();

            propertyDetailData.SiteDescription = txtDetailsDescription.Text;
            propertyDetailData.KeyCode = txtDetailsKeyCode.Text;
            propertyDetailData.KeyCodeText = txtDetailsKeyCodeDescription.Text;
            propertyDetailData.LockBoxCode = txtDetailsKeyLockCode.Text;
            propertyDetailData.LockBoxCodeText = txtDetailsKeyLockCodeDescription.Text;
            propertyDetailData.DrivingDirections = txtDetailsDrivingDirections.Text;
            propertyDetailData.InternalNotes = txtDetailsInternalNotes.Text;

            if ((txtDetailsSleeps.Text != null) && (txtDetailsSleeps.Text != string.Empty))
                propertyDetailData.NoOfSleeps = Convert.ToInt32(txtDetailsSleeps.Text);

            if ((txtDetailsNofDays.Text != null) && (txtDetailsNofDays.Text != string.Empty))
                propertyDetailData.MinNoOfDays = Convert.ToInt32(txtDetailsNofDays.Text);

            if ((txtDetailsSquareFootage.Text != null) && (txtDetailsSquareFootage.Text != string.Empty))
                propertyDetailData.SquareFootage = Convert.ToSingle(txtDetailsSquareFootage.Text);

            if ((txtDetailsBedRooms.Text != null) && (txtDetailsBedRooms.Text != string.Empty))
                propertyDetailData.NoOfBedrooms = Convert.ToInt32(txtDetailsBedRooms.Text);

            if ((txtDetailsLofts.Text != null) && (txtDetailsLofts.Text != string.Empty))
                propertyDetailData.NoOfLofts = Convert.ToInt32(txtDetailsLofts.Text);

            if ((txtDetailsBathrooms.Text != null) && (txtDetailsBathrooms.Text != string.Empty))
                propertyDetailData.NoOfBaths = Convert.ToSingle(txtDetailsBathrooms.Text);

            if ((txtDetailsStoriesHigh.Text != null) && (txtDetailsStoriesHigh.Text != string.Empty))
                propertyDetailData.NoOfStories = Convert.ToInt32(txtDetailsStoriesHigh.Text);

            propertyDetailData.Community = txtDetailsCommunityName.Text;
            propertyDetailData.Latitude = txtDetailsLatitude.Text;
            propertyDetailData.Longitude = txtDetailsLongitude.Text;

            if (cmbDetailsUnitType.SelectedIndex != 0)
                propertyDetailData.UnitCategoryID = Convert.ToInt32(cmbDetailsUnitType.SelectedValue);

            if (cmbDetailsFeature.SelectedIndex != 0)
                propertyDetailData.PropertyFeatureCategoryID = Convert.ToInt32(cmbDetailsFeature.SelectedValue);

            if (cmbDetailsStyle.SelectedIndex != 0)
                propertyDetailData.StyleCategoryID = Convert.ToInt32(cmbDetailsStyle.SelectedValue);

            if (cmbDetailsHighGarage.SelectedIndex != 0)
                propertyDetailData.Garage = Convert.ToInt32(cmbDetailsHighGarage.SelectedValue);

            propertyDetailData.CreatedOn = new DateTime();
            propertyDetailData.CreatedBy = Convert.ToInt32(sessionUser.Id);
            propertyDetailData.UpdatedOn = new DateTime();
            propertyDetailData.UpdatedBy = Convert.ToInt32(sessionUser.Id);
            listPropertyDetailData.Add(propertyDetailData);
            propertyData.PropertyDetailCollection = listPropertyDetailData;
        }

        //Load the Amenities Details From Page
        public void LoadAmenitiesFromPage()
        {
            try
            {
                UserData sessionUser = (UserData)JSSessionHandler.GetSessionValue("UserData");
                PropertyAmenityData propertyAmenityData = new PropertyAmenityData();
                List<PropertyAmenityData> listPropertyAmenityData = new List<PropertyAmenityData>();
                List<SystemCategoryData> listsystemCategoryAmentiyData = new List<SystemCategoryData>();
                List<long> amenityList = new List<long>();
                int i = 1;

                for (i = 0; i <= Convert.ToInt32(HdnAmentiesCount.Value); i++)
                {
                    if ((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl25$EditFormControl$chkBusniess" + i.ToString()]) != null)
                    {
                        propertyAmenityData = new PropertyAmenityData();
                        propertyAmenityData.AmenityCategoryID = (Convert.ToInt64(Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl25$EditFormControl$hdnBusniessId" + i.ToString()]));
                        propertyAmenityData.IsAvailable = true;
                        propertyAmenityData.CreatedOn = new DateTime();
                        propertyAmenityData.CreatedBy = Convert.ToInt32(sessionUser.Id);
                        propertyAmenityData.UpdatedOn = new DateTime();
                        propertyAmenityData.UpdatedBy = Convert.ToInt32(sessionUser.Id);
                        listPropertyAmenityData.Add(propertyAmenityData);
                    }


                }


                // Entertainment
                for (i = 0; i <= Convert.ToInt32(HdnEntertainmentCount.Value); i++)
                {
                    if ((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl25$EditFormControl$chkEntertainment" + i.ToString()]) != null)
                    {
                        propertyAmenityData = new PropertyAmenityData();
                        propertyAmenityData.AmenityCategoryID = (Convert.ToInt64(Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl25$EditFormControl$hdnEntertainmentId" + i.ToString()]));
                        propertyAmenityData.IsAvailable = true;
                        propertyAmenityData.CreatedOn = new DateTime();
                        propertyAmenityData.CreatedBy = Convert.ToInt32(sessionUser.Id);
                        propertyAmenityData.UpdatedOn = new DateTime();
                        propertyAmenityData.UpdatedBy = Convert.ToInt32(sessionUser.Id);
                        listPropertyAmenityData.Add(propertyAmenityData);

                    }

                }


                // Kitchen
                for (i = 0; i <= Convert.ToInt32(HdnkitchenCount.Value); i++)
                {
                    if ((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl25$EditFormControl$chkKitchen" + i.ToString()]) != null)
                    {
                        propertyAmenityData = new PropertyAmenityData();
                        propertyAmenityData.AmenityCategoryID = (Convert.ToInt64(Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl25$EditFormControl$hdnKitchenId" + i.ToString()]));
                        propertyAmenityData.IsAvailable = true;
                        propertyAmenityData.CreatedOn = new DateTime();
                        propertyAmenityData.CreatedBy = Convert.ToInt32(sessionUser.Id);
                        propertyAmenityData.UpdatedOn = new DateTime();
                        propertyAmenityData.UpdatedBy = Convert.ToInt32(sessionUser.Id);
                        listPropertyAmenityData.Add(propertyAmenityData);

                    }

                }


                //Living
                for (i = 0; i <= Convert.ToInt32(HdnLivingCount.Value); i++)
                {
                    if ((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl25$EditFormControl$chkLiving" + i.ToString()]) != null)
                    {
                        propertyAmenityData = new PropertyAmenityData();
                        propertyAmenityData.AmenityCategoryID = (Convert.ToInt64(Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl25$EditFormControl$hdnLivingId" + i.ToString()]));
                        propertyAmenityData.IsAvailable = true;
                        propertyAmenityData.CreatedOn = new DateTime();
                        propertyAmenityData.CreatedBy = Convert.ToInt32(sessionUser.Id);
                        propertyAmenityData.UpdatedOn = new DateTime();
                        propertyAmenityData.UpdatedBy = Convert.ToInt32(sessionUser.Id);
                        listPropertyAmenityData.Add(propertyAmenityData);

                    }
                }

                propertyData.AmenityDataCollection = listPropertyAmenityData;

            }
            catch (Exception ex)
            {
                throw ex;
            }


        }


        /// <summary>
        ///  Load the Master Information Address Data
        /// </summary>
        /// <returns></returns>    

        public void LoadMasterInfoAddressDataFromPage()
        {
            try
            {
                PropertyAddressData addressData = new PropertyAddressData();
                addressData.AddressLineFirst = txtPropertyAddressOne.Text;
                addressData.AddressLineSecond = txtPropertyAddressTwo.Text;
                addressData.City = txtPropertyAddressCity.Text;
                addressData.StateId = Convert.ToInt32(cmbPropertyAddressState.SelectedValue);
                addressData.CountryId = Convert.ToInt32(cmbPropertyAddressCountry.SelectedValue);
                addressData.ZipCode = txtPropertyAddressZip.Text;
                UserData sessionUser = (UserData)JSSessionHandler.GetSessionValue("UserData");
                addressData.CreatedBy = Convert.ToInt32(sessionUser.Id);
                addressData.UpdatedBy = Convert.ToInt32(sessionUser.Id);
                addressData.Active = true;
                propertyData.AddressData = addressData;
            }
            catch (Exception ex)
            {
                throw ex;

            }
        }


        public void loadBedLayoutFromPage()
        {
            propertyData.PropertyRoomsCollection = new List<PropertyRoomsData>();
            propertyData.BedLayoutCollection = new List<BedLayoutData>();           
            UserData sessionUser = (UserData)JSSessionHandler.GetSessionValue("UserData");

            if (aPropertyDataList[0].PropertyRoomsCollection != null)
            {
                for (int i = 0; i < Convert.ToInt32(aPropertyDataList[0].PropertyRoomsCollection.Count); i++)
                {

                    if ((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtRoomName" + i.ToString()]) != null)
                    {
                        if ((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtKing" + i.ToString()]) != null)
                        {
                            BedLayoutData bedLayoutData = new BedLayoutData();
                            bedLayoutData.BedCategoryID = 17;
                            bedLayoutData.CreatedOn = new DateTime();
                            bedLayoutData.CreatedBy = Convert.ToInt32(sessionUser.Id);
                            bedLayoutData.UpdatedOn = new DateTime();
                            bedLayoutData.UpdatedBy = Convert.ToInt32(sessionUser.Id);
                            propertyData.BedLayoutCollection.Add(bedLayoutData);
                        }

                        if ((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtQueen" + i.ToString()]) != null)
                        {
                            BedLayoutData bedLayoutData = new BedLayoutData();
                            bedLayoutData.BedCategoryID = 18;
                            bedLayoutData.CreatedOn = new DateTime();
                            bedLayoutData.CreatedBy = Convert.ToInt32(sessionUser.Id);
                            bedLayoutData.UpdatedOn = new DateTime();
                            bedLayoutData.UpdatedBy = Convert.ToInt32(sessionUser.Id);
                            propertyData.BedLayoutCollection.Add(bedLayoutData);
                        }


                        if ((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtDouble" + i.ToString()]) != null)
                        {
                            BedLayoutData bedLayoutData = new BedLayoutData();
                            bedLayoutData.BedCategoryID = 19;
                            bedLayoutData.CreatedOn = new DateTime();
                            bedLayoutData.CreatedBy = Convert.ToInt32(sessionUser.Id);
                            bedLayoutData.UpdatedOn = new DateTime();
                            bedLayoutData.UpdatedBy = Convert.ToInt32(sessionUser.Id);
                            propertyData.BedLayoutCollection.Add(bedLayoutData);
                        }

                        if ((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtSingle" + i.ToString()]) != null)
                        {
                            BedLayoutData bedLayoutData = new BedLayoutData();
                            bedLayoutData.BedCategoryID = 20;
                            bedLayoutData.CreatedOn = new DateTime();
                            bedLayoutData.CreatedBy = Convert.ToInt32(sessionUser.Id);
                            bedLayoutData.UpdatedOn = new DateTime();
                            bedLayoutData.UpdatedBy = Convert.ToInt32(sessionUser.Id);
                            propertyData.BedLayoutCollection.Add(bedLayoutData);
                        }


                        if ((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtSofaBunk" + i.ToString()]) != null)
                        {
                            BedLayoutData bedLayoutData = new BedLayoutData();
                            bedLayoutData.BedCategoryID = 21;
                            bedLayoutData.CreatedOn = new DateTime();
                            bedLayoutData.CreatedBy = Convert.ToInt32(sessionUser.Id);
                            bedLayoutData.UpdatedOn = new DateTime();
                            bedLayoutData.UpdatedBy = Convert.ToInt32(sessionUser.Id);
                            propertyData.BedLayoutCollection.Add(bedLayoutData);
                        }

                        if ((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtSofaBed" + i.ToString()]) != null)
                        {
                            BedLayoutData bedLayoutData = new BedLayoutData();
                            bedLayoutData.BedCategoryID = 22;
                            bedLayoutData.CreatedOn = new DateTime();
                            bedLayoutData.CreatedBy = Convert.ToInt32(sessionUser.Id);
                            bedLayoutData.UpdatedOn = new DateTime();
                            bedLayoutData.UpdatedBy = Convert.ToInt32(sessionUser.Id);
                            propertyData.BedLayoutCollection.Add(bedLayoutData);
                        }

                        PropertyRoomsData propertyRoomsData = new PropertyRoomsData();
                        propertyRoomsData.RoomName = (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl53$EditFormControl$txtRoomName" + i.ToString()]);
                        propertyRoomsData.Notes = (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl53$EditFormControl$Notes" + i.ToString()]);

                        propertyRoomsData.CreatedOn = new DateTime();
                        propertyRoomsData.CreatedBy = Convert.ToInt32(sessionUser.Id);
                        propertyRoomsData.UpdatedOn = new DateTime();
                        propertyRoomsData.UpdatedBy = Convert.ToInt32(sessionUser.Id);
                        propertyData.PropertyRoomsCollection.Add(propertyRoomsData);

                    }


                }
            }
        }


        //Load the Contact Details
        public void LoadPropertyCotnactDataFromPage()
        {
            UserData sessionUser = (UserData)JSSessionHandler.GetSessionValue("UserData");
            PropertyContactData propertyContactData = new PropertyContactData();
            List<PropertyContactData> listPropertyContactData = new List<PropertyContactData>();

            if (cmbContactManager.SelectedIndex != 0)
            {
                propertyContactData.ContactTypeID = Convert.ToInt32(JetContactTypes.PropertyManager);
                propertyContactData.ContactID = Convert.ToInt64(cmbContactManager.SelectedValue);
                listPropertyContactData.Add(propertyContactData);

            }

            if (cmbContactOwner.SelectedIndex != 0)
            {
                propertyContactData = new PropertyContactData();
                propertyContactData.ContactID = Convert.ToInt64(cmbContactOwner.SelectedValue);
                propertyContactData.ContactTypeID = Convert.ToInt32(JetContactTypes.Owner);
                listPropertyContactData.Add(propertyContactData);
            }

            if (cmbContactRefferalAgent.SelectedIndex != 0)
            {
                propertyContactData = new PropertyContactData();
                propertyContactData.ContactID = Convert.ToInt64(cmbContactRefferalAgent.SelectedValue);
                propertyContactData.ContactTypeID = Convert.ToInt32(JetContactTypes.PropertyReferralAgent);
                listPropertyContactData.Add(propertyContactData);
            }

            if (cmbContactsCleaningCompany.SelectedIndex != 0)
            {
                propertyContactData = new PropertyContactData();
                propertyContactData.ContactID = Convert.ToInt64(cmbContactsCleaningCompany.SelectedValue);
                propertyContactData.ContactTypeID = Convert.ToInt32(JetContactTypes.CleaningCompany);
                listPropertyContactData.Add(propertyContactData);
            }

            propertyData.ContactCollection = listPropertyContactData;


        }



        /// <summary>
        /// Handling PreRender Event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        ///
        protected void griduniversal_PreRender(object sender, System.EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this.griduniversal.MasterTableView.Rebind();
            }
        }


        /// <summary>
        /// Loads the data source
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void griduniversal_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {

            IList<ContactData> gridData = new List<ContactData>();
            // gridData = contactManager.GetContact();
            gridData = contactManager.GetContactByTypeId(Convert.ToInt32(JetContactTypes.PropertyVendor));
            this.griduniversal.DataSource = gridData;
        }


        /// <summary>
        /// Grid Edit Data
        /// </summary>
        /// <param name="sourcem"></param>
        /// <param name="e"></param>
        protected void griduniversal_EditCommand(object sourcem, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.EditCommandName)
            {
                GridDataItem item = (GridDataItem)e.Item;
                string contactId = item.GetDataKeyValue("id").ToString();
                JSSessionHandler.SetSessionValue("contactId", contactId);

                switch (item.GetDataKeyValue("ContactTypeID").ToString())
                {
                    case "1":
                        griduniversal.MasterTableView.EditFormSettings.UserControlName = "~/UserControl/Renter.ascx";
                        break;
                    case "2":
                        griduniversal.MasterTableView.EditFormSettings.UserControlName = "~/UserControl/PropertyOwner.ascx";
                        break;
                    case "3":
                        griduniversal.MasterTableView.EditFormSettings.UserControlName = "~/UserControl/PropertyReferralAgent.ascx";
                        break;
                    case "4":
                        griduniversal.MasterTableView.EditFormSettings.UserControlName = "~/UserControl/SalesPerson.ascx";
                        break;
                    case "5":
                        griduniversal.MasterTableView.EditFormSettings.UserControlName = "~/UserControl/CleaningCompany.ascx";
                        break;
                    case "6":
                        griduniversal.MasterTableView.EditFormSettings.UserControlName = "~/UserControl/PropertyVendor.ascx";
                        break;
                    case "7":
                        griduniversal.MasterTableView.EditFormSettings.UserControlName = "~/UserControl/RenterLead.ascx";
                        break;
                    case "8":
                        griduniversal.MasterTableView.EditFormSettings.UserControlName = "~/UserControl/OwnerLead.ascx";
                        break;
                    case "9":
                        griduniversal.MasterTableView.EditFormSettings.UserControlName = "~/UserControl/OutsideVendorLead.ascx";
                        break;
                    case "10":
                        griduniversal.MasterTableView.EditFormSettings.UserControlName = "~/UserControl/OutsideVendorLead.ascx";
                        break;
                    case "11":
                        griduniversal.MasterTableView.EditFormSettings.UserControlName = "~/UserControl/PropertyManager.ascx";
                        break;
                    case "12":
                        griduniversal.MasterTableView.EditFormSettings.UserControlName = "~/UserControl/OutSideVendor.ascx";
                        break;
                    case "13":
                        griduniversal.MasterTableView.EditFormSettings.UserControlName = "~/UserControl/OwnerLead.ascx";
                        break;
                    case "14":
                        griduniversal.MasterTableView.EditFormSettings.UserControlName = "~/UserControl/RenterLead.ascx";
                        break;
                    case "15":
                        griduniversal.MasterTableView.EditFormSettings.UserControlName = "~/UserControl/ReservationRefferalAgent.ascx";
                        break;
                }
            }

        }


        protected void BtnAddITM_Click(object sender, EventArgs e)
        {

            //if (aPropertyDataList[0].PropertyRoomsCollection !=  null )
            //{
                HdnCount.Value = (Convert.ToInt32(aPropertyDataList[0].PropertyRoomsCollection.Count) + 1).ToString();
          //  }
            //else
            //{
            //    int i = 1;
            //    HdnCount.Value = i.ToString();
            //}
        //    DynamicBedLayoutDetails();
            j = Convert.ToInt32(HdnCount.Value);
            DynamicItemDetailsFromPage();
        }
        
        
 
        //DynamicUtilities Details
        protected void BtnUtilitiesAdd_Click(object sender, EventArgs e)
        {
            hdnUtilitiesCount.Value = (Convert.ToInt32(hdnUtilitiesCount.Value) + 1).ToString();
        }


        //DynamicUtilities Details
        protected void BtnAddTax_Click(object sender, EventArgs e)
        {
            HdnTaxCount.Value = (Convert.ToInt32(HdnTaxCount.Value) + 1).ToString();
            DynamicItemTax();
        }

        //Dynamic row Generation for Utilities
        public void DynamicItemTax()
        {
            for (int i = 0; i < Convert.ToInt32(HdnTaxCount.Value); i++)
            {
                TableTax.Attributes.Add("Border", "1");

                HtmlTableRow InRow = new HtmlTableRow();
                InRow.ID = "TableTaxRow" + i.ToString();

                HtmlTableCell Tax = new HtmlTableCell();
                Tax.Align = "left";
                Tax.Attributes.Add("width", "30%");
                RadComboBox taxName = new RadComboBox();
                taxName.ID = "taxName" + i.ToString();
                taxName.Width = 180;
                taxName.Font.Size = 10;
                taxName.CssClass = "dropdownlist";
                string[] taxArray = { "Credit Account", "Jet Living", "Owner" };
                taxName.DataSource = taxArray;
                taxName.DataBind();
                Tax.Controls.Add(taxName);
                InRow.Cells.Add(Tax);


                HtmlTableCell TaxGroup = new HtmlTableCell();
                TaxGroup.Align = "left";
                TaxGroup.Attributes.Add("width", "30%");
                RadComboBox TaxGroupName = new RadComboBox();
                TaxGroupName.ID = "TaxGroupName" + i.ToString();
                TaxGroupName.Width = 180;
                TaxGroupName.Font.Size = 10;
                TaxGroupName.CssClass = "dropdownlist";
                string[] taxGroupArray = { "Mammoth Lakes", "Mammoth Lakes", "Mammoth Lakes" };
                TaxGroupName.DataSource = taxGroupArray;
                TaxGroupName.DataBind();
                TaxGroup.Controls.Add(TaxGroupName);
                InRow.Cells.Add(TaxGroup);


                HtmlTableCell name = new HtmlTableCell();
                name.Align = "left";
                name.Attributes.Add("width", "30%");
                RadComboBox names = new RadComboBox();
                names.ID = "names" + i.ToString();
                names.Width = 180;
                names.Font.Size = 10;
                names.CssClass = "dropdownlist";
                string[] namesArray = { "Rent", "Cleaning", "DailyCleaning" };
                names.DataSource = namesArray;
                names.DataBind();
                name.Controls.Add(names);
                InRow.Cells.Add(name);

                TableTax.Rows.Add(InRow);


            }
        }

        //Load Dynamic Bed Layouts Details
        public void DynamicBedLayoutDetails()
        {
            PropertyRoomsData apropertyRoomsData = new PropertyRoomsData();
            List<PropertyRoomsData> aPropertyRoomsDataList = new List<PropertyRoomsData>();
            BedLayoutData aBedLayoutData = new BedLayoutData();
            IList<BedLayoutData> aBedLayoutDataList = new List<BedLayoutData>();

            PropertyUtilitiesData anPropertyUtilitiesData = new PropertyUtilitiesData();
            IList<PropertyUtilitiesData> anPropertyUtilitiesDataList = new List<PropertyUtilitiesData>();
            int i = 1;

            if (aPropertyDataList[0].PropertyRoomsCollection != null)
            {
                countBedrows = aPropertyDataList[0].PropertyRoomsCollection.Count;

                for (int count = 0; count < aPropertyDataList[0].PropertyRoomsCollection.Count; count++)
                {
                   
                    BedLayout.Attributes.Add("Border", "1");

                    HtmlTableRow InRow = new HtmlTableRow();
                    InRow.ID = "PropertiesRoomsId" + i.ToString();
                    HtmlTableCell PcCell1 = new HtmlTableCell();
                    PcCell1.Align = "left";
                    PcCell1.Attributes.Add("width", "25%");
                    RadTextBox txtRoomName = new RadTextBox();
                    txtRoomName.ID = "txtRoomName" + i.ToString();
                    txtRoomName.Width = 160;
                    txtRoomName.Text = (aPropertyDataList[0].PropertyRoomsCollection[count].RoomName);
                    if (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtRoomName" + i.ToString()] != null)
                        txtRoomName.Text = Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtRoomName" + i.ToString()].ToString();
                    PcCell1.Controls.Add(txtRoomName);
                    InRow.Cells.Add(PcCell1);


                      //if (aPropertyDataList[0].BedLayoutCollection != null)
                      //{

                      //   for (int bedCount = 0; count < aPropertyDataList[0].BedLayoutCollection.Count; bedCount++)
                      //      {
                            // King
                            HtmlTableCell PcCell2 = new HtmlTableCell();
                            PcCell2.Align = "left";
                            PcCell2.Attributes.Add("width", "10%");
                            RadNumericTextBox txtKing = new RadNumericTextBox();
                            txtKing.ID = "txtKing" + i.ToString();
                            txtKing.Width = 60;
                            txtKing.Font.Size = 10;
                            txtKing.ShowSpinButtons = true;
                            txtKing.NumberFormat.DecimalDigits = 0;
                            txtKing.MinValue = 0;
                            if (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtKing" + i.ToString()] != null)
                                txtKing.Text = Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtKing" + i.ToString()].ToString();
                            PcCell2.Controls.Add(txtKing);
                            InRow.Cells.Add(PcCell2);

                            // Queen
                            HtmlTableCell PcCell3 = new HtmlTableCell();
                            PcCell3.Align = "left";
                            PcCell3.Attributes.Add("width", "10%");
                            RadNumericTextBox txtQueen = new RadNumericTextBox();
                            txtQueen.ID = "txtQueen" + i.ToString();
                            txtQueen.Width = 60;
                            txtQueen.Font.Size = 10;
                            txtQueen.ShowSpinButtons = true;
                            txtQueen.NumberFormat.DecimalDigits = 0;
                            txtQueen.MinValue = 0;
                            if (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtQueen" + i.ToString()] != null)
                                txtQueen.Text = Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtQueen" + i.ToString()].ToString();
                            PcCell3.Controls.Add(txtQueen);
                            InRow.Cells.Add(PcCell3);


                            // Double
                            HtmlTableCell PcCell4 = new HtmlTableCell();
                            PcCell4.Align = "left";
                            PcCell4.Attributes.Add("width", "10%");
                            RadNumericTextBox txtDouble = new RadNumericTextBox();
                            txtDouble.ID = "txtDouble" + i.ToString();
                            txtDouble.Width = 60;
                            txtDouble.Font.Size = 10;
                            txtDouble.ShowSpinButtons = true;
                            txtDouble.NumberFormat.DecimalDigits = 0;
                            txtDouble.MinValue = 0;
                            if (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtDouble" + i.ToString()] != null)
                                txtDouble.Text = Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtDouble" + i.ToString()].ToString();
                            PcCell4.Controls.Add(txtDouble);
                            InRow.Cells.Add(PcCell4);

                            // Single
                            HtmlTableCell PcCell5 = new HtmlTableCell();
                            PcCell5.Align = "left";
                            PcCell5.Attributes.Add("width", "10%");

                            RadNumericTextBox txtSingle = new RadNumericTextBox();
                            txtSingle.ID = "txtSingle" + i.ToString();
                            txtSingle.Width = 60;
                            txtSingle.Font.Size = 10;
                            txtSingle.ShowSpinButtons = true;
                            txtSingle.NumberFormat.DecimalDigits = 0;
                            txtSingle.MinValue = 0;
                            if (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtSingle" + i.ToString()] != null)
                                txtSingle.Text = Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtSingle" + i.ToString()].ToString();

                            PcCell5.Controls.Add(txtSingle);
                            InRow.Cells.Add(PcCell5);


                            // Bunk
                            HtmlTableCell PcCell6 = new HtmlTableCell();
                            PcCell6.Align = "left";
                            PcCell6.Attributes.Add("width", "10%");
                            RadNumericTextBox txtSofaBunk = new RadNumericTextBox();
                            txtSofaBunk.ID = "txtSofaBunk" + i.ToString();
                            txtSofaBunk.Width = 60;
                            txtSofaBunk.Font.Size = 10;
                            txtSofaBunk.ShowSpinButtons = true;
                            txtSofaBunk.NumberFormat.DecimalDigits = 0;
                            txtSofaBunk.MinValue = 0;
                            if (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtSofaBunk" + i.ToString()] != null)
                                txtSofaBunk.Text = Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtSofaBunk" + i.ToString()].ToString();
                            PcCell6.Controls.Add(txtSofaBunk);
                            InRow.Cells.Add(PcCell6);


                            // Sofa Bed
                            HtmlTableCell PcCell7 = new HtmlTableCell();
                            PcCell7.Align = "left";
                            PcCell7.Attributes.Add("width", "10%");
                            RadNumericTextBox txtSofaBed = new RadNumericTextBox();
                            txtSofaBed.ID = "txtSofaBed" + i.ToString();
                            txtSofaBed.Width = 60;
                            txtSofaBed.Font.Size = 10;
                            txtSofaBed.ShowSpinButtons = true;
                            txtSofaBed.NumberFormat.DecimalDigits = 0;
                            txtSofaBed.MinValue = 0;
                            if (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtSofaBed" + i.ToString()] != null)
                                txtSofaBed.Text = Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$txtSofaBed" + i.ToString()].ToString();
                            PcCell7.Controls.Add(txtSofaBed);
                            InRow.Cells.Add(PcCell7);

                   //   }
                   //}

                    //Note
                    HtmlTableCell PcCell8 = new HtmlTableCell();
                    PcCell8.Align = "left";
                    PcCell8.Attributes.Add("width", "100px");
                    TextBox Notes = new TextBox();
                    Notes.AutoPostBack = false;
                    Notes.ID = "Notes" + i.ToString();
                    Notes.CssClass = "bodytextrequired";
                    Notes.Text = (aPropertyDataList[0].PropertyRoomsCollection[count].Notes);  
                    Notes.Width = 120;
                    if (Request["tl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$Notes" + i.ToString()] != null)
                        Notes.Text = Request["tl00$contentMaster$gridPropertySearch$ctl00$ctl13$EditFormControl$Notes" + i.ToString()].ToString();

                    PcCell8.Controls.Add(Notes);
                    InRow.Cells.Add(PcCell8);



                    BedLayout.Rows.Add(InRow);

                    i++;
                }
               
            }
           
        }





        // Add Bed Layouts
        public void DynamicItemDetailsFromPage()
        {
            for (int i = j; i <= Convert.ToInt32(HdnCount.Value); i++)
            {
                BedLayout.Attributes.Add("Border", "1");

                HtmlTableRow InRow = new HtmlTableRow();
                InRow.ID = "IncentiveDetailsId" + i.ToString();
                HtmlTableCell PcCell1 = new HtmlTableCell();
                PcCell1.Align = "left";
                PcCell1.Attributes.Add("width", "25%");
                RadTextBox txtRoomName = new RadTextBox();
                txtRoomName.ID = "txtRoomName" + i.ToString();
                txtRoomName.Width = 160;
                if (Request["ctl00$contentMaster$txtRoomName" + i.ToString()] != null)
                    txtRoomName.Text = Request["ctl00$contentMaster$txtRoomName" + i.ToString()].ToString();
                PcCell1.Controls.Add(txtRoomName);
                InRow.Cells.Add(PcCell1);

                // King
                HtmlTableCell PcCell2 = new HtmlTableCell();
                PcCell2.Align = "left";
                PcCell2.Attributes.Add("width", "10%");
                RadNumericTextBox txtKing = new RadNumericTextBox();
                txtKing.ID = "txtKing" + i.ToString();
                txtKing.Width = 60;
                txtKing.Font.Size = 10;
                txtKing.ShowSpinButtons = true;
                txtKing.NumberFormat.DecimalDigits = 0;
                txtKing.MinValue = 0;
                if (Request["ctl00$contentMaster$txtKing" + i.ToString()] != null)
                    txtKing.Text = Request["ctl00$contentMaster$txtKing" + i.ToString()].ToString();
                PcCell2.Controls.Add(txtKing);
                InRow.Cells.Add(PcCell2);

                // Queen
                HtmlTableCell PcCell3 = new HtmlTableCell();
                PcCell3.Align = "left";
                PcCell3.Attributes.Add("width", "10%");
                RadNumericTextBox txtQueen = new RadNumericTextBox();
                txtQueen.ID = "txtQueen" + i.ToString();
                txtQueen.Width = 60;
                txtQueen.Font.Size = 10;
                txtQueen.ShowSpinButtons = true;
                txtQueen.NumberFormat.DecimalDigits = 0;
                txtQueen.MinValue = 0;
                if (Request["ctl00$contentMaster$txtQueen" + i.ToString()] != null)
                    txtQueen.Text = Request["ctl00$contentMaster$txtQueen" + i.ToString()].ToString();
                PcCell3.Controls.Add(txtQueen);
                InRow.Cells.Add(PcCell3);


                // Double
                HtmlTableCell PcCell4 = new HtmlTableCell();
                PcCell4.Align = "left";
                PcCell4.Attributes.Add("width", "10%");
                RadNumericTextBox txtDouble = new RadNumericTextBox();
                txtDouble.ID = "txtDouble" + i.ToString();
                txtDouble.Width = 60;
                txtDouble.Font.Size = 10;
                txtDouble.ShowSpinButtons = true;
                txtDouble.NumberFormat.DecimalDigits = 0;
                txtDouble.MinValue = 0;
                if (Request["ctl00$contentMaster$txtDouble" + i.ToString()] != null)
                    txtDouble.Text = Request["ctl00$contentMaster$txtDouble" + i.ToString()].ToString();
                PcCell4.Controls.Add(txtDouble);
                InRow.Cells.Add(PcCell4);

                // Single
                HtmlTableCell PcCell5 = new HtmlTableCell();
                PcCell5.Align = "left";
                PcCell5.Attributes.Add("width", "10%");

                RadNumericTextBox txtSingle = new RadNumericTextBox();
                txtSingle.ID = "txtSingle" + i.ToString();
                txtSingle.Width = 60;
                txtSingle.Font.Size = 10;
                txtSingle.ShowSpinButtons = true;
                txtSingle.NumberFormat.DecimalDigits = 0;
                txtSingle.MinValue = 0;
                if (Request["ctl00$contentMaster$txtSingle" + i.ToString()] != null)
                    txtSingle.Text = Request["ctl00$contentMaster$txtSingle" + i.ToString()].ToString();

                PcCell5.Controls.Add(txtSingle);
                InRow.Cells.Add(PcCell5);


                // Bunk
                HtmlTableCell PcCell6 = new HtmlTableCell();
                PcCell6.Align = "left";
                PcCell6.Attributes.Add("width", "10%");
                RadNumericTextBox txtSofaBunk = new RadNumericTextBox();
                txtSofaBunk.ID = "txtSofaBunk" + i.ToString();
                txtSofaBunk.Width = 60;
                txtSofaBunk.Font.Size = 10;
                txtSofaBunk.ShowSpinButtons = true;
                txtSofaBunk.NumberFormat.DecimalDigits = 0;
                txtSofaBunk.MinValue = 0;
                if (Request["ctl00$contentMaster$txtSofaBunk" + i.ToString()] != null)
                    txtSofaBunk.Text = Request["ctl00$contentMaster$txtSofaBunk" + i.ToString()].ToString();
                PcCell6.Controls.Add(txtSofaBunk);
                InRow.Cells.Add(PcCell6);


                // Sofa Bed
                HtmlTableCell PcCell7 = new HtmlTableCell();
                PcCell7.Align = "left";
                PcCell7.Attributes.Add("width", "10%");
                RadNumericTextBox txtSofaBed = new RadNumericTextBox();
                txtSofaBed.ID = "txtSofaBed" + i.ToString();
                txtSofaBed.Width = 60;
                txtSofaBed.Font.Size = 10;
                txtSofaBed.ShowSpinButtons = true;
                txtSofaBed.NumberFormat.DecimalDigits = 0;
                txtSofaBed.MinValue = 0;
                if (Request["ctl00$contentMaster$txtSofaBed" + i.ToString()] != null)
                    txtSofaBed.Text = Request["ctl00$contentMaster$txtSofaBed" + i.ToString()].ToString();
                PcCell7.Controls.Add(txtSofaBed);
                InRow.Cells.Add(PcCell7);


                //Note
                HtmlTableCell PcCell8 = new HtmlTableCell();
                PcCell8.Align = "left";
                PcCell8.Attributes.Add("width", "100px");
                TextBox Notes = new TextBox();
                Notes.AutoPostBack = false;
                Notes.ID = "Notes" + i.ToString();
                Notes.CssClass = "bodytextrequired";
                Notes.Width = 120;
                if (Request["ctl00$contentMaster$Notes" + i.ToString()] != null)
                    Notes.Text = Request["ctl00$contentMaster$Notes" + i.ToString()].ToString();

                PcCell8.Controls.Add(Notes);
                InRow.Cells.Add(PcCell8);

                BedLayout.Rows.Add(InRow);

            }
        }

 
        #region "Aminities Regional"

     
        public void LoadUtilitiesDetailsFromPage()
        {


            UserData sessionUser = (UserData)JSSessionHandler.GetSessionValue("UserData");
            PropertyUtilitiesData propertyUtilitiesData = new PropertyUtilitiesData();
            List<PropertyUtilitiesData> listPropertyUtilitiesData = new List<PropertyUtilitiesData>();

            for (int i = 1; i <= Convert.ToInt32(hdnUtilitiesCount.Value); i++)
            {

                if ((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$txtutilitiesAccount" + i.ToString()] != null) && ((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$txtutilitiesTelephone" + i]).ToString() != null))
                {
                    propertyUtilitiesData = new PropertyUtilitiesData();

                    propertyUtilitiesData.UtilityCategoryID = (Convert.ToInt64(Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$hdnUtilitiesDetailsId" + i.ToString()]));
                    propertyUtilitiesData.AccountNumber = (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$txtutilitiesAccount" + i.ToString()]);
                    propertyUtilitiesData.TelephoneNumber = ((Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$txtutilitiesTelephone" + i]).ToString());

                    propertyUtilitiesData.CreatedOn = new DateTime();
                    propertyUtilitiesData.CreatedBy = Convert.ToInt32(sessionUser.Id);
                    propertyUtilitiesData.UpdatedOn = new DateTime();
                    propertyUtilitiesData.UpdatedBy = Convert.ToInt32(sessionUser.Id);

                    listPropertyUtilitiesData.Add(propertyUtilitiesData);
                }

            }
            propertyData.PropertyUtilitiesCollection = listPropertyUtilitiesData;
        }
    

        #endregion



        #region "Retrieve the Data for DataBase()

        /// <summary>
        /// Retrieve Master Informations Details From DB
        /// </summary>       
        public void LoadMasterInformationFromDB()
        {
            foreach (PropertyData propertyData in aPropertyDataList)
            {

                txtMasterInfoPropertyName.Text = propertyData.Name;                
                chkAddPropertyExclusive.Checked=propertyData.Exclusive;                  
                cmbMasterInfoDestination.SelectedValue = propertyData.Destination.ToString();

                if((propertyData.Destination.ToString() !=null ) && (propertyData.Destination.ToString() !=string.Empty))
                {
                    if (cmbMasterInfoArea.SelectedIndex != 0)
                    {
                        IList<AreaData> subAreaData = new List<AreaData>();
                        subAreaData = areaManager.GetSubArea(propertyData.Destination);
                        cmbMasterInfoArea.DataSource = subAreaData;
                        cmbMasterInfoArea.DataTextField = "Name";
                        cmbMasterInfoArea.DataValueField = "ID";
                        cmbMasterInfoArea.DataBind();

                        RadComboBoxItem cmbSubArea = new RadComboBoxItem();
                        cmbSubArea.Text = " ";
                        cmbMasterInfoArea.Items.Insert(0, cmbSubArea);
                    }
                }

              
                cmbMasterInfoArea.SelectedValue = Convert.ToString(propertyData.SubArea);

                if ((propertyData.SubArea.ToString() != null) && (propertyData.SubArea.ToString() != string.Empty))
                {
                    if (cmbMasterInfoLocation.SelectedIndex != 0)  
                    {
                        IList<AreaData> locationData = new List<AreaData>();
                        locationData = areaManager.GetChildArea(propertyData.SubArea);
                        cmbMasterInfoLocation.DataSource = locationData;
                        cmbMasterInfoLocation.DataTextField = "Name";
                        cmbMasterInfoLocation.DataValueField = "ID";
                        cmbMasterInfoLocation.DataBind();

                        RadComboBoxItem cmbLocation = new RadComboBoxItem();
                        cmbLocation.Text = " ";
                        cmbMasterInfoLocation.Items.Insert(0, cmbLocation);
                    }
                }
                cmbGeneralInfoLocation.SelectedValue = Convert.ToString(propertyData.Location);
                cmbMasterInfoOwnerAgreement.SelectedValue = propertyData.OwnerAgreementTemplateID.ToString();
                cmbMasterInfoRenterAgreement.SelectedValue = propertyData.RenterAgreementTemplateID.ToString();
                txtMasterIfnoSale.Text = propertyData.SaleValue.ToString();
                txtMasterIfnoTelephone1.Text=propertyData.PhoneNumber1;
                txtMasterIfnoTelephone2.Text=propertyData.PhoneNumber2;
                txtMasterIfnoCommission.Text=Convert.ToString(propertyData.CommissionPercentage);
                chkMasterInfoActive.Checked=propertyData.Active;
                txtChargesDeposit.Text=propertyData.Deposit.ToString();
                txtChargesDailyCleaningFee.Text=propertyData.DailyCleaningFee.ToString();
                txtChargesExitCleaningFee.Text=propertyData.ExitCleaningFee.ToString();
                txtChargesManagementFee.Text=propertyData.ManagementFee.ToString();
                cmbChargesPercentageorDollar.SelectedValue=propertyData.ManagementFeeType.ToString();
                cmbChargesManagementPer.SelectedValue = propertyData.ManagementFeePeriod.ToString();

             
                if (propertyData.AddressData != null)
                {
                    txtPropertyAddressOne.Text = propertyData.AddressData.AddressLineFirst;
                    txtPropertyAddressTwo.Text = propertyData.AddressData.AddressLineSecond;
                    txtPropertyAddressCity.Text = propertyData.AddressData.City;                     
                    cmbPropertyAddressState.SelectedValue = Convert.ToString(propertyData.AddressData.StateId);
                    cmbPropertyAddressCountry.SelectedValue = Convert.ToString(propertyData.AddressData.CountryId);
                    txtPropertyAddressZip.Text = propertyData.AddressData.ZipCode;
                }
              

            }


        }

        /// <summary>
        /// Load the Property Detail Tab informations From DB
        /// </summary>
        public void LoadPropertyDetailsFromDB()
        {
            if (aPropertyDataList[0].PropertyDetailCollection != null)
            {   

                for (int count = 0; count < aPropertyDataList[0].PropertyDetailCollection.Count; count++)
                {
                    
                     txtDetailsDescription.Text = Convert.ToString(aPropertyDataList[0].PropertyDetailCollection[count].SiteDescription);
                     txtDetailsKeyCode.Text = (aPropertyDataList[0].PropertyDetailCollection[count].KeyCode);
                     txtDetailsKeyCodeDescription.Text = (aPropertyDataList[0].PropertyDetailCollection[count].KeyCodeText);
                     txtDetailsKeyLockCode.Text = (aPropertyDataList[0].PropertyDetailCollection[count].LockBoxCode);
                     txtDetailsKeyLockCodeDescription.Text = (aPropertyDataList[0].PropertyDetailCollection[count].LockBoxCodeText);                                                                           
                     txtDetailsDrivingDirections.Text  = (aPropertyDataList[0].PropertyDetailCollection[count].DrivingDirections);
                     txtDetailsInternalNotes.Text = (aPropertyDataList[0].PropertyDetailCollection[count].InternalNotes);
                     txtDetailsSleeps.Text = (aPropertyDataList[0].PropertyDetailCollection[count].NoOfSleeps).ToString();
                     txtDetailsNofDays.Text = (aPropertyDataList[0].PropertyDetailCollection[count].MinNoOfDays).ToString();
                     txtDetailsSquareFootage.Text = (aPropertyDataList[0].PropertyDetailCollection[count].SquareFootage).ToString();                                                                                                                                                                                                    
                     txtDetailsBedRooms.Text = (aPropertyDataList[0].PropertyDetailCollection[count].NoOfBedrooms).ToString();                                                                                                                                                                                                   
                     txtDetailsLofts.Text  = (aPropertyDataList[0].PropertyDetailCollection[count].NoOfLofts).ToString();
                     txtDetailsBathrooms.Text = (aPropertyDataList[0].PropertyDetailCollection[count].NoOfBaths).ToString();
                     txtDetailsStoriesHigh.Text = (aPropertyDataList[0].PropertyDetailCollection[count].NoOfStories).ToString();
                     txtDetailsCommunityName.Text = (aPropertyDataList[0].PropertyDetailCollection[count].Community).ToString();
                     txtDetailsLatitude.Text = (aPropertyDataList[0].PropertyDetailCollection[count].Latitude).ToString();
                     txtDetailsLongitude.Text = (aPropertyDataList[0].PropertyDetailCollection[count].Longitude).ToString();
                     cmbDetailsHighGarage.SelectedValue = Convert.ToString(aPropertyDataList[0].PropertyDetailCollection[count].Garage);
                     cmbDetailsUnitType.SelectedValue = Convert.ToString(aPropertyDataList[0].PropertyDetailCollection[count].UnitCategoryID);
                     cmbDetailsFeature.SelectedValue = (aPropertyDataList[0].PropertyDetailCollection[count].PropertyFeatureCategoryID).ToString();
                     cmbDetailsStyle.SelectedValue = (aPropertyDataList[0].PropertyDetailCollection[count].StyleCategoryID).ToString();
                }
            }
                     
          }

        //Load the Contact Details FromDataBase
        public void LoadContactDetailsFromDB()
        {
            if (aPropertyDataList[0].ContactCollection  != null)
            {

                for (int count = 0; count < aPropertyDataList[0].ContactCollection.Count; count++)
                {
                    long ContactType;
                    ContactType = (aPropertyDataList[0].ContactCollection[count].ContactTypeID);

                    if (ContactType == 11)
                    {
                        cmbContactManager.SelectedValue = Convert.ToString(aPropertyDataList[0].ContactCollection[count].ContactID);
                    }
                    else if (ContactType == 2)
                    {                         
                        cmbContactOwner.SelectedValue = Convert.ToString(aPropertyDataList[0].ContactCollection[count].ContactID);
                    }
                    else if (ContactType == 3)
                    {                
                        cmbContactRefferalAgent.SelectedValue = Convert.ToString(aPropertyDataList[0].ContactCollection[count].ContactID);
                    }
                    else
                    {
                        cmbContactsCleaningCompany.SelectedValue  = Convert.ToString(aPropertyDataList[0].ContactCollection[count].ContactID);
                    }
                    
                 }

             }
         }
        

        /// <summary>
        /// Load Utilities Details From DB
        /// </summary>
        public void LoadPropertyUtilitiesDetailFromDB()
        {
            IList<long> UtilitiesData = new List<long>();

            PropertyUtilitiesData anPropertyUtilitiesData = new PropertyUtilitiesData();
            IList<PropertyUtilitiesData> anPropertyUtilitiesDataList = new List<PropertyUtilitiesData>();

             List<SystemCategoryData> systemCategoryData = new List<SystemCategoryData>();
            systemCategoryData = categoryManager.GetAllUtilities();

             int i=1;
            foreach (SystemCategoryData data in systemCategoryData)
            {

                 Label lblutilities = new Label();
                lblutilities.Text = data.Name;
                lblutilities.ID = "lblutilities" + i.ToString();
                lblutilities.Width = 200;
                HiddenField hdnutilities = new HiddenField();
                HdnUtilities.ID = "hdnutilities" + i.ToString();


                HiddenField hdnUtilitiesDetailsId = new HiddenField();
                hdnUtilitiesDetailsId.Value = data.Id.ToString();
                hdnUtilitiesDetailsId.ID = "hdnUtilitiesDetailsId" + i.ToString();
                if (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$hdnUtilitiesDetailsId" + i.ToString()] != null)
                    hdnUtilitiesDetailsId.Value = Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$hdnUtilitiesDetailsId" + i.ToString()].ToString();


                RadTextBox txtutilitiesAccount = new RadTextBox();
                txtutilitiesAccount.ID = "txtutilitiesAccount" + i.ToString();
                txtutilitiesAccount.Width = 150;
                if (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$txtutilitiesAccount" + i.ToString()] != null)
                    txtutilitiesAccount.Text = Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$txtutilitiesAccount" + i.ToString()].ToString();

                RadTextBox txtutilitiesTelephone = new RadTextBox();
                txtutilitiesTelephone.ID = "txtutilitiesTelephone" + i.ToString();
                txtutilitiesTelephone.Width = 150;
                if (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$txtutilitiesTelephone" + i.ToString()] != null)
                    txtutilitiesTelephone.Text = Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$txtutilitiesTelephone" + i.ToString()].ToString();

                pnlUtilities.Controls.Add(lblutilities);
                pnlUtilities.Controls.Add(hdnutilities);

                pnlUtilities.Controls.Add(hdnUtilitiesDetailsId);
                pnlUtilities.Controls.Add(txtutilitiesAccount);
                pnlUtilities.Controls.Add(txtutilitiesTelephone);
                pnlUtilities.Controls.Add(new LiteralControl("<br>"));              
                hdnUtilitiesCount.Value = i.ToString();
                



             if (aPropertyDataList[0].PropertyUtilitiesCollection != null)
              {
                for (int count = 0; count < aPropertyDataList[0].PropertyUtilitiesCollection.Count; count++)
                {

                    anPropertyUtilitiesData.UtilityCategoryID = Convert.ToInt64(aPropertyDataList[0].PropertyUtilitiesCollection[count].UtilityCategoryID);
                    anPropertyUtilitiesData.AccountNumber = (aPropertyDataList[0].PropertyUtilitiesCollection[count].AccountNumber).ToString();
                    anPropertyUtilitiesData.TelephoneNumber = (aPropertyDataList[0].PropertyUtilitiesCollection[count].AccountNumber).ToString();
                    anPropertyUtilitiesDataList.Add(anPropertyUtilitiesData);

                    long UtilitiesID = Convert.ToInt64(aPropertyDataList[0].PropertyUtilitiesCollection[count].UtilityCategoryID);

                    if (UtilitiesID == (Convert.ToInt64(hdnUtilitiesDetailsId.Value)))                  
                    {
                        txtutilitiesAccount.Text=(aPropertyDataList[0].PropertyUtilitiesCollection[count].AccountNumber).ToString();
                        txtutilitiesTelephone.Text= (aPropertyDataList[0].PropertyUtilitiesCollection[count].TelephoneNumber).ToString();                        
                        
                    }

                }
            }

             i++;
        }
        }
        

        /// <summary>
        /// Load AmentitiesDetails From DataBase
        /// </summary>
        public void LoadPropertyAmenitiesDetailFromDB()
        {

            // Load the Busniess Details
            List<SystemCategoryData> systemCategoryData = new List<SystemCategoryData>();
            systemCategoryData = categoryManager.GetAllBusiness();

            pnlBusniess.Controls.Add(new LiteralControl("<br>"));
            int i = 1;
            foreach (SystemCategoryData data in systemCategoryData)
            {
                CheckBox chkBusniess = new CheckBox();
                chkBusniess.Text = data.Name;
                chkBusniess.ID = "chkBusniess" + i.ToString();
                chkBusniess.Width = 215;
                chkBusniess.Height = 50;

                HiddenField hdnBusniessId = new HiddenField();
                hdnBusniessId.Value = data.Id.ToString();
                hdnBusniessId.ID = "hdnBusniessId" + i.ToString();

                
                HiddenField hdnBusniessAmenityCategoryID = new HiddenField();
                hdnBusniessAmenityCategoryID.Value = data.CategoryTypeId.ToString();
                hdnBusniessAmenityCategoryID.ID = "hdnBusniessAmenityCategoryID" + i.ToString();


                pnlBusniess.Controls.Add(chkBusniess);
                pnlBusniess.Controls.Add(hdnBusniessId);
                HdnAmentiesCount.Value = i.ToString();

                if (aPropertyDataList[0].AmenityDataCollection != null)
                {
                    for (int count = 0; count < aPropertyDataList[0].AmenityDataCollection.Count; count++)
                    {
                        long amenityCategoryID = Convert.ToInt64(aPropertyDataList[0].AmenityDataCollection[count].AmenityCategoryID);
                      
                        
                        if (amenityCategoryID == (Convert.ToInt64((hdnBusniessId.Value))))                          
                        {
                            chkBusniess.Checked = true;

                        }
                    }

                }
                i++;
            }


            //Load the Entertainment Details
            List<SystemCategoryData> systemCategoryEntertainmentData = new List<SystemCategoryData>();
            systemCategoryEntertainmentData = categoryManager.GetAllEntertainment();

            pnlEntertainment.Controls.Add(new LiteralControl("<br>"));
            int e = 1;
            foreach (SystemCategoryData entertainmentData in systemCategoryEntertainmentData)
            {
                CheckBox chkEntertainment = new CheckBox();
                chkEntertainment.Text = entertainmentData.Name;
                chkEntertainment.ID = "chkEntertainment" + e.ToString();
                chkEntertainment.Width = 200;
                chkEntertainment.Height = 50;



                HiddenField hdnEntertainmentId = new HiddenField();
                hdnEntertainmentId.Value = entertainmentData.Id.ToString();
                hdnEntertainmentId.ID = "hdnEntertainmentId" + e.ToString();

                pnlEntertainment.Controls.Add(chkEntertainment);
                pnlEntertainment.Controls.Add(hdnEntertainmentId);
                HdnEntertainmentCount.Value = e.ToString();
                

                if (aPropertyDataList[0].AmenityDataCollection != null)
                {
                    for (int count = 0; count < aPropertyDataList[0].AmenityDataCollection.Count; count++)
                    {
                        long amenityCategoryID = Convert.ToInt64(aPropertyDataList[0].AmenityDataCollection[count].AmenityCategoryID);


                        if (amenityCategoryID == (Convert.ToInt64((hdnEntertainmentId.Value))))
                        {
                            chkEntertainment.Checked = true;

                        }
                    }

                }

                e++;
            }


            //Load the Kitchen Details
            List<SystemCategoryData> systemCategoryKitchenData = new List<SystemCategoryData>();
            systemCategoryKitchenData = categoryManager.GetAllKitchen();

            pnlKitchen.Controls.Add(new LiteralControl("<br>"));
            int k = 1;
            foreach (SystemCategoryData kitchenData in systemCategoryKitchenData)
            {
                CheckBox chkKitchen = new CheckBox();
                chkKitchen.Text = kitchenData.Name;
                chkKitchen.ID = "chkKitchen" + k.ToString();
                chkKitchen.Width = 200;
                chkKitchen.Height = 50;

                HiddenField hdnKitchenId = new HiddenField();
                hdnKitchenId.Value = kitchenData.Id.ToString();
                hdnKitchenId.ID = "hdnKitchenId" + k.ToString();

                pnlKitchen.Controls.Add(chkKitchen);
                pnlKitchen.Controls.Add(hdnKitchenId);
                HdnkitchenCount.Value = k.ToString();

                if (aPropertyDataList[0].AmenityDataCollection != null)
                {
                    for (int count = 0; count < aPropertyDataList[0].AmenityDataCollection.Count; count++)
                    {
                        long amenityCategoryID = Convert.ToInt64(aPropertyDataList[0].AmenityDataCollection[count].AmenityCategoryID);


                        if (amenityCategoryID == (Convert.ToInt64((hdnKitchenId.Value))))
                        {
                            chkKitchen.Checked = true;

                        }
                    }

                }
                k++;
            }



            //Load the Living Details
            List<SystemCategoryData> systemCategoryLivingData = new List<SystemCategoryData>();
            systemCategoryLivingData = categoryManager.GetAllLiving();

            pnlLiving.Controls.Add(new LiteralControl("<br>"));
            int l = 1;
            foreach (SystemCategoryData livingData in systemCategoryLivingData)
            {
                CheckBox chkLiving = new CheckBox();
                chkLiving.Text = livingData.Name;
                chkLiving.ID = "chkLiving" + l.ToString();
                chkLiving.Width = 200;
                chkLiving.Height = 50;

                HiddenField hdnLivingId = new HiddenField();
                hdnLivingId.Value = livingData.Id.ToString();
                hdnLivingId.ID = "hdnLivingId" + l.ToString();               
                pnlLiving.Controls.Add(chkLiving);
                pnlLiving.Controls.Add(hdnLivingId);
                HdnLivingCount.Value = l.ToString();

                if (aPropertyDataList[0].AmenityDataCollection != null)
                {
                    for (int count = 0; count < aPropertyDataList[0].AmenityDataCollection.Count; count++)
                    {
                        long amenityCategoryID = Convert.ToInt64(aPropertyDataList[0].AmenityDataCollection[count].AmenityCategoryID);


                        if (amenityCategoryID == (Convert.ToInt64((hdnLivingId.Value))))
                        {
                            chkLiving.Checked = true;

                        }
                    }

                }

                l++;              

            }

        }
              #endregion

        public void LoadUtilitiesDetailsFromDB()
        {
            // Load the Busniess Details
            List<SystemCategoryData> systemCategoryData = new List<SystemCategoryData>();
            systemCategoryData = categoryManager.GetAllUtilities();

            pnlUtilities.Controls.Add(new LiteralControl("<br>"));
            int i = 1;
            foreach (SystemCategoryData data in systemCategoryData)
            {
                Label lblutilities = new Label();
                lblutilities.Text = data.Name;
                lblutilities.ID = "lblutilities" + i.ToString();
                lblutilities.Width = 200;
                HiddenField hdnutilities = new HiddenField();
                HdnUtilities.ID = "hdnutilities" + i.ToString();


                HiddenField hdnUtilitiesDetailsId = new HiddenField();
                hdnUtilitiesDetailsId.Value = data.Id.ToString();
                hdnUtilitiesDetailsId.ID = "hdnUtilitiesDetailsId" + i.ToString();
                if (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$hdnUtilitiesDetailsId" + i.ToString()] != null)
                    hdnUtilitiesDetailsId.Value = Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$hdnUtilitiesDetailsId" + i.ToString()].ToString();



                //   RadTextBox txtutilitiesAccount = new RadTextBox();
                RadTextBox txtutilitiesAccount = new RadTextBox();
                txtutilitiesAccount.ID = "txtutilitiesAccount" + i.ToString();
                txtutilitiesAccount.Width = 150;
                if (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$txtutilitiesAccount" + i.ToString()] != null)
                    txtutilitiesAccount.Text = Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$txtutilitiesAccount" + i.ToString()].ToString();

                RadTextBox txtutilitiesTelephone = new RadTextBox();
                txtutilitiesTelephone.ID = "txtutilitiesTelephone" + i.ToString();
                txtutilitiesTelephone.Width = 150;
                if (Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$txtutilitiesTelephone" + i.ToString()] != null)
                    txtutilitiesTelephone.Text = Request["ctl00$contentMaster$gridPropertySearch$ctl00$ctl17$EditFormControl$txtutilitiesTelephone" + i.ToString()].ToString();

                pnlUtilities.Controls.Add(lblutilities);
                pnlUtilities.Controls.Add(hdnutilities);

                pnlUtilities.Controls.Add(hdnUtilitiesDetailsId);
                pnlUtilities.Controls.Add(txtutilitiesAccount);
                pnlUtilities.Controls.Add(txtutilitiesTelephone);
                pnlUtilities.Controls.Add(new LiteralControl("<br>"));             
                hdnUtilitiesCount.Value = i.ToString();
                i++; ;

            }


        }

    }


}








Bruno
Top achievements
Rank 2
 answered on 02 Apr 2009
1 answer
144 views
Hi

I am tearing my hair out over this... help needed (to solve the problem, that is, not to tear
any more hair out!)

I have a RadMenu where one of the buttons has an item template as the only sub menu item.
This contains a RadAjaxPanel containing 2 text boxes and an image button.

I am having trouble getting the button click to trigger the relevant sub,
although if I pull the panel out of the menu onto a blank area of the page
it works.

One thing I noticed is that in Visual Web Developer  design view, the 'lightening bolt' does
not appear for the button when the panel is inside the menu template, so I can't double click it to
create the onclick event handler, so I had to type it by hand.

I did manage to 'find' the button and change its parameters, and 'found' the panel
the same way. eg
Dim buttonItem2 As RadMenuItem = RadMenu2.FindItemByText("CellarClub")  
        Dim MemberInfo As ImageButton = DirectCast(buttonItem2.FindControl("MemberInfo"), ImageButton)  
        MemberInfo.Attributes.Add("onmouseover""src='" & ResolveClientUrl("images/buttons/rt-arrow-over-grey.gif") & "'"

Obviously I am missing something.. Please help me out!

Or am I trying to do something that can't be done?

Thanks

Clive

Yana
Telerik team
 answered on 02 Apr 2009
1 answer
134 views

I have a scenario, i have a radtreeview control on left side and raddockzone on right, i want to drag the tree node to zone and add it to particular position and drop it as raddock, how can i acheive this scenario.

please help...

 

Fahad

Obi-Wan Kenobi
Top achievements
Rank 1
 answered on 02 Apr 2009
2 answers
102 views

Nice feature adding in ResourceStyles, I'd like to integrate with my current app.  I'm using a custom data provider so I can support multiple resources (classes and classrooms, classes can be in multiple classrooms) 

I'm currently doing this below:

List<Room> roomList = GetRoomList(); //returns list of rooms (ID, Name, Abbreviation, ScheduleColor);  
foreach (Room room in roomList)  
{  
    schedulerMain.ResourceStyles.Add(new ResourceStyleMapping("Room", room.RoomID.ToString(), room.Name, room.ScheduleColor));  

This works great, except for appointments with multiple resources.  So I figure on AppointmentDataBound, if the appointment has more than one resource, remove it and use a default style.  How do I remove the current resource style that is applied, ie. something like this:

 

protected void schedulerMain_AppointmentDataBound(object sender, SchedulerEventArgs e)  
{  
    List<Resource> resources = (List<Resource>)e.Appointment.Resources.GetResourcesByType("Room");  
    if (resources.Count > 1)  
    {  
        //use different resource style  
    }  

I appreciate any help you can send my way, thanks guys!

Mike
Top achievements
Rank 2
 answered on 02 Apr 2009
3 answers
99 views
I have a RadGrid on an ASPX page that I have filtering set on all of the columns.
When the grid is displayed everything looks fine, the filter menu will display if you select the filter icon for the first column. But none of the filter menu's appear when you click the filter icon for any of the other columns.
However, if I add move a field to the Grouping header the situation is reversed. All of the filter menus work for all of the columns except the first column.
I have a similar page that works fine that I have patterned the new page after, and have been over all of the settings but can't figure out why the filter menu is only selectively popping up under these conditions.
I am using Q2 2007. I know one of the first suggestions is going to be to upgrade but I don't have time to go through that whole process and the filtering is working fine on other pages, so it should work on this page.

Thanks in advance for any help.
Sebastian
Telerik team
 answered on 02 Apr 2009
1 answer
109 views

Hey,

I wonder why RadEditor wp don't have public properties for ConfigFile and ToolsFile (and deliver those values to MOSSRadEditor control).. Would be quite nice feature if you can define those files per webpart. Or am I missing something?

Stanimir
Telerik team
 answered on 02 Apr 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?