Пример #1
0
        private void setupFunctionTable()
        {
            Table table = new Table();

            tdFunctionTable.Controls.Add(table);
            table.Attributes.Add("Class", "header1_table");
            table.CellPadding = 5;

            //Title
            TableRow trTitle = new TableRow();

            table.Rows.Add(trTitle);
            trTitle.Attributes.Add("Class", "header1_table_first_row");

            //Radio button
            TableCell tcRadioTitle = new TableCell();

            trTitle.Cells.Add(tcRadioTitle);

            //Construction
            TableCell tcConstructionTitle = new TableCell();

            trTitle.Cells.Add(tcConstructionTitle);
            tcConstructionTitle.Text            = "Construction";
            tcConstructionTitle.HorizontalAlign = HorizontalAlign.Center;

            string  strSQL      = mySQL.getStatisticFunctionList();
            DataSet dsFunctions = sqldb.getDataSet(strSQL);

            if (dsFunctions.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < dsFunctions.Tables[0].Rows.Count; i++)
                {
                    TableRow tr = new TableRow();
                    table.Rows.Add(tr);
                    if (i % 2 == 0)
                    {
                        tr.Attributes.Add("Class", "header1_tr_even_row");
                    }
                    else
                    {
                        tr.Attributes.Add("Class", "header1_tr_odd_row");
                    }

                    //Radio button
                    TableCell tcRadio = new TableCell();
                    tr.Cells.Add(tcRadio);

                    RadioButton rb = new RadioButton();
                    tcRadio.Controls.Add(rb);
                    rb.GroupName = "Function";
                    if (i == 0)
                    {
                        rb.Checked = true;
                    }
                    string strID = "";
                    try
                    {
                        strID = dsFunctions.Tables[0].Rows[i]["sFunctionID"].ToString();
                    }
                    catch
                    {
                    }
                    rb.ID = "rb-" + strID;

                    //Construction
                    TableCell tcConstruction = new TableCell();
                    tr.Cells.Add(tcConstruction);
                    tcConstruction.Text = "";
                    try
                    {
                        tcConstruction.Text = dsFunctions.Tables[0].Rows[i]["cConstruction"].ToString();
                    }
                    catch
                    {
                    }
                }
            }
            dsFunctions.Dispose();
        }