Check documentation for the latest version of dhtmlxSuite BeforeOutput DHTMLX Docs

BeforeOutput

The BeforeOutput event occurs after data has been selected from the database and ready to be sent to client-side.

connector.BeforeOutput += new EventHandler<RenderEventArgs>(connector_BeforeOutput);

Event passes reference to XmlWriter object that is currently used for rendering response.

Most common use-case of this event - the header structure for the grid.

void connector_BeforeOutput(object sender, RenderEventArgs e)
{
  e.Writer.WriteStartElement("head");
  {
    //col 1
    e.Writer.WriteStartElement("column");
       {
          e.Writer.WriteAttributeString("width", "50");
          e.Writer.WriteAttributeString("type", "ed");
          e.Writer.WriteAttributeString("align", "right");
          e.Writer.WriteAttributeString("color", "white");
          e.Writer.WriteAttributeString("sort", "na");
          e.Writer.WriteString("Sales");
       }
    e.Writer.WriteEndElement();
  }
    //...............
}

In case of dyn. loading mode, one more check needs to be performed for preventing data output for additional data calls.

void connector_BeforeOutput(object sender, RenderEventArgs e)
{
    if (this.Connector.Request.StartIndex == 0)
    {
        e.Writer.WriteStartElement("head");
        //..........
    }
}
Back to top