Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// Vlastni ovladaci control pro textbox i s validaci a stylem
- /// </summary>
- public partial class TxtBox : System.Web.UI.UserControl
- {
- /// <summary>
- /// hodnota textoveho pole
- /// </summary>
- public string Value
- {
- get { return txtValue.Text; }
- set { txtValue.Text = value; }
- }
- /// <summary>
- /// placeholder pro textove pole
- /// </summary>
- public string Placeholder
- {
- set { txtValue.Attributes.Add("placeholder", value); }
- }
- /// <summary>
- /// Nadpis textoveho pole
- /// </summary>
- public string Label
- {
- set { label.Text = value; }
- }
- /// <summary>
- /// validacni regularni vyraz
- /// </summary>
- public string Regular
- {
- get { return RegularExpressionValidator1.ValidationExpression; }
- set { RegularExpressionValidator1.ValidationExpression = value; }
- }
- /// <summary>
- /// chybova hlaska pri validaci
- /// </summary>
- public string ErrorMessege
- {
- get { return RegularExpressionValidator1.ErrorMessage; }
- set { RegularExpressionValidator1.ErrorMessage = value; }
- }
- /// <summary>
- /// nastaveni validačni skupiny
- /// </summary>
- public string ValidationGroup
- {
- get
- {
- return RegularExpressionValidator1.ValidationGroup;
- }
- set { RegularExpressionValidator1.ValidationGroup = value; RequiredFieldValidator2.ValidationGroup = value; }
- }
- /// <summary>
- /// cssclass pro textove pole
- /// </summary>
- public string ClassForTxt
- {
- set { txtValue.CssClass = value; }
- }
- /// <summary>
- /// atribut pro nastaveni textarey
- /// </summary>
- ///
- public bool Password
- {
- set
- {
- if (value)
- txtValue.TextMode = TextBoxMode.Password;
- }
- }
- public bool Onblur { get; set; }
- public bool autoComplete;
- public string Auto { set { if (value == "true") autoComplete = true; } }
- protected void Page_Load(object sender, EventArgs e)
- {
- if (Session[ID] != null)
- {
- Value = Session[ID].ToString();
- }
- if (autoComplete)
- {
- AjaxControlToolkit.AutoCompleteExtender ex = new AjaxControlToolkit.AutoCompleteExtender();
- ex.TargetControlID = txtValue.ID;
- ex.CompletionInterval = 800;
- ex.MinimumPrefixLength = 2;
- ex.ServiceMethod = "GetCities";
- ex.ServicePath = "WebService1.asmx";
- ex.CompletionListCssClass = "completionList";
- ex.CompletionListHighlightedItemCssClass = "itemHighlighted";
- ex.CompletionListItemCssClass = "listItem";
- placeHolder.Controls.Add(ex);
- }
- if (Onblur)
- txtValue.Attributes.Add("onblur", "checkmail()");
- }
- public void SaveValue()
- {
- if (!StaticLibrary.Validate(txtValue.Text, StaticLibrary.ValidationRules[ID]))
- throw new Exception(String.Format("Validace pole {0} neproběhla úspěšně, opravte prosím hodnotu", label.Text));
- Session[ID] = Value;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement