当前位置: 首页>>代码示例>>C#>>正文


C# SQLHandler.ListSurveys方法代码示例

本文整理汇总了C#中SQLHandler.ListSurveys方法的典型用法代码示例。如果您正苦于以下问题:C# SQLHandler.ListSurveys方法的具体用法?C# SQLHandler.ListSurveys怎么用?C# SQLHandler.ListSurveys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLHandler的用法示例。


在下文中一共展示了SQLHandler.ListSurveys方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (HttpContext.Current.Session["user"] != null)
        {
            SQLHandler sql = new SQLHandler();
            List<survey> surveyList = sql.ListSurveys(Convert.ToInt32(HttpContext.Current.Session["id"].ToString()));

            SurveyDiv.InnerHtml = "";
            int count = surveyList.Count;
            int counter = 0;

            foreach (survey s in surveyList)
            {
                counter++;
                HtmlGenericControl div = new HtmlGenericControl("DIV");
                div.Attributes["class"] = "form-group";
                div.Attributes["style"] = "padding-top:10px;";

                Label lblDate = new Label();
                lblDate.Text = s.creationDate + " | ";

                Button btnDel = new Button();
                btnDel.Click += new EventHandler(btnDelete);
                btnDel.ID = "del" + s.id;
                btnDel.Attributes["class"] = "btn btn-default";
                btnDel.Text = "Delete";

                Button btnRes = new Button();
                btnRes.Click += new EventHandler(btnResults);
                btnRes.ID = "res" + s.id;
                btnRes.Attributes["class"] = "btn btn-default";
                btnRes.Text = "Results";

                Label lblName = new Label();
                lblName.Text = s.name;

                HtmlGenericControl buttonDiv = new HtmlGenericControl("DIV");
                buttonDiv.Attributes["style"] = "float:right;margin-top:-10px;";

                div.Controls.Add(lblDate);
                div.Controls.Add(lblName);

                buttonDiv.Controls.Add(btnDel);
                buttonDiv.Controls.Add(btnRes);

                div.Controls.Add(buttonDiv);

                SurveyDiv.Controls.Add(div);

                if(counter != count)
                SurveyDiv.Controls.Add(new HtmlGenericControl("hr"));
            }
        }
        else
        {
            Response.Redirect("LoginPage.aspx");
        }
    }
开发者ID:Nuk3R4z0r,项目名称:SurveyPortal,代码行数:58,代码来源:MySurveys.aspx.cs

示例2: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        SQLHandler sql = new SQLHandler();
        List<survey> surveyList = sql.ListSurveys(Convert.ToInt32(HttpContext.Current.Session["id"].ToString()));

        SurveyDiv.InnerHtml = "";

        foreach(survey s in surveyList)
        {
            SurveyDiv.InnerHtml += "<div Class=\"form-group\">" + s.creationDate
                + " | <asp:Button runat=\"server\" OnClick=\"btnDelete\" class=\"btn btn-default\" ID=\"del" + s.id + "\" Text=\"Delete\"/>"
                + "<asp:Button runat=\"server\" OnClick=\"btnRadio_Click\" class=\"btn btn-default\" ID=\"res" + s.id + "\" Text=\"Results\"/>"
                + " | " + s.name + "</div>";
        }
    }
开发者ID:Gallopsalot,项目名称:SurveyPortal,代码行数:15,代码来源:MySurveys.aspx.cs


注:本文中的SQLHandler.ListSurveys方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。