using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using SteamWare; public partial class mod_ricercaGenerica : ApplicationUserControl { #region Public Events public event EventHandler eh_nuovaRicerca; #endregion Public Events #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 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)) { SteamWare.memLayer.ML.emptySessionVal("valoreSearch"); } else { SteamWare.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 #region Public Methods /// /// aggiorna il testo cercato /// public void updateText() { if (!string.IsNullOrEmpty(memLayer.ML.StringSessionObj("valoreSearch")) && !Page.IsPostBack) { testoRicerca = SteamWare.memLayer.ML.StringSessionObj("valoreSearch"); } } #endregion Public Methods }