Bootstrap dropdown not working

I had the same problem. After a couple of hours of trouble shooting found that, I had <script type=”text/javascript” src=”Scripts/bootstrap.min.js”></script> <script type=”text/javascript” src=”Scripts/jquery-2.1.1.min.js”></script> instead of, <script type=”text/javascript” src=”Scripts/jquery-2.1.1.min.js”></script> <script type=”text/javascript” src=”Scripts/bootstrap.min.js”></script>

Custom PopupMenu (layout)

A PopupMenu is meant for displaying Menus and there really isn’t a good way of customizing the appearance of the menu items. If you want something more flexible, your answer is ListPopupWindow. private static final String TITLE = “title”; private static final String ICON = “icon”; private List<HashMap<String, Object>> data = new ArrayList<HashMap<String, Object>>(); // … Read more

ASP.NET DropDownList not retaining selected item on postback

The page lifecycle does the following (plus other steps irrelevant to your question): OnInit Populate controls from ViewState (during postback) Set the selected values (during postback) Page_Load You need to have ViewState enabled so it can populate the list before it “selects” the item. In this case, make sure you don’t repopulate in Page_Load and … Read more

Gridview row editing – dynamic binding to a DropDownList

Quite easy… You’re doing it wrong, because by that event the control is not there: protected void gv_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow && (e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit) { // Here you will get the Control you need like: DropDownList dl = (DropDownList)e.Row.FindControl(“ddlPBXTypeNS”); } } That is, it will only be … Read more

DropDownList AppendDataBoundItems (first item to be blank and no duplicates)

Instead of using AppendDataboundItems=”true” (which will cause the problem you are talking about), respond to the DataBound event for the DropDownList and then add your “blank” item to the top of the list. <asp:DropDownList runat=”server” ID=”MyList” ondatabound=”MyListDataBound”></asp:DropDownList> Then in your code behind: protected void MyListDataBound(object sender, EventArgs e) { MyList.Items.Insert(0, new ListItem(“- Select -“, “”)); … Read more

How can change width of dropdown list?

Try this code: <select name=”wgtmsr” id=”wgtmsr”> <option value=”kg”>Kg</option> <option value=”gm”>Gm</option> <option value=”pound”>Pound</option> <option value=”MetricTon”>Metric ton</option> <option value=”litre”>Litre</option> <option value=”ounce”>Ounce</option> </select> CSS: #wgtmsr{ width:150px; } If you want to change the width of the option you can do this in your css: #wgtmsr option{ width:150px; } Maybe you have a conflict in your css rules that … Read more

PHP – Listing all directories and sub-directories recursively in drop down menu [duplicate]

RecursiveDirectoryIterator should do the trick. Unfortunately, the documentation is not great, so here is an example: $root=”/etc”; $iter = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($root, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD // Ignore “Permission denied” ); $paths = array($root); foreach ($iter as $path => $dir) { if ($dir->isDir()) { $paths[] = $path; } } print_r($paths); This generates the following output … Read more