Added AjaxDropDown
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" Inherits="Swarmops.Frontend.Controls.Base.AjaxDropDown" CodeFile="AjaxDropDown.ascx.cs" CodeBehind="AjaxDropDown.ascx.cs" %>
|
||||
<%@ Import Namespace="System.Threading" %>
|
||||
<%@ Import Namespace="Swarmops.Common.Enums" %>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#<%=this.ClientID %>_DropControl').combobox({
|
||||
editable: false,
|
||||
height: 32,
|
||||
width: 324,
|
||||
panelAlign: '<%= Thread.CurrentThread.CurrentCulture.TextInfo.IsRightToLeft? "right": "left" %>',
|
||||
panelWidth: 300<%
|
||||
if (!String.IsNullOrEmpty(this.OnClientChange))
|
||||
{
|
||||
Response.Write(",\r\nonChange: function(newVal, oldVal) { " + this.OnClientChange + "(oldVal, newVal); }");
|
||||
}
|
||||
|
||||
%>
|
||||
});
|
||||
|
||||
$('#<%=this.ClientID %>_DropControl + span.combo > input.combo-text').click(function () {
|
||||
$('#<%=this.ClientID %>_DropControl + span.combo > span > span.combo-arrow').click();
|
||||
});
|
||||
|
||||
$('#<%=this.ClientID %>_DropControl + span.combo > input.combo-text').keydown(function (e) {
|
||||
switch (e.which) {
|
||||
case 40: // down
|
||||
var panel = $('#<%=this.ClientID %>_DropControl').combo('panel');
|
||||
if (!panel.is(':visible')) {
|
||||
$('#<%=this.ClientID %>_DropControl + span.combo > span > span.combo-arrow').click();
|
||||
panel.focus();
|
||||
}
|
||||
break;
|
||||
|
||||
default: return; // exit this handler for other keys
|
||||
}
|
||||
e.preventDefault(); // prevent the default action (scroll / move caret)
|
||||
});
|
||||
});
|
||||
|
||||
function <%=this.ClientID %>_val(newValue) {
|
||||
if (newValue === undefined) {
|
||||
// getter
|
||||
return $('#<%=this.ClientID %>_DropControl').combobox('getValue');
|
||||
} else {
|
||||
// setter
|
||||
$('#<%=this.ClientID %>_DropControl').combobox('setValue', newValue);
|
||||
}
|
||||
}
|
||||
|
||||
function <%=this.ClientID %>_text(newText) {
|
||||
if (newText === undefined) {
|
||||
// getter
|
||||
return $('#<%=this.ClientID %>_DropControl').combobox('getText');
|
||||
} else {
|
||||
// setter
|
||||
$('#<%=this.ClientID %>_DropControl').combobox('setText', newText);
|
||||
}
|
||||
}
|
||||
|
||||
function <%=this.ClientID %>_loadUrl(url) {
|
||||
$('#<%=this.ClientID %>_DropControl').combobox('reload', url);
|
||||
}
|
||||
|
||||
function <%=this.ClientID %>_loadJson(jsonData) {
|
||||
$('#<%=this.ClientID %>_DropControl').combobox({
|
||||
data: $.parseJSON(jsonData),
|
||||
valueField: 'id',
|
||||
textField: 'text',
|
||||
groupField: 'group'
|
||||
});
|
||||
}
|
||||
|
||||
function <%=this.ClientID %>_loadData(jsData) {
|
||||
$('#<%=this.ClientID %>_DropControl').combobox({
|
||||
data: jsData,
|
||||
valueField: 'id',
|
||||
textField: 'text',
|
||||
groupField: 'group'
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<% if (this.Layout == LayoutDirection.Vertical){ %><div class="stacked-input-control"><% } %>
|
||||
<span id="<%=this.ClientID %>_SpanDrop"><asp:DropDownList ID="DropControl" runat="server" /></span>
|
||||
<% if (this.Layout == LayoutDirection.Vertical) { %></div><% } %>
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Swarmops.Common.Enums;
|
||||
|
||||
|
||||
namespace Swarmops.Frontend.Controls.Base
|
||||
{
|
||||
public partial class AjaxDropDown : ControlV5Base
|
||||
{
|
||||
public ListItemCollection Items
|
||||
{
|
||||
get { return this.DropControl.Items; }
|
||||
}
|
||||
|
||||
public string SelectedValue
|
||||
{
|
||||
get { return this.DropControl.SelectedValue; }
|
||||
set { this.DropControl.SelectedValue = value; }
|
||||
}
|
||||
|
||||
public string OnClientChange { get; set; }
|
||||
public string DataUrl { get; set; }
|
||||
|
||||
public string ClientControlID
|
||||
{
|
||||
get { return this.ClientID + "_DropControl"; }
|
||||
}
|
||||
|
||||
public DropDownList ClientControl
|
||||
{
|
||||
get { return this.DropControl; }
|
||||
}
|
||||
|
||||
public LayoutDirection Layout { get; set; }
|
||||
|
||||
protected void Page_Load (object sender, EventArgs e)
|
||||
{
|
||||
if (this.Layout == LayoutDirection.Unknown)
|
||||
{
|
||||
this.Layout = LayoutDirection.Vertical;
|
||||
}
|
||||
}
|
||||
|
||||
public string AjaxCallbackUrl { get; set; }
|
||||
public string Cookie { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Swarmops.Frontend.Controls.Base {
|
||||
|
||||
|
||||
public partial class AjaxDropDown {
|
||||
|
||||
/// <summary>
|
||||
/// DropControl control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.DropDownList DropControl;
|
||||
}
|
||||
}
|
||||
@@ -110,6 +110,13 @@
|
||||
<Compile Include="Controls\v5\Base\AjaxToggleSlider.ascx.designer.cs">
|
||||
<DependentUpon>AjaxToggleSlider.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\v5\Base\AjaxDropDown.ascx.cs">
|
||||
<DependentUpon>AjaxDropDown.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\v5\Base\AjaxDropDown.ascx.designer.cs">
|
||||
<DependentUpon>AjaxDropDown.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\v5\Swarm\ImpersonationWarningBox.ascx.cs">
|
||||
<DependentUpon>ImpersonationWarningBox.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -695,6 +702,7 @@
|
||||
<Content Include="Controls\v5\Base\AjaxTextBox.ascx" />
|
||||
<Content Include="Controls\v5\Base\AjaxToggleSlider.ascx" />
|
||||
<Content Include="Controls\v5\Base\ComboGeographies.ascx" />
|
||||
<Content Include="Controls\v5\Base\AjaxDropDown.ascx" />
|
||||
<Content Include="Controls\v5\Base\DropDown.ascx" />
|
||||
<Content Include="Controls\v5\Base\FileUpload.ascx" />
|
||||
<Content Include="Controls\v5\Base\MainMenu.ascx" />
|
||||
|
||||
Reference in New Issue
Block a user