On my report I have text box - Age(). How I can to run below function:
public
string CalculateAge()
{
DateTime BirthDate = DateTime.Now;
int years = DateTime.Now.Year - BirthDate.Year;
// subtract another year if we're before the
// birth day in the current year
if ((DateTime.Now.Month < BirthDate.Month && (BirthDate.Month - DateTime.Now.Month) >= 6))
years--;
return years.ToString();
}
as User functions for value the text box
(ReportViewer1.Report
as Report1).ReportParameters[0].Value = Page.User.Identity.Name;
For DateStart and DateEnd i created Parameters and set the UI visible to true, so the user gets prompted for the values. So far it's ok.
But how should the Filter Expression look like?
Date BETWEEN DateStart and DateEnd? But how can i do this in Filter - Edit Expressions?
I also tried to setup the DateStart and DateEnd Parameters in the TableAdapter Query and if i pass the two values via code in the Report1.cs it works, but how can i pass the two Values from the UI Parameter Fields to the Tableadapter Fill Query ?
Thanks!
public string GetValue(int val) |
{ |
if(val == 1){ |
return "yes"; |
}else{ |
return "no"; |
} |
} |
public override void VisitGroup(Group element)
{
Telerik.Reporting.Group HeaderGroup = new Telerik.Reporting.Group();
Telerik.Reporting.GroupHeaderSection HeaderGroupSection = new GroupHeaderSection();
Telerik.Reporting.GroupFooterSection FooterGroupSection = new GroupFooterSection();
HeaderGroup.GroupHeader= HeaderGroupSection ;
HeaderGroup.GroupFooter = FooterGroupSection ;
HeaderGroup.Grouping.AddRange(new Telerik.Reporting.Data.Grouping[] {new Telerik.Reporting.Data.Grouping("=Fields.[" + element.Column + "]")});
this.currentContainer.Report.Groups.Add(HeaderGroup);
this.currentContainer = HeaderGroupSection;
element.Header.Accept(this);
if (HeaderGroupSection != null)
{
CalculateMaxHeight(HeaderGroupSection);
HeaderGroupSection.PrintOnEveryPage = true;
HeaderGroupSection.KeepTogether = true;
HeaderGroupSection.PageBreak = PageBreak.None;
}
this.currentContainer = FooterGroupSection;
element.Footer.Accept(this);
if (FooterGroupSection != null)
{
CalculateMaxHeight(FooterGroupSection);
FooterGroupSection.KeepTogether = true;
FooterGroupSection.PageBreak = PageBreak.None;
}
this.currentContainer = this.currentContainer.Report;
}
------------------------------------------------------------
<group level="1" column="Email" newpage="true">
<groupHeader width="5000" height="70">
<boundField id="boundField#" datafield="Email" left="0" top="2" width="300" height="30" wrap="false" formatString="" textalign="left" cssclass="GroupTitle" borderwidth="" borderstyle="" bordercolor="black"/>
<label id="label#" text="Some Heading" left="0" top="32" width="35" height="21" wrap="true" formatString="" textalign="left" cssclass="Header" borderwidth="" borderstyle="" bordercolor="" fontfamily="Arial" fontsize="11px" fontweight="bold"/>
</groupHeader>
<groupFooter width="950" height="35">
<runningTotal text="Count" expression="count(property)" datatype="System.Int" reset="true" resetvalue="0" left="370" top="5" width="100" height="21" wrap="false" formatString="{0:N0}" textalign="right" cssclass="GroupTitle" borderwidth="" borderstyle="" bordercolor="" />
</groupFooter>
</group>