コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Repositary        r            = new Repositary();
            List <Product>    L            = r.GetData();
            List <BrandItems> listofbrands = r.GetBrand();
            int itemId = Convert.ToInt32(Request.QueryString["id"].ToString());

            foreach (Product P in L)
            {
                if (P.Id == itemId)
                {
                    Image1.ImageUrl = "~//" + P.URL;
                    Label1.Text     = P.Name;
                    Label2.Text     = P.Price.ToString();
                    Label3.Text     = P.Description;
                    foreach (BrandItems B in listofbrands)
                    {
                        if (P.Bid == B.BrandId)
                        {
                            Label4.Text = B.BrandName;
                        }
                    }
                }
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Repositary obj = new Repositary();

            id = Convert.ToInt32(Request.QueryString["id"].ToString());
            //Repositary obj=new Repositary();
            if (!IsPostBack)
            {
                List <Product> L = obj.GetData();
                foreach (Product P in L)
                {
                    if (P.Id == id)
                    {
                        Image2.ImageUrl = "~//" + P.URL;
                        Name.Text       = P.Name;

                        List <BrandItems> B = obj.GetBrand();
                        foreach (BrandItems BI in B)
                        {
                            Brands.Items.Add(new ListItem(BI.BrandName, BI.BrandId.ToString()));
                        }
                        price.Text = P.Price.ToString();
                        dec.Text   = P.Description;
                    }
                }
            }
        }
コード例 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     L      = r.GetData();
     itemId = Convert.ToInt32(Request.QueryString["id"].ToString());
     foreach (Product P in L)
     {
         if (P.Id == itemId)
         {
             Image1.ImageUrl = "~//" + P.URL;
             Label1.Text     = P.Name;
             Label2.Text     = P.Price.ToString();
             Label3.Text     = P.Description;
         }
     }
 }
コード例 #4
0
ファイル: ProductList.aspx.cs プロジェクト: Bharath-Naidu/ASP
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Context.User.IsInRole("Order"))
            {
                Response.Redirect("/Account/Lockout");
            }

            Table T = new System.Web.UI.WebControls.Table();

            L = r.GetData();
            foreach (Product p in L)
            {
                TableRow  TR = new TableRow();
                TableCell TC = new TableCell();
                T.BorderWidth  = 2;
                TR.BorderWidth = 2;
                TC.BorderWidth = 2;
                Image im = new Image();
                im.ImageUrl = "~//" + p.URL.ToString();
                im.Width    = 250;
                im.Height   = 250;
                Label l = new Label();
                l.Text = "Product Name:";
                HyperLink HL = new HyperLink();
                HL.Text = p.Name.ToString();
                Label l1 = new Label();
                l1.Text = "Price Of Product:";
                HyperLink HL2 = new HyperLink();
                HL2.Text       = p.Price.ToString();
                HL.ID          = "Hyperlink_file";
                HL.NavigateUrl = "ProductItem.aspx?id=" + p.Id;
                TC.Width       = 600;
                TC.Height      = 300;
                TC.Controls.Add(im);
                TC.Controls.Add(l);
                TC.Controls.Add(HL);
                //TC.Controls.Add( );
                TC.Controls.Add(new LiteralControl("<br/>"));
                TC.Controls.Add(l1);
                TC.Controls.Add(HL2);
                TR.Cells.Add(TC);
                T.Rows.Add(TR);
            }
            PlaceHolder1.Controls.Add(T);
        }
コード例 #5
0
      protected void Page_Load(object sender, EventArgs e)
      {
          if (Context.User.IsInRole("Order"))
          {
              Response.Redirect("/Account/Lockout");
          }

          Table T = new Table();

          L = r.GetData();
          foreach (Product p in L)
          {
              T.BorderWidth = 2;
              TableRow TR = new TableRow();
              TR.BorderWidth = 2;
              TableCell TC = new TableCell();
              TC.BorderWidth = 2;

              Image im = new Image();
              im.ImageUrl = "~//" + p.URL.ToString();
              im.Width    = 113;
              im.Height   = 87;

              Label HL = new Label();
              HL.Text = p.Name.ToString();
              HL.ID   = "Hyperlink_file";
              TC.Controls.Add(im);
              TC.Controls.Add(HL);
              TR.Cells.Add(TC);



              TableCell TC2 = new TableCell();
              TC2.BorderWidth = 2;
              TC2.Width       = 100;
              TC2.Height      = 100;
              HyperLink TC2HL = new HyperLink();
              TC2HL.Text        = "PreView";
              TC2HL.NavigateUrl = "ProductItem.aspx?id=" + p.Id;
              TC2.Controls.Add(TC2HL);
              TR.Controls.Add(TC2);

              TableCell TC3 = new TableCell();
              TC3.BorderWidth = 2;
              TC3.Width       = 100;
              TC3.Height      = 100;

              Button TC3HL = new Button();
              TC3HL.Text = "Update";
              //TC3HL.OnClientClick = "UpdateTherecord";
              TC3HL.PostBackUrl = "~/UpdateProducts.aspx?id=" + p.Id;
              TC3.Controls.Add(TC3HL);
              TR.Controls.Add(TC3);

              TableCell TC4 = new TableCell();
              TC4.BorderWidth = 2;
              TC4.Width       = 100;
              TC4.Height      = 100;
              Button TC4HL = new Button();
              TC4HL.Text        = "Delete";
              TC4HL.PostBackUrl = "~/DeleteProductItem.aspx?id=" + p.Id;
              TC4.Controls.Add(TC4HL);
              TR.Controls.Add(TC4);


              T.Rows.Add(TR);
          }
          PlaceHolderManage.Controls.Add(T);
      }