Beispiel #1
0
        public void ThisIsADGTest()
        {
            DataGridTest      p     = new DataGridTest();
            DataTable         table = new DataTable();
            EditCommandColumn e;
            string            markup;

            e            = new EditCommandColumn();
            e.ButtonType = ButtonColumnType.LinkButton;
            e.CancelText = "Cancel";
            e.EditText   = "Edit";
            e.UpdateText = "Update";

            table.Columns.Add(new DataColumn("one", typeof(string)));
            table.Columns.Add(new DataColumn("two", typeof(string)));
            table.Columns.Add(new DataColumn("three", typeof(string)));
            table.Rows.Add(new object [] { "1", "2", "3" });

            p.DataSource = new DataView(table);
            p.Columns.Add(e);

            e            = new EditCommandColumn();
            e.ButtonType = ButtonColumnType.PushButton;
            e.CancelText = "Abbrechen";
            e.EditText   = "Bearbeiten";
            e.UpdateText = "Refresh";
            p.Columns.Add(e);

            p.CreateControls(true);
            // This is the test we want to run: setting the ID of the table created by
            // the datagrid overrides the using the ID of the datagrid itself and uses
            // the table ClientID instead.
            p.ID = "sucker";
            p.Controls [0].ID = "tbl";

            Assert.AreEqual(2, p.Columns.Count, "I1");
            markup = ControlMarkup(p.Controls[0]);
            markup = markup.Replace("\t", "");
            markup = markup.Replace("\r", "");
            markup = markup.Replace("\n", "");

#if NET_2_0
            HtmlDiff.AssertAreEqual(
                "<table border=\"0\"><tr><td>&nbsp;</td><td>&nbsp;</td><td>one</td><td>two</td><td>three</td>" +
                "</tr><tr><td><a>Edit</a></td><td><input name=\"sucker_tbl$ctl02$ctl00\" type=\"submit\" value=\"Bearbeiten\" /></td><td>1</td><td>2</td><td>3</td>" +
                "</tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>" +
                "</tr></table>", markup, "I2");
#else
            Assert.AreEqual(
                "<table border=\"0\" id=\"sucker_tbl\"><tr><td>&nbsp;</td><td>&nbsp;</td><td>one</td><td>two</td><td>three</td>" +
                "</tr><tr><td><a>Edit</a></td><td><input name=\"sucker:_ctl1:_ctl0\" type=\"submit\" value=\"Bearbeiten\" /></td><td>1</td><td>2</td><td>3</td>" +
                "</tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>" +
                "</tr></table>", markup, "I2");
#endif
        }
Beispiel #2
0
        public void InitializeCell()
        {
            DataGridTest      p     = new DataGridTest();
            DataTable         table = new DataTable();
            EditCommandColumn e;
            string            markup;

            e            = new EditCommandColumn();
            e.ButtonType = ButtonColumnType.LinkButton;
            e.CancelText = "Cancel";
            e.EditText   = "Edit";
            e.UpdateText = "Update";

            table.Columns.Add(new DataColumn("one", typeof(string)));
            table.Columns.Add(new DataColumn("two", typeof(string)));
            table.Columns.Add(new DataColumn("three", typeof(string)));
            table.Rows.Add(new object [] { "1", "2", "3" });

            p.DataSource = new DataView(table);
            p.Columns.Add(e);

            e            = new EditCommandColumn();
            e.ButtonType = ButtonColumnType.PushButton;
            e.CancelText = "Abbrechen";
            e.EditText   = "Bearbeiten";
            e.UpdateText = "Refresh";
            p.Columns.Add(e);

            // This will trigger EditCommandColumn.InitializeCell, without any EditItem set, tests the EditText render
            p.CreateControls(true);
            p.ID = "sucker";

            Assert.AreEqual(2, p.Columns.Count, "I1");
            markup = ControlMarkup(p.Controls[0]);
            markup = markup.Replace("\t", "");
            markup = markup.Replace("\r", "");
            markup = markup.Replace("\n", "");

#if NET_2_0
            HtmlDiff.AssertAreEqual(
                "<table border=\"0\"><tr><td>&nbsp;</td><td>&nbsp;</td><td>one</td><td>two</td><td>three</td>" +
                "</tr><tr><td><a>Edit</a></td><td><input name=\"sucker$ctl02$ctl00\" type=\"submit\" value=\"Bearbeiten\" /></td><td>1</td><td>2</td><td>3</td>" +
                "</tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>" +
                "</tr></table>", markup, "I2");
#else
            Assert.AreEqual(
                "<table border=\"0\" id=\"sucker\"><tr><td>&nbsp;</td><td>&nbsp;</td><td>one</td><td>two</td><td>three</td>" +
                "</tr><tr><td><a>Edit</a></td><td><input name=\"sucker:_ctl1:_ctl0\" type=\"submit\" value=\"Bearbeiten\" /></td><td>1</td><td>2</td><td>3</td>" +
                "</tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>" +
                "</tr></table>", markup, "I2");
#endif
            //ShowControlsRecursive (p.Controls [0], 1);
        }
        public void InitializeReadOnlyEditCell()
        {
            DataGridTest      p     = new DataGridTest();
            DataTable         table = new DataTable();
            EditCommandColumn e;
            string            markup;

            e            = new EditCommandColumn();
            e.ButtonType = ButtonColumnType.LinkButton;
            e.CancelText = "Cancel";
            e.EditText   = "Edit";
            e.UpdateText = "Update";

            table.Columns.Add(new DataColumn("one", typeof(string)));
            table.Columns.Add(new DataColumn("two", typeof(string)));
            table.Columns.Add(new DataColumn("three", typeof(string)));
            table.Rows.Add(new object[] { "1", "2", "3" });

            p.DataSource = new DataView(table);
            p.Columns.Add(e);

            e            = new EditCommandColumn();
            e.ButtonType = ButtonColumnType.PushButton;

            e.CancelText = "Abbrechen";
            e.EditText   = "Bearbeiten";
            e.UpdateText = "Refresh";
            p.Columns.Add(e);

            // Force the ListItemType to be EditItem so we can test rendering the UpdateText/CancelText render
            p.EditItemIndex = 0;

            // This will trigger EditCommandColumn.InitializeCell
            p.CreateControls(true);
            p.ID = "sucker";

            markup = ControlMarkup(p.Controls[0]);
            markup = markup.Replace("\t", "");
            markup = markup.Replace("\r", "");
            markup = markup.Replace("\n", "");

            Assert.AreEqual(2, p.Columns.Count, "I1");
            Assert.AreEqual(
                "<table border=\"0\" id=\"sucker\"><tr><td>&nbsp;</td><td>&nbsp;</td><td>one</td><td>two</td><td>three</td>" +
                "</tr><tr><td><a>Update</a>&nbsp;<a>Cancel</a></td><td><input name type=\"submit\" value=\"Refresh\" />&nbsp;" +
                "<input name value=\"Abbrechen\" type=\"submit\" /></td>" +
                "<td><input name=\"_ctl2:_ctl0\" type=\"text\" value=\"1\" /></td>" +
                "<td><input name=\"_ctl2:_ctl1\" type=\"text\" value=\"2\" /></td>" +
                "<td><input name=\"_ctl2:_ctl2\" type=\"text\" value=\"3\" /></td>" +
                "</tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>" +
                "</tr></table>", markup, "I2");
        }
Beispiel #4
0
        static void RunOldTests(Assert assert)
        {
            InputTextTest.RunAll();

            TabItemTest.RunAll();
            DataGridTest.RunAll();

            ItemsControlTests.RunAll();

            DatePickerTest.RunAll();

            assert.Equal(1, 1);
        }
Beispiel #5
0
        private void ShowData(string strSql)
        {
            string         strConn = ConfigurationSettings.AppSettings["strConn"];
            SqlConnection  SqlConn = new SqlConnection(strConn);
            SqlDataAdapter SqlCmd  = new SqlDataAdapter(strSql, SqlConn);
            DataSet        SqlDS   = new DataSet();

            SqlCmd.Fill(SqlDS, "RubricInfo");
            RowNum = DataGridTest.CurrentPageIndex * DataGridTest.PageSize + 1;
            LinNum = 0;

            string SortExpression = DataGridTest.Attributes["SortExpression"];
            string SortDirection  = DataGridTest.Attributes["SortDirection"];

            SqlDS.Tables["RubricInfo"].DefaultView.Sort = SortExpression + " " + SortDirection;

            DataGridTest.DataSource = SqlDS.Tables["RubricInfo"].DefaultView;
            DataGridTest.DataBind();
            for (int i = 0; i < DataGridTest.Items.Count; i++)
            {
                Label labTestContent = (Label)DataGridTest.Items[i].FindControl("labTestContent");
                DataGridTest.Items[i].Cells[6].ToolTip = labTestContent.Text;
                labTestContent.Text = Server.HtmlEncode(labTestContent.Text);
                if (labTestContent.Text.Trim().Length > 20)
                {
                    labTestContent.Text = labTestContent.Text.Trim().Substring(0, 20) + "...";
                }
                //labTestContent.Text=ObjFun.getStr(labTestContent.Text.Trim(),20)+"...";

                LinkButton LBEditTest = (LinkButton)DataGridTest.Items[i].FindControl("LinkButEditTest");
                LinkButton LBDel      = (LinkButton)DataGridTest.Items[i].FindControl("LinkButDel");

                if ((myLoginID.Trim().ToUpper() == "ADMIN") || (myLoginID.Trim().ToUpper() == DataGridTest.Items[i].Cells[7].Text.Trim().ToUpper()))
                {
                    LBEditTest.Attributes.Add("onclick", "javascript:jscomNewOpenBySize('EditTest.aspx?RubricID=" + DataGridTest.Items[i].Cells[0].Text + "','EditTest',688,496); return false;");
                    LBDel.Attributes.Add("onclick", "javascript:{if(confirm('确定要删除选择试题吗?')==false) return false;}");
                }
                else
                {
                    LBEditTest.Attributes.Add("onclick", "javascript:alert('对不起,您没有此操作权限!');return false;");
                    LBDel.Attributes.Add("onclick", "javascript:alert('对不起,您没有此操作权限!');return false;");
                }
            }
            LabelRecord.Text      = Convert.ToString(SqlDS.Tables["RubricInfo"].Rows.Count);
            LabelCountPage.Text   = Convert.ToString(DataGridTest.PageCount);
            LabelCurrentPage.Text = Convert.ToString(DataGridTest.CurrentPageIndex + 1);
            SqlConn.Dispose();
        }
Beispiel #6
0
        private void ShowData(string strSql)
        {
            string         strConn = ConfigurationSettings.AppSettings["strConn"];
            SqlConnection  SqlConn = new SqlConnection(strConn);
            SqlDataAdapter SqlCmd  = new SqlDataAdapter(strSql, SqlConn);
            DataSet        SqlDS   = new DataSet();

            SqlCmd.Fill(SqlDS, "RubricInfo");

            string SortExpression = DataGridTest.Attributes["SortExpression"];
            string SortDirection  = DataGridTest.Attributes["SortDirection"];

            SqlDS.Tables["RubricInfo"].DefaultView.Sort = SortExpression + " " + SortDirection;

            DataGridTest.DataSource = SqlDS.Tables["RubricInfo"].DefaultView;
            DataGridTest.DataBind();
            for (int i = 0; i < DataGridTest.Items.Count; i++)
            {
                CheckBox chkCheckBoxSel = (CheckBox)DataGridTest.Items[i].FindControl("CheckBoxSel");
                string   strTmp         = ObjFun.GetValues("select RubricID from PaperTest where RubricID=" + DataGridTest.Items[i].Cells[1].Text + " and PaperID=" + intPaperID + "", "RubricID");
                if (strTmp != "")
                {
                    chkCheckBoxSel.Checked = true;
                }

                Label labTestContent = (Label)DataGridTest.Items[i].FindControl("labTestContent");
                DataGridTest.Items[i].Cells[7].ToolTip = labTestContent.Text;
                labTestContent.Text = Server.HtmlEncode(labTestContent.Text);
                if (labTestContent.Text.Trim().Length > 20)
                {
                    labTestContent.Text = labTestContent.Text.Trim().Substring(0, 20) + "...";
                }
                //labTestContent.Text=ObjFun.getStr(labTestContent.Text.Trim(),20)+"...";
            }
            LabelRecord.Text      = Convert.ToString(SqlDS.Tables["RubricInfo"].Rows.Count);
            LabelCountPage.Text   = Convert.ToString(DataGridTest.PageCount);
            LabelCurrentPage.Text = Convert.ToString(DataGridTest.CurrentPageIndex + 1);
            SqlConn.Dispose();
        }
Beispiel #7
0
        public void Deny_Unrestricted()
        {
            DataGridTest unit = new DataGridTest();

            unit.Defaults();
            unit.TagName();
            unit.CleanProperties();
            unit.ViewState();
            unit.SelectIndexOutOfRange();
            unit.ControlStyle();
            unit.Styles();
            unit.Events();
            unit.BubbleEvent();
            unit.BubblePageCommand();
            unit.SaveViewState();
            unit.CreateColumnSet();
            unit.CreateColumnsBinding();
            unit.CreateSimpleColumns();
            unit.CreateControls();
            unit.CreationEvents();
            unit.InitializePager();
            unit.Render();
        }
        public static void Validation_Load(Page p)
        {
            string       testType = (string)WebTest.CurrentTest.UserData;
            DataGridTest dg       = new DataGridTest();

            dg.ID = "mygrid";
            EditCommandColumn e;

            e            = new EditCommandColumn();
            e.ButtonType = ButtonColumnType.LinkButton;
            e.CancelText = "Cancel";
            e.EditText   = "Edit";
            e.UpdateText = "Update";

            switch (testType)
            {
            case "ValidatingValid":
            case "ValidatingInvalid":
            case "ValidationGroupIncluded":
            case "ValidationGroupNotIncluded":
                e.CausesValidation = true;
                break;

            case "NotValidatingInvalid":
                e.CausesValidation = false;
                break;
            }

            switch (testType)
            {
            case "ValidationGroupIncluded":
            case "ValidationGroupNotIncluded":
                e.ValidationGroup = "Group1";
                break;

            default:
                e.ValidationGroup = "";
                break;
            }

            dg.Columns.Add(e);

            TextBox tb = new TextBox();

            tb.ID = "Text1";
            switch (testType)
            {
            case "ValidatingValid":
                tb.Text = "111";
                break;

            case "ValidatingInvalid":
            case "NotValidatingInvalid":
            case "ValidationGroupIncluded":
            case "ValidationGroupNotIncluded":
                tb.Text = "";
                break;
            }

            RequiredFieldValidator v = new RequiredFieldValidator();

            v.ControlToValidate = "Text1";
            switch (testType)
            {
            case "ValidationGroupIncluded":
                v.ValidationGroup = "Group1";
                break;

            case "ValidationGroupNotIncluded":
                v.ValidationGroup = "NotGroup1";
                break;

            default:
                v.ValidationGroup = "";
                break;
            }
            TemplateColumn tc = new TemplateColumn();

            tc.EditItemTemplate = new ValidatingEditTemplate(tb, v);
            dg.Columns.Add(tc);

            ObjectDataSource ods = new ObjectDataSource("MyObjectDS", "Select");

            ods.UpdateMethod       = "Update";
            ods.DataObjectTypeName = "MyObjectDS";
            ods.ID = "MyDS";

            p.Form.Controls.Add(ods);

            dg.DataSource = ods;
            //dg.DataKeyField = "i";

            //DataTable table = new DataTable ();
            //table.Columns.Add (new DataColumn ("one", typeof (string)));
            //table.Columns.Add (new DataColumn ("two", typeof (string)));
            //table.Columns.Add (new DataColumn ("three", typeof (string)));
            //table.Rows.Add (new object [] { "1", "2", "3" });

            //dg.DataSource = new DataView (table);

            dg.EditItemIndex = 0;
            p.Form.Controls.Add(dg);

            dg.DataBind();
            if (!p.IsPostBack)
            {
                WebTest.CurrentTest.UserData = dg.Items [0].Cells [0].Controls [0].UniqueID;
            }
        }
        public void InitializeEditCell()
        {
#if NET_4_0
            string origHtml = "<table><tr><td>&nbsp;</td><td>&nbsp;</td><td>one</td><td>two</td><td>three</td></tr><tr><td><a>Update</a>&nbsp;<a>Cancel</a></td><td><input name=\"sucker$ctl02$ctl00\" type=\"submit\" value=\"Refresh\" />&nbsp;<input name=\"sucker$ctl02$ctl01\" type=\"submit\" value=\"Abbrechen\" /></td><td><input name=\"sucker$ctl02$ctl02\" type=\"text\" value=\"1\" /></td><td><input name=\"sucker$ctl02$ctl03\" type=\"text\" value=\"2\" /></td><td><input name=\"sucker$ctl02$ctl04\" type=\"text\" value=\"3\" /></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>";
#else
            string origHtml = "<table border=\"0\"><tr><td>&nbsp;</td><td>&nbsp;</td><td>one</td><td>two</td><td>three</td></tr><tr><td><a>Update</a>&nbsp;<a>Cancel</a></td><td><input name=\"sucker$ctl02$ctl00\" type=\"submit\" value=\"Refresh\" />&nbsp;<input name=\"sucker$ctl02$ctl01\" type=\"submit\" value=\"Abbrechen\" /></td><td><input name=\"sucker$ctl02$ctl02\" type=\"text\" value=\"1\" /></td><td><input name=\"sucker$ctl02$ctl03\" type=\"text\" value=\"2\" /></td><td><input name=\"sucker$ctl02$ctl04\" type=\"text\" value=\"3\" /></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>";
#endif
            DataGridTest      p     = new DataGridTest();
            DataTable         table = new DataTable();
            EditCommandColumn e;
            string            markup;

            e            = new EditCommandColumn();
            e.ButtonType = ButtonColumnType.LinkButton;
            e.CancelText = "Cancel";
            e.EditText   = "Edit";
            e.UpdateText = "Update";

            table.Columns.Add(new DataColumn("one", typeof(string)));
            table.Columns.Add(new DataColumn("two", typeof(string)));
            table.Columns.Add(new DataColumn("three", typeof(string)));
            table.Rows.Add(new object [] { "1", "2", "3" });

            p.DataSource = new DataView(table);
            p.Columns.Add(e);

            e            = new EditCommandColumn();
            e.ButtonType = ButtonColumnType.PushButton;
            e.CancelText = "Abbrechen";
            e.EditText   = "Bearbeiten";
            e.UpdateText = "Refresh";
            p.Columns.Add(e);

            // Force the ListItemType to be EditItem so we can test rendering the UpdateText/CancelText render
            p.EditItemIndex = 0;

            // This will trigger EditCommandColumn.InitializeCell
            p.CreateControls(true);
            p.ID = "sucker";

            StringBuilder sb = new StringBuilder();
            GetHierarchy(p.Controls, 0, sb);
            string h = sb.ToString();
            int    x = h.IndexOf(".TextBox");
            // These are from the BoundColumns
            Assert.IsTrue(x != -1, "textbox1");
            x = h.IndexOf(".TextBox", x + 1);
            Assert.IsTrue(x != -1, "textbox2");
            x = h.IndexOf(".TextBox", x + 1);
            Assert.IsTrue(x != -1, "textbox3");
            x = h.IndexOf(".TextBox", x + 1);
            Assert.IsTrue(x == -1, "textbox-end");

            markup = ControlMarkup(p.Controls[0]);
            markup = markup.Replace("\t", "");
            markup = markup.Replace("\r", "");
            markup = markup.Replace("\n", "");

//Console.WriteLine("Markup:>{0}<", markup);
            Assert.AreEqual(2, p.Columns.Count, "I1");

            HtmlDiff.AssertAreEqual(origHtml, markup, "I2");
        }
Beispiel #10
0
        private void ShowData(string strSql)
        {
            string         strConn = ConfigurationSettings.AppSettings["strConn"];
            SqlConnection  SqlConn = new SqlConnection(strConn);
            SqlDataAdapter SqlCmd  = new SqlDataAdapter(strSql, SqlConn);
            DataSet        SqlDS   = new DataSet();

            SqlCmd.Fill(SqlDS, "UserAnswer");
            RowNum = DataGridTest.CurrentPageIndex * DataGridTest.PageSize + 1;

            string SortExpression = DataGridTest.Attributes["SortExpression"];
            string SortDirection  = DataGridTest.Attributes["SortDirection"];

            SqlDS.Tables["UserAnswer"].DefaultView.Sort = SortExpression + " " + SortDirection;

            DataGridTest.DataSource = SqlDS.Tables["UserAnswer"].DefaultView;
            DataGridTest.DataBind();

            SqlDataAdapter SqlCmdTmp = null;
            DataSet        SqlDSTmp  = null;

            for (int i = 0; i < DataGridTest.Items.Count; i++)
            {
                System.Web.UI.WebControls.Image imgRate = (System.Web.UI.WebControls.Image)DataGridTest.Items[i].FindControl("imgRate");
                imgRate.Width   = Convert.ToInt32(200 * Convert.ToDouble(DataGridTest.Items[i].Cells[6].Text.Trim()) / Convert.ToDouble(DataGridTest.Items[i].Cells[5].Text.Trim()));
                imgRate.ToolTip = Convert.ToString(System.Math.Round(Convert.ToDouble(DataGridTest.Items[i].Cells[6].Text.Trim()) / Convert.ToDouble(DataGridTest.Items[i].Cells[5].Text.Trim()) * 100, 1)) + "%";

                if (DataGridTest.Items[i].Cells[3].Text.Trim() == "单选类")
                {
                    intSelA   = 0; intSelB = 0; intSelC = 0; intSelD = 0; intSelE = 0; intSelF = 0;
                    SqlCmdTmp = new SqlDataAdapter("select a.RubricID,a.UserAnswer from UserAnswer a,UserScore b where a.UserScoreID=b.UserScoreID and a.RubricID=" + DataGridTest.Items[i].Cells[0].Text.Trim() + " and b.PaperID=" + intPaperID + " and b.ExamState=1", SqlConn);
                    SqlDSTmp  = new DataSet();
                    SqlCmdTmp.Fill(SqlDSTmp, "TestAnswer");
                    for (j = 0; j < SqlDSTmp.Tables["TestAnswer"].Rows.Count; j++)
                    {
                        if (SqlDSTmp.Tables["TestAnswer"].Rows[j]["UserAnswer"].ToString().ToUpper() == "A")
                        {
                            intSelA = intSelA + 1;
                        }
                        if (SqlDSTmp.Tables["TestAnswer"].Rows[j]["UserAnswer"].ToString().ToUpper() == "B")
                        {
                            intSelB = intSelB + 1;
                        }
                        if (SqlDSTmp.Tables["TestAnswer"].Rows[j]["UserAnswer"].ToString().ToUpper() == "C")
                        {
                            intSelC = intSelC + 1;
                        }
                        if (SqlDSTmp.Tables["TestAnswer"].Rows[j]["UserAnswer"].ToString().ToUpper() == "D")
                        {
                            intSelD = intSelD + 1;
                        }
                        if (SqlDSTmp.Tables["TestAnswer"].Rows[j]["UserAnswer"].ToString().ToUpper() == "E")
                        {
                            intSelE = intSelE + 1;
                        }
                        if (SqlDSTmp.Tables["TestAnswer"].Rows[j]["UserAnswer"].ToString().ToUpper() == "F")
                        {
                            intSelF = intSelF + 1;
                        }
                    }
                    Label labSelA = (Label)DataGridTest.Items[i].FindControl("labSelA");
                    labSelA.Text = Convert.ToString(System.Math.Round((Convert.ToDouble(intSelA) / SqlDSTmp.Tables["TestAnswer"].Rows.Count) * 100, 1)) + "%";

                    Label labSelB = (Label)DataGridTest.Items[i].FindControl("labSelB");
                    labSelB.Text = Convert.ToString(System.Math.Round((Convert.ToDouble(intSelB) / SqlDSTmp.Tables["TestAnswer"].Rows.Count) * 100, 1)) + "%";

                    Label labSelC = (Label)DataGridTest.Items[i].FindControl("labSelC");
                    labSelC.Text = Convert.ToString(System.Math.Round((Convert.ToDouble(intSelC) / SqlDSTmp.Tables["TestAnswer"].Rows.Count) * 100, 1)) + "%";

                    Label labSelD = (Label)DataGridTest.Items[i].FindControl("labSelD");
                    labSelD.Text = Convert.ToString(System.Math.Round((Convert.ToDouble(intSelD) / SqlDSTmp.Tables["TestAnswer"].Rows.Count) * 100, 1)) + "%";

                    Label labSelE = (Label)DataGridTest.Items[i].FindControl("labSelE");
                    labSelE.Text = Convert.ToString(System.Math.Round((Convert.ToDouble(intSelE) / SqlDSTmp.Tables["TestAnswer"].Rows.Count) * 100, 1)) + "%";

                    Label labSelF = (Label)DataGridTest.Items[i].FindControl("labSelF");
                    labSelF.Text = Convert.ToString(System.Math.Round((Convert.ToDouble(intSelF) / SqlDSTmp.Tables["TestAnswer"].Rows.Count) * 100, 1)) + "%";
                }
                if (DataGridTest.Items[i].Cells[3].Text.Trim() == "多选类")
                {
                    intSelA   = 0; intSelB = 0; intSelC = 0; intSelD = 0; intSelE = 0; intSelF = 0;
                    SqlCmdTmp = new SqlDataAdapter("select a.RubricID,a.UserAnswer from UserAnswer a,UserScore b where a.UserScoreID=b.UserScoreID and a.RubricID=" + DataGridTest.Items[i].Cells[0].Text.Trim() + " and b.PaperID=" + intPaperID + " and b.ExamState=1", SqlConn);
                    SqlDSTmp  = new DataSet();
                    SqlCmdTmp.Fill(SqlDSTmp, "TestAnswer");
                    for (j = 0; j < SqlDSTmp.Tables["TestAnswer"].Rows.Count; j++)
                    {
                        if (SqlDSTmp.Tables["TestAnswer"].Rows[j]["UserAnswer"].ToString().ToUpper().IndexOf("A") >= 0)
                        {
                            intSelA = intSelA + 1;
                        }
                        if (SqlDSTmp.Tables["TestAnswer"].Rows[j]["UserAnswer"].ToString().ToUpper().IndexOf("B") >= 0)
                        {
                            intSelB = intSelB + 1;
                        }
                        if (SqlDSTmp.Tables["TestAnswer"].Rows[j]["UserAnswer"].ToString().ToUpper().IndexOf("C") >= 0)
                        {
                            intSelC = intSelC + 1;
                        }
                        if (SqlDSTmp.Tables["TestAnswer"].Rows[j]["UserAnswer"].ToString().ToUpper().IndexOf("D") >= 0)
                        {
                            intSelD = intSelD + 1;
                        }
                        if (SqlDSTmp.Tables["TestAnswer"].Rows[j]["UserAnswer"].ToString().ToUpper().IndexOf("E") >= 0)
                        {
                            intSelE = intSelE + 1;
                        }
                        if (SqlDSTmp.Tables["TestAnswer"].Rows[j]["UserAnswer"].ToString().ToUpper().IndexOf("F") >= 0)
                        {
                            intSelF = intSelF + 1;
                        }
                    }
                    Label labSelA = (Label)DataGridTest.Items[i].FindControl("labSelA");
                    labSelA.Text = Convert.ToString(System.Math.Round((Convert.ToDouble(intSelA) / SqlDSTmp.Tables["TestAnswer"].Rows.Count) * 100, 1)) + "%";

                    Label labSelB = (Label)DataGridTest.Items[i].FindControl("labSelB");
                    labSelB.Text = Convert.ToString(System.Math.Round((Convert.ToDouble(intSelB) / SqlDSTmp.Tables["TestAnswer"].Rows.Count) * 100, 1)) + "%";

                    Label labSelC = (Label)DataGridTest.Items[i].FindControl("labSelC");
                    labSelC.Text = Convert.ToString(System.Math.Round((Convert.ToDouble(intSelC) / SqlDSTmp.Tables["TestAnswer"].Rows.Count) * 100, 1)) + "%";

                    Label labSelD = (Label)DataGridTest.Items[i].FindControl("labSelD");
                    labSelD.Text = Convert.ToString(System.Math.Round((Convert.ToDouble(intSelD) / SqlDSTmp.Tables["TestAnswer"].Rows.Count) * 100, 1)) + "%";

                    Label labSelE = (Label)DataGridTest.Items[i].FindControl("labSelE");
                    labSelE.Text = Convert.ToString(System.Math.Round((Convert.ToDouble(intSelE) / SqlDSTmp.Tables["TestAnswer"].Rows.Count) * 100, 1)) + "%";

                    Label labSelF = (Label)DataGridTest.Items[i].FindControl("labSelF");
                    labSelF.Text = Convert.ToString(System.Math.Round((Convert.ToDouble(intSelF) / SqlDSTmp.Tables["TestAnswer"].Rows.Count) * 100, 1)) + "%";
                }
            }
            SqlConn.Dispose();
        }
        private void btnShowMsg_Click(object sender, RoutedEventArgs e)
        {
            DataGridTest dgt = new DataGridTest(m_WinLocation, m_WinSize, ref m_CanDataParse.test_AllAddrData);

            dgt.ShowDialog();
        }