Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using CMS.FormEngine.Web.UI;
- using System;
- using System.Collections.Generic;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Linq;
- using CMS.DataEngine;
- using CMS.Helpers;
- using CMS.DocumentEngine.Web.UI;
- public partial class CMSModules_Feldmann_Form_Controls_SearchSkuNameSkuNumberFilter : CMSAbstractQueryFilterControl
- {
- /// <summary>
- /// Sets up the inner child controls.
- /// </summary>
- private void SetupControl()
- {
- // Hides the filter if StopProcessing is enabled
- if (this.StopProcessing)
- {
- this.Visible = false;
- }
- // Initializes only if the current request is NOT a postback
- else if (!RequestHelper.IsPostBack())
- {
- }
- }
- /// <summary>
- /// Generates a WHERE condition and ORDER BY clause based on the current filtering selection.
- /// </summary>
- private void SetFilter()
- {
- string where = "";
- string order = "";
- if (!string.IsNullOrWhiteSpace(tbxValue.Text))
- {
- this.WhereCondition =SqlHelper.AddWhereCondition(this.WhereCondition, string.Format("SkuNumber like '%{0}%'", SqlHelper.EscapeQuotes(tbxValue.Text)));
- }
- // Raises the filter changed event
- this.RaiseOnFilterChanged();
- }
- /// <summary>
- /// Init event handler.
- /// </summary>
- protected override void OnInit(EventArgs e)
- {
- // Creates the child controls
- SetupControl();
- base.OnInit(e);
- }
- /// <summary>
- /// PreRender event handler
- /// </summary>
- protected override void OnPreRender(EventArgs e)
- {
- // Checks if the current request is a postback
- if (RequestHelper.IsPostBack())
- {
- // Applies the filter to the displayed data
- SetFilter();
- }
- base.OnPreRender(e);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement