Пример #1
0
        private void SetBlocks(int AreaID)
        {
            if (PropertyData.BlocksAvailable(int.Parse(ddArea.SelectedValue)) > 1)
            {
                ddBlock.DataSource     = DataLink.PropertyData.GetBlocks(AreaID);
                ddBlock.DataTextField  = "bname";
                ddBlock.DataValueField = "bid";
                ddBlock.DataBind();

                ListItem select = new ListItem("Please Select a Block", "");
                select.Attributes["disabled"] = "true";
                select.Attributes["selected"] = "true";
                select.Attributes["hidden"]   = "true";
                ddBlock.Items.Insert(0, select);

                ddBlock.Enabled = true;
            }

            else if (PropertyData.BlocksAvailable(int.Parse(ddArea.SelectedValue)) == 1)
            {
                ddBlock.Items.Clear();
                //ListItem select = new ListItem("Not Available", "");
                //select.Attributes["disabled"] = "true";
                //select.Attributes["selected"] = "true";
                //select.Attributes["hidden"] = "true";
                //ddBlock.Items.Add(select);

                ddBlock.DataSource     = DataLink.PropertyData.GetBlocks(AreaID);
                ddBlock.DataTextField  = "bname";
                ddBlock.DataValueField = "bid";
                ddBlock.DataBind();
                ddBlock.SelectedIndex = 0;
                ddBlock.Enabled       = false;
            }
        }