Ejemplo n.º 1
0
        private void ControlCreation()
        {
            ArrayList movieList = Mothercode.ShowMovies("%");

            foreach (TblMovies movie in movieList)
            {
                Panel moviePanel = new Panel();
                Image movieimage = new Image {
                    ImageUrl = movie.MovieImage, CssClass = "ProductsImage"
                };
                Literal literalno1 = new Literal {
                    Text = "<br />"
                };
                Literal literalno2 = new Literal {
                    Text = "<br />"
                };
                Label movienamelabel = new Label {
                    Text = movie.MovieName, CssClass = "ProductsName"
                };
                Label moviepricelabel = new Label
                {
                    Text     = String.Format("{0:0.00}", "$" + movie.TotalPrice + "<br />"),
                    CssClass = "ProductsPrice"
                };
                TextBox textBox = new TextBox
                {
                    ID       = "txtbox" + Guid.NewGuid().ToString("N"),
                    CssClass = "ProductsTextBox",
                    Width    = 60,
                    Text     = "0"
                };


                RegularExpressionValidator regex = new RegularExpressionValidator
                {
                    ValidationExpression = "^[0-9]*",
                    ControlToValidate    = textBox.ID,
                    ErrorMessage         = "Please enter a number."
                };


                moviePanel.Controls.Add(movieimage);
                moviePanel.Controls.Add(literalno1);
                moviePanel.Controls.Add(movienamelabel);
                moviePanel.Controls.Add(literalno2);
                moviePanel.Controls.Add(moviepricelabel);
                moviePanel.Controls.Add(textBox);
                moviePanel.Controls.Add(regex);

                pnlProducts.Controls.Add(moviePanel);
            }
        }
Ejemplo n.º 2
0
        private void Fill()
        {
            ArrayList movieList;

            if (!IsPostBack)
            {
                movieList = Mothercode.ShowMovies("%");
            }
            else
            {
                movieList = Mothercode.ShowMovies(DropDownList1.SelectedValue);
            }

            StringBuilder ml = new StringBuilder();

            foreach (TblMovies movies in movieList)
            {
                ml.Append(
                    string.Format(
                        @"<table class='defaultmovietable'>
                
               <tr>
                  <th rowspan='3'><img runat='server' width='120px' height='180px' src={3} alt='MovieText' /></th>
                  <th>Movie Title: </th><td>{0}</td>
                  
               </tr>   
                <tr>
                  <th>Ticket Price: </th>
                  <td>{2} $</td>
                </tr>
                <tr>
                  <th>Amount left: </th>
                  <td>{1}</td>
                </tr>
              </table>",
                        movies.MovieName, movies.AmountMovie, movies.TotalPrice, movies.MovieImage));
                movielabel.Text = ml.ToString();
            }
        }