示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["NationalityId"] != null)
     {
         if (!IsPostBack)
         {
             NationalityEntity entity = new NationalityMapper().Get(new NationalityEntity() { Id = Convert.ToInt32(Request.QueryString["NationalityId"]) });
             if (entity != null)
             {
                 TitleTextBox.Text = entity.Title;
                 OtherInfoTextBox.Text = entity.Description;
             }
             else
             {
                 Response.Redirect("List.aspx");
             }
         }
     }
     else
     {
         Response.Redirect("List.aspx");
     }
 }
        public CascadingDropDownNameValue[] GetNationalities(string knownCategoryValues, string category, string contextKey)
        {
            List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();

            List<NationalityEntity> list = new NationalityMapper().List("");
            foreach (NationalityEntity ent in list)
            {
                CascadingDropDownNameValue cdnv;

                if (ent.Title == contextKey)
                {
                    cdnv = new CascadingDropDownNameValue(ent.Title, ent.Id.ToString(), true);
                }
                else
                {
                    cdnv = new CascadingDropDownNameValue(ent.Title, ent.Id.ToString());
                }
                values.Add(cdnv);
            }

            return values.ToArray();
        }