示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //make a fandom list
     FandomList fl = new FandomList();
     //make a categoryID guid, passing the value in a query string
     //(value of query string is stored in repeater)
     Guid categoryID = new Guid(Request.QueryString["CategoryID"]);
     //get all fandoms by categoryID
     fl = fl.GetByCategoryID(categoryID);
     //bind the list of appropriate fandoms to repeater
     rptFandoms.DataSource = fl.List;
     rptFandoms.DataBind();
 }
示例#2
0
 protected void ddlFandom_Populate()
 {
     //Check and see if the items in ddlCategory were loaded
     //Get fandoms based on categoryID
     if (ddlCategory.SelectedIndex >= 0)
     {
         //make a new FandomList called fandList
         FandomList fandList = new FandomList();
         //get the right fandList by the categoryID taken from ddlCategory's selected value
         fandList = fandList.GetByCategoryID(new Guid(ddlCategory.SelectedValue));
         //bind the list to ddlFandom
         ddlFandom.DataSource = fandList.List;
         ddlFandom.DataTextField = "FandomName";
         ddlFandom.DataValueField = "ID";
         ddlFandom.DataBind();
     }
     else
     {
         //call Focus on ddlCategory
         ddlCategory.Focus();
     }
 }
示例#3
0
 protected void ddlFandom_Populate()
 {
     //if statement will run if selectedIndex of ddlCategory is greater or equal to zero
     if (ddlCategory.SelectedIndex >=0)
     {
         //make a new FandomList called fandList
         FandomList fandList = new FandomList();
         //Get fandoms based on categoryID
         fandList = fandList.GetByCategoryID(new Guid(ddlCategory.SelectedValue));
         //binds the list to ddlFandom
         ddlFandom.DataSource = fandList.List;
         ddlFandom.DataBind();
     }
 }