Beispiel #1
0
        protected override void CreateChildControls()
        {
            string header = ((LiteralControl)Controls[0]).Text;

            Controls.Clear();
            HtmlTable table = new HtmlTable();
            HtmlTableRowCollection  rows = table.Rows;
            HtmlTableRow            tr;
            HtmlTableCellCollection cells;
            HtmlTableCell           td;
            HtmlInputText           txtBox;
            HtmlInputButton         btn;

            rows.Add(tr  = new HtmlTableRow());
            cells        = tr.Cells;
            cells.Add(td = new HtmlTableCell());
            td.Align     = "center";
            td.ColSpan   = 2;
            td.InnerHtml = header;

            rows.Add(tr  = new HtmlTableRow());
            cells        = tr.Cells;
            cells.Add(td = new HtmlTableCell());
            td.Style.Add("Font-weight", "bold");
            td.InnerText           = userNameTxt;
            cells.Add(td           = new HtmlTableCell());
            td.Controls.Add(txtBox = new HtmlInputText());
            txtBox.ID = "txtName";

            rows.Add(tr  = new HtmlTableRow());
            cells        = tr.Cells;
            cells.Add(td = new HtmlTableCell());
            td.Style.Add("Font-weight", "bold");
            td.InnerText           = PasswordText;
            cells.Add(td           = new HtmlTableCell());
            td.Controls.Add(txtBox = new HtmlInputText("password"));
            txtBox.ID = "txtPwd";

            rows.Add(tr   = new HtmlTableRow());
            cells         = tr.Cells;
            cells.Add(td  = new HtmlTableCell());
            td.InnerHtml += "<button onclick=\"" + Page.GetPostBackEventReference(this, "AdminLogin") + "\">Admin Login</button>";
            cells.Add(td  = new HtmlTableCell());
            //td.Align="center";
            //td.ColSpan=2;
            td.Controls.Add(btn = new HtmlInputButton("submit"));
            btn.ID           = "btnLogin";
            btn.Value        = loginTxt;
            btn.ServerClick += new EventHandler(btn_ServerClick);
            this.Controls.Add(table);
        }
Beispiel #2
0
        protected void submit_ServerClick(object sender, EventArgs e)
        {
// -----------------------------------------------------------------------------

            HtmlTableRow fila0 = new HtmlTableRow();

            fila0.Controls.Add(new HtmlTableCell
            {
                InnerHtml = "Datos ingresados"
            }
                               );

// -----------------------------------------------------------------------------

            HtmlTableRow fila1 = new HtmlTableRow();

            fila1.Controls.Add(new HtmlTableCell
            {
                InnerHtml = "Caja de texto: " + text.Value
            }
                               );

// -----------------------------------------------------------------------------

            HtmlTableRow fila2 = new HtmlTableRow();

            fila2.Controls.Add(new HtmlTableCell
            {
                InnerHtml = "Combo: " + combo.Value
            }
                               );

// -----------------------------------------------------------------------------

            HtmlTableRow  fila3       = new HtmlTableRow();
            HtmlTableCell celdaImagen = new HtmlTableCell();

            celdaImagen.InnerText = "Imagen: ";
            celdaImagen.Controls.Add(saveFile());

            fila3.Controls.Add(celdaImagen);

// -----------------------------------------------------------------------------

            HtmlTableRow fila4 = new HtmlTableRow();

            fila4.Controls.Add(new HtmlTableCell
            {
                InnerHtml = "CheckBox: " + getCheckBox()
            }
                               );

// -----------------------------------------------------------------------------

            HtmlTableRow fila5 = new HtmlTableRow();

            fila5.Controls.Add(new HtmlTableCell
            {
                InnerHtml = "Hipervínculo: " + web.HRef
            }
                               );

// -----------------------------------------------------------------------------

            HtmlTableRow fila6 = new HtmlTableRow();

            fila6.Controls.Add(new HtmlTableCell
            {
                InnerHtml = "Radio Button: " + getRadioButton()
            }
                               );

// -----------------------------------------------------------------------------

            HtmlTableRow fila7 = new HtmlTableRow();

            fila7.Controls.Add(new HtmlTableCell
            {
                InnerHtml = "Campo Oculto: " + hidden.Value
            }
                               );

// -----------------------------------------------------------------------------

            HtmlTableRowCollection filas = tabla2.Rows;

            filas.Add(fila0);
            filas.Add(fila1);
            filas.Add(fila2);
            filas.Add(fila3);
            filas.Add(fila4);
            filas.Add(fila5);
            filas.Add(fila6);
            filas.Add(fila7);
            tabla2.Visible = true;
        }