Guest User

Untitled

a guest
Oct 23rd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 2.77 KB | None | 0 0
  1. <%@ Control Language="C#" ClassName="AddressControl" %>
  2.  
  3. <script runat="server">
  4.     public string StreetAddress
  5.     {
  6.         get { return this.txtStreet.Text; }
  7.         set { this.txtStreet.Text = value; }
  8.     }
  9.    
  10.     public string ZipPostalCode
  11.     {
  12.         get { return this.txtZipPostalCode.Text; }
  13.         set { this.txtZipPostalCode.Text = value; }
  14.     }
  15.    
  16.     public string City
  17.     {
  18.         get { return this.txtCity.Text; }
  19.         set { this.txtCity.Text = value; }
  20.     }
  21.  
  22.     public string CountryID
  23.     {
  24.         get { return this.cbxCountry.SelectedItem.Value; }
  25.         set { this.cbxCountry.SelectedItem.Value = value; }
  26.     }
  27.  
  28.     public bool ShowCheckbox
  29.     {
  30.         get
  31.         {
  32.             object obj =  this.ViewState["ShowCheckbox"];
  33.  
  34.             return (obj == null) ? false : (bool)obj;
  35.         }
  36.         set
  37.         {
  38.             this.ViewState["ShowCheckbox"] = value;
  39.         }
  40.     }
  41.  
  42.     public bool Checked
  43.     {
  44.         get { return this.chkSame.Checked; }
  45.         set { this.chkSame.Checked = value; }
  46.     }
  47.  
  48.     public string CheckboxMessage
  49.     {
  50.         get { return this.chkSame.FieldLabel; }
  51.         set { this.chkSame.FieldLabel = value; }
  52.     }
  53.  
  54.     Checkbox chkSame = new Checkbox();
  55.    
  56.     protected void Page_Load(object sender, EventArgs e)
  57.     {
  58.         if (!X.IsAjaxRequest)
  59.         {
  60.             if (this.ShowCheckbox)
  61.             {
  62.                 this.chkSame.ID = "chkSame";
  63.                 this.chkSame.Checked = this.Checked;
  64.                 this.chkSame.FieldLabel = this.CheckboxMessage;
  65.                 this.chkSame.LabelStyle = "white-space:nowrap;";
  66.  
  67.                 this.chkSame.Listeners.Check.Handler = "#{Panel2}.setVisible(!this.getValue());#{Panel2}.doLayout();if (!this.getValue()) {#{txtStreet}.focus();}";
  68.             }
  69.         }
  70.     }
  71. </script>
  72.  
  73.  
  74.         <ext:Panel ID="Address" runat="server" Border="false" Header="false" AnchorHorizontal="100%" Layout="Form">
  75.             <Items>
  76.                 <ext:TextField ID="txtStreet" runat="server" FieldLabel="Street" AnchorHorizontal="100%" />
  77.                 <ext:TextField ID="txtZipPostalCode" runat="server" FieldLabel="Zip/Postal Code" AnchorHorizontal="100%" />
  78.                 <ext:TextField ID="txtCity" runat="server" FieldLabel="City" AnchorHorizontal="100%" />
  79.                 <ext:ComboBox ID="cbxCountry" runat="server" FieldLabel="Country" AnchorHorizontal="100%">
  80.                     <Items>
  81.                         <ext:ListItem Text="Australia" Value="AU" />
  82.                         <ext:ListItem Text="Canada" Value="CA" />
  83.                         <ext:ListItem Text="United States" Value="US" />
  84.                     </Items>
  85.                 </ext:ComboBox>
  86.             </Items>
  87.         </ext:Panel>
Add Comment
Please, Sign In to add comment