WebReportViewer Hide When Sorting An Column

Stimulsoft Reports.NET discussion
Post Reply
mghusername
Posts: 3
Joined: Thu Aug 13, 2015 8:31 am

WebReportViewer Hide When Sorting An Column

Post by mghusername »

I Create A report from C# Asp.net with 10 Page
when i click on a text control in columnband for Sorting the WebReportViewer Become Empty and don't show any thing.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: WebReportViewer Hide When Sorting An Column

Post by HighAley »

Hello.

What version of our assemblies do you use?
Could you send us a screen-shot of the Viewer?

Thank you.
mghusername
Posts: 3
Joined: Thu Aug 13, 2015 8:31 am

Re: WebReportViewer Hide When Sorting An Column

Post by mghusername »

C# Asp.net Code
Stimul Soft 2015 assemblies

StiReport report = new StiReport();
string strpath = HttpContext.Current.Server.MapPath("~\\");
report.Load(strpath + "Report.mrt");
string strSql = @"
select top 10 * from product";

DataTable dt = new DataTable("Per");
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=.;Initial Catalog=CrmReports;Integrated Security=True";
SqlDataAdapter da = new SqlDataAdapter(strSql, con);
da.Fill(dt);


StiPage page = report.Pages[0];
page.Orientation = StiPageOrientation.Portrait;

report.RegData(dt);
report.Dictionary.Synchronize();


StiHeaderBand TitleBand = new StiHeaderBand();
TitleBand.Height = 1;
TitleBand.Name = "TitleBand";
page.Components.Add(TitleBand);



StiText headerText = new StiText(new RectangleD(0, 0, page.Width, 0.85));
headerText.Text = "Report Name ";
headerText.HorAlignment = StiTextHorAlignment.Center;
headerText.Name = "TitleHeader";
headerText.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold);

StiText DateText = new StiText(new RectangleD(0.3, 0.3, page.Width, 0.2));
DateText.Text = "{Today}";
DateText.HorAlignment = StiTextHorAlignment.Center;
DateText.Name = "DateText";
DateText.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold);


TitleBand.Components.Add(headerText);
TitleBand.Components.Add(DateText);


StiHeaderBand headerBand = new StiHeaderBand();
headerBand.Height = 0.5;
headerBand.Name = "HeaderBand";
page.Components.Add(headerBand);

StiColumnHeaderBand ColumnBand = new StiColumnHeaderBand();
ColumnBand.Height = 1;
page.Components.Add(ColumnBand);


StiDataBand dataBand = new StiDataBand();
dataBand.DataSourceName = "Per";
dataBand.Height = 0.2;
dataBand.Name = "DataPer";
page.Components.Add(dataBand);



double pos = 0;
double columnWidth = page.Width / dt.Columns.Count;
int nameIndex = 1;

for (int i = dt.Columns.Count - 1; i >= 0; i--)
{
DataColumn dataColumn = dt.Columns;

//Add Text Component To DataBound
StiText dataText = new StiText(new RectangleD(pos, 0, columnWidth, 0.4));
dataText.Text = "{Per." + Stimulsoft.Report.CodeDom.StiCodeDomSerializator.ReplaceSymbols(dataColumn.ColumnName) + "}";
dataText.Name = "DataText" + nameIndex.ToString();
dataText.HorAlignment = StiTextHorAlignment.Center;
dataText.VertAlignment = StiVertAlignment.Center;
dataText.Brush = new StiSolidBrush(Color.Aqua);
dataText.Border.Side = StiBorderSides.All;
dataText.Border = new Stimulsoft.Base.Drawing.StiBorder(Stimulsoft.Base.Drawing.StiBorderSides.All, System.Drawing.Color.FromArgb(255, 12, 12, 12), 1, Stimulsoft.Base.Drawing.StiPenStyle.Solid, false, 4, new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black), false);
dataText.Font = new System.Drawing.Font("Tahoma", 9F);
dataText.Margins = new Stimulsoft.Report.Components.StiMargins(0, 0, 0, 0);
dataText.TextBrush = new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.FromArgb(255, 64, 64, 64));
dataText.TextOptions = new Stimulsoft.Base.Drawing.StiTextOptions(false, false, false, 0F, System.Drawing.Text.HotkeyPrefix.None, System.Drawing.StringTrimming.None);

dataBand.Components.Add(dataText);


//Add Text Component To ColumnBound
StiText dataText2 = new StiText(new RectangleD(pos, 0, columnWidth, 0.4));
dataText2.Text = dt.Columns.ColumnName;
dataText2.Name = "DataText" + (dt.Columns.Count + nameIndex).ToString();
dataText2.HorAlignment = StiTextHorAlignment.Center;
dataText2.VertAlignment = StiVertAlignment.Center;
dataText2.Brush = new StiSolidBrush(Color.Aqua);
dataText2.Border.Side = StiBorderSides.All;
dataText2.Border = new Stimulsoft.Base.Drawing.StiBorder(Stimulsoft.Base.Drawing.StiBorderSides.All, System.Drawing.Color.FromArgb(255, 12, 12, 12), 1, Stimulsoft.Base.Drawing.StiPenStyle.Solid, false, 4, new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black), false);
dataText2.Font = new System.Drawing.Font("Tahoma", 9F);
dataText2.Margins = new Stimulsoft.Report.Components.StiMargins(0, 0, 0, 0);
dataText2.TextBrush = new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.FromArgb(255, 64, 64, 64));
dataText2.TextOptions = new Stimulsoft.Base.Drawing.StiTextOptions(false, false, false, 0F, System.Drawing.Text.HotkeyPrefix.None, System.Drawing.StringTrimming.None);

ColumnBand.Components.Add(dataText2);


pos = pos + columnWidth;
nameIndex++;
dataColumn = new DataColumn();
dataText = new StiText();
}



report.Compile();
report.Dictionary.Synchronize();
StiWebViewer1.Report = report;
Attachments
ScreenShot
ScreenShot
Untitled.png (110.09 KiB) Viewed 1929 times
Last edited by mghusername on Thu Aug 13, 2015 12:44 pm, edited 1 time in total.
mghusername
Posts: 3
Joined: Thu Aug 13, 2015 8:31 am

Re: WebReportViewer Hide When Sorting An Column

Post by mghusername »

Thanks For Answer
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: WebReportViewer Hide When Sorting An Column

Post by HighAley »

Hello.

Please, send us your report template with link on this topic to support@stimulsoft.com.

Thank you.
RichChen
Posts: 2
Joined: Wed Sep 02, 2015 1:21 am

Re: WebReportViewer Hide When Sorting An Column

Post by RichChen »

Hello.

Please, send us your report template with link on this topic to 2302874773@qq.com.I really need

Thank you.
RichChen
Posts: 2
Joined: Wed Sep 02, 2015 1:21 am

Re: WebReportViewer Hide When Sorting An Column

Post by RichChen »

Hello, please give me your Template。 :)
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: WebReportViewer Hide When Sorting An Column

Post by HighAley »

Hello, RichChen.

Could you specify what report template you need?

Thank you.
Post Reply