You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Forks.EnterpriseServices.DataForm;
using TSingSoft.WebControls2;
namespace BWP.Web
{
public abstract class DFGridReportPage<T> : DFGridReportPage
{
protected DFInfo mDFInfo = DFInfo.Get(typeof(T));
protected override void InitForm(System.Web.UI.HtmlControls.HtmlForm form)
{
base.InitForm(form);
mDFGrid.HeaderPagerLock = true;
mDFGrid.AllowColGroup = true;
mDFGrid.AllowSorting = true;
}
protected override void AddResultControls(VLayoutPanel vbox)
{
base.AddResultControls(vbox);
mDFGrid.AllowSorting = true;
mDFGrid.HeaderPagerLock = true;
mDFGrid.Height = 650;
mDFGrid.Width = 1100;
string bodyHeight = Request.Form["__BodyHeight"];
string bodyWidth = Request.Form["__BodyWidth"];
if (bodyHeight != null)
{
int height;
if (int.TryParse(bodyHeight, out height) && height > 180)
{
if (EnableExcelExport && EnablePrint)
mDFGrid.Height = height - 160;
else
mDFGrid.Height = height - 100;
}
else
{
mDFGrid.Height = 650;
}
}
if (bodyWidth != null)
{
int width;
if (int.TryParse(bodyWidth, out width) && width > 100)
{
mDFGrid.Width = width - 30;
}
else
{
mDFGrid.Width = 1100;
}
}
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
var script = @"
<script type=""text/javascript"">
var conH = document.getElementById('__BodyHeight');
if (conH)
conH.value = $(document.body).height();
var conW = document.getElementById('__BodyWidth');
if (conW)
conW.value = $(document.body).width();
</script>
";
ClientScript.RegisterHiddenField("__BodyHeight", "");
ClientScript.RegisterHiddenField("__BodyWidth", "");
ClientScript.RegisterClientScriptBlock(GetType(), "gridsc", script, false);
}
}
}