Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ProductDropDown.DataSource = new[] { "Milk", "Chocolate", "Cookies" };
                ProductDropDown.DataBind();
            }

            MyButton.Text = "<script>alert('Button alert!!');</script>";
            MyLabel.Text  = "<script>alert('Label alert!!');</script>";
        }
Ejemplo n.º 2
0
 public ActionResult dropdown(int collectionID, string query)
 {
     try
     {
         ProductDropdownModel   productDropdownModel = new ProductDropdownModel();
         List <ProductDropDown> productDropdowns     = new List <ProductDropDown>();
         List <Product>         products             = new List <Product>();
         if (string.IsNullOrEmpty(query))
         {
             products = productService.GetAll();
         }
         else
         {
             string where = string.Format("ProductName like N'%{0}%'", query);
             products     = productService.GetByWhere(where);
         }
         if (products != null && products.Count > 0)
         {
             foreach (var item in products)
             {
                 ProductDropDown temp = new ProductDropDown();
                 temp.ProductID   = item.ProductID;
                 temp.ProductName = item.ProductName;
                 if (collectionProductService.CheckExistCollectionProduct(collectionID, item.ProductID))
                 {
                     temp.Choice = true;
                 }
                 else
                 {
                     temp.Choice = false;
                 }
                 productDropdowns.Add(temp);
             }
             productDropdownModel.ListProductDropDown = productDropdowns;
             productDropdownModel.CollectionID        = collectionID;
         }
         //productDropdownModel.ConditionFindProduct = query;
         return(View(productDropdownModel));
     }
     catch (Exception ex)
     {
         LogService.WriteException(ex);
         return(null);
     }
 }