Joey S.C

Joey S.C

  • NA
  • 67
  • 24.3k

How to get the value of bootstrap dropdown ?

Aug 15 2019 11:34 AM
How Can I get the selected value of the dropdown box ?
 
here is the code. 
 
<li class="dropdown">
<a data-toggle="dropdown" data-hover="dropdown" class="dropdown-toggle" data-close-others="true" href="#">
<i class="clip-list-5"></i>
<span class="badge">12</span>
</a>
<ul class="dropdown-menu todo">
<li>
<span class="dropdown-menu-title">You have 12 pending tasks</span>
</li>
<li>
<div class="drop-down-wrapper">
<ul>
<asp:Literal ID="ltToDo" runat="server"></asp:Literal>
</div>
</li>
<li class="view-all">
<a href="javascript:void(0)">See all tasks <i class="fa fa-arrow-circle-o-right"></i>
</a>
</li>
</ul>
</li>
 
 
BackEnd Code
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Admin_Controls_Users_ToDoList : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
// TO DO HERE
string strTask = "Staff Meeting";
// Danger - RED - URGENT TASK
this.ltToDo.Text = "<li>" +
"<a class=\"todo-actions\" href=\"javascript:void(0)\">" +
"<i class=\"fa fa-square-o\"></i>" +
"<span class=\"desc\" style=\"opacity: 1; text-decoration: none;\">"+ strTask + "</span>"+
"<span class=\"label label-danger\" style=\"opacity: 1;\">today</span>"+
"</a>"+
"</li>";
// WARNING - YELLOW COLOR
strTask = "Hire developers";
this.ltToDo.Text += "<li>"+
"<a class=\"todo-actions\" href=\"javascript:void(0)\">"+
"<i class=\"fa fa-square-o\"></i>" +
"<span class=\"desc\">" + strTask + "</span>" +
"<span class=\"label label-warning\">tommorow</span>"+
"</a>"+
"</li>";
// SUCCESS - GREEN COLOR
strTask = "Hire developers";
this.ltToDo.Text += "<li>" +
"<a class=\"todo-actions\" href=\"javascript:void(0)\">" +
"<i class=\"fa fa-square-o\"></i>" +
"<span class=\"desc\">" + strTask + "</span>" +
"<span class=\"label label-success\">this week</span>" +
"</a>" +
"</li>";
strTask = "New Project";
this.ltToDo.Text += "<li>" +
"<a class=\"todo-actions\" href=\"javascript:void(0)\">" +
"<i class=\"fa fa-square-o\"></i>" +
"<span class=\"desc\">" + strTask + "</span>" +
"<span class=\"label label-info\">this month</span>" +
"</a>" +
"</li>";
}
}
 

Answers (2)