Added in-style dropdown control

This commit is contained in:
Rick Falkvinge
2014-11-15 13:52:44 +01:00
parent 258f5a017a
commit 8eab72f7f9
2 changed files with 56 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DropDown.ascx.cs" Inherits="Swarmops.Frontend.Controls.v5.Base.DropDown" %>
<script language="javascript" type="text/javascript">
<script type="text/javascript">
$(document).ready(function () {
$('#<%=this.DropControl.ClientID %>').combobox({
animate: true,
height: 30
});
$('#<%=this.DropControl.ClientID %> span.combo input.combo-text').click(function () {
$('#<%=this.DropControl.ClientID %> span.combo span span.combo-arrow').click();
});
$('#<%=this.DropControl.ClientID %>_SpanBudgets span.combo input.combo-text').keydown(function (e) {
switch (e.which) {
case 40: // down
$('#<%=this.DropControl.ClientID %>_SpanBudgets span.combo span span.combo-arrow').click();
break;
default: return; // exit this handler for other keys
}
e.preventDefault(); // prevent the default action (scroll / move caret)
});
});
</script>
<asp:DropDownList ID="DropControl" runat="server" />
+27
View File
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Swarmops.Frontend.Controls.v5.Base
{
public partial class DropDown : ControlV5Base
{
protected void Page_Load(object sender, EventArgs e)
{
}
public ListItemCollection Items
{
get { return this.DropControl.Items; }
}
public string SelectedValue
{
get { return this.SelectedValue; }
}
}
}