本文整理汇总了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");
}
}
示例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>";
}
}