コード例 #1
0
 private void dlstProducts_ItemCommand(object source, DataListCommandEventArgs e)
 {
     if (e.CommandName == "check")
     {
         int item = int.Parse(dlstProducts.DataKeys[e.Item.ItemIndex].ToString(), NumberStyles.None);
         if (!(ProductHelper.GetSubjectProductIds(subjectType).Contains(item) || !ProductHelper.AddSubjectProduct(subjectType, item)))
         {
             Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
         }
     }
 }