Bind a Grid to an Expression


You can bind a grid to any expression. In this example, we bind a grid the results of a Web Service Listener Activity.

We start by binding the grid to the results of an expression that points to the Web service listener (or whichever activity you want).

You need to write a class, and use it as the form base class.

Code Behind

using System;
using PNMsoft.Sequence.Forms.Web.UI;
using PNMsoft.Sequence.Web.Compilation;
using Rad = PNMsoft.Rad.Web.UI;
using Sq = PNMsoft.Sequence.Forms.Web.UI.Controls;
namespace SequenceEx.Forms.Samples
    public class ExpressionDataSourceBasedGrid : FormControl
        public ExpressionDataSourceBasedGrid()
        private bool IsInitialized
                object o = this.ViewState["IsInitialized"];
                return o != null && (bool)o;
                this.ViewState["IsInitialized"] = value;
        protected override void OnPreRender(EventArgs e)
            if (!this.IsInitialized)
                Sq.TextBox expressionTextBox = (Sq.TextBox)this.FindControl("ExpressionTextBox");
                Rad.RadGrid resultsGridView = (Rad.RadGrid)this.FindControl("ResultGridView");
                object ds = new SqExpressionBuilder().EvaluateExpression(expressionTextBox.Text, this, null, null);
                resultsGridView.DataSource = ds;
                this.IsInitialized = true;


<%@ Control Inherits="SequenceEx.Forms.Samples.ExpressionDataSourceBasedGrid, YOUR ASSEMBLY NAME " %>
  <sq:TextBox runat="server" ID="ExpressionTextBox" Visible="False" Text="{Form1}.Scope()"></sq:TextBox>
<sqr:RadGrid runat="server" ID="ResultGridView" AllowPaging="False">
<sq:BoundControl runat="server" TargetControlID="ResultGridView"></sq:BoundControl>
About this Article
  • Created: 07/16/2017 3:05 am EDT
  • Last updated: 07/16/2017 3:22 am EDT
In This Article