Advertisement
Guest User

Untitled

a guest
Oct 7th, 2015
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.49 KB | None | 0 0
  1. <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CustomDropDown.ascx.cs" Inherits="Mirabeau.CustomCmsDataTypes.UserControlls.CustomDropDown" %>
  2. <asp:DropDownList id="drop1" runat="server">
  3.     <asp:ListItem>Item 1</asp:ListItem>
  4.     <asp:ListItem>Item 2</asp:ListItem>
  5.     <asp:ListItem>Item 3</asp:ListItem>
  6.     <asp:ListItem>Item 4</asp:ListItem>
  7.     <asp:ListItem>Item 5</asp:ListItem>
  8.     <asp:ListItem>Item 6</asp:ListItem>
  9. </asp:DropDownList>
  10. <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
  11.  
  12. <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
  13.  
  14.  
  15. --------------
  16.  
  17.  
  18. using System;
  19.  
  20.  
  21. namespace Mirabeau.CustomCmsDataTypes.UserControlls
  22. {
  23.     public partial class CustomDropDown : System.Web.UI.UserControl, umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor
  24.     {
  25.  
  26.         public object value
  27.         {
  28.             get
  29.             {
  30.                 return drop1.SelectedValue;
  31.             }
  32.             set
  33.             {
  34.                 drop1.SelectedValue = value.ToString();
  35.             }
  36.         }
  37.  
  38.         protected void Page_Load(object sender, EventArgs e)
  39.         {
  40.             if (Page.IsPostBack)
  41.             {
  42.  
  43.             }
  44.         }
  45.  
  46.         protected void Button1_Click(object sender, EventArgs e)
  47.         {
  48.             string dropDownValue = string.Empty;
  49.             dropDownValue = value.ToString();
  50.             Label1.Text = "You have selected this" + dropDownValue;
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement