using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using SteamWare; namespace MP_ADM.WebUserControls { public partial class cmp_ricercaGenerica : ApplicationUserControl { #region Public Events public event EventHandler eh_nuovaRicerca; #endregion Public Events #region Public Methods /// /// aggiorna il testo cercato /// public void updateText() { if (!string.IsNullOrEmpty(memLayer.ML.StringSessionObj("valoreSearch")) && !Page.IsPostBack) { testoRicerca = memLayer.ML.StringSessionObj("valoreSearch"); } } #endregion Public Methods #region Protected Properties /// /// testo ricerca trimmato da spazi /// protected string testoRicerca { get { return txtCerca.Text.Trim(); } set { txtCerca.Text = value; } } #endregion Protected Properties #region Protected Methods /// /// pressione del button di ricerca /// /// /// protected void btnCerca_Click(object sender, EventArgs e) { salvaCerca(); } protected void btnReset_Click(object sender, EventArgs e) { txtCerca.Text = ""; salvaCerca(); } protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); updateText(); btnCerca.Text = traduci("lblCerca"); } /// /// effettua salvataggio ricerca /// protected void salvaCerca() { if (string.IsNullOrEmpty(testoRicerca)) { memLayer.ML.emptySessionVal("valoreSearch"); } else { memLayer.ML.setSessionVal("valoreSearch", testoRicerca); // raise dell'evento if (eh_nuovaRicerca != null) { eh_nuovaRicerca(this, new EventArgs()); } } } /// /// cambiato valore in ricerca /// /// /// protected void txtCerca_TextChanged(object sender, EventArgs e) { salvaCerca(); } #endregion Protected Methods } }