Telerik.Reporting.ReportItemBase[] reportitmfooter = new ReportItemBase[ds.Tables[0].Columns.Count]; |
for (int i = 0; i < ds.Tables[0].Columns.Count; i++) |
{ |
//Fill the Group footer for show sum or count |
Telerik.Reporting.TextBox txtGroupFooter = new Telerik.Reporting.TextBox(); |
txtGroupFooter.Value = "=count([" + headcolumnname + "])"; |
txtGroupFooter.Name = "Sum" + headcolumnname; |
//textBoxDetails.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(xaxis, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(yaxis, Telerik.Reporting.Drawing.UnitType.Inch)); |
textBoxDetails.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(2, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.5, Telerik.Reporting.Drawing.UnitType.Cm)); |
reportitmfooter[i] = txtGroupFooter; |
} |
//group footer |
Telerik.Reporting.GroupFooterSection groupFootersection = new GroupFooterSection(); |
groupFootersection.Height = new Telerik.Reporting.Drawing.Unit(0.2, Telerik.Reporting.Drawing.UnitType.Inch); |
groupFootersection.Style.BackgroundColor = System.Drawing.Color.Blue; |
groupFootersection.KeepTogether = true; |
groupFootersection.Visible = true; |
groupFootersection.Name = "rptGroupFooter"; |
groupFootersection.Items.AddRange(reportitmfooter); |
report.Items.Add(groupFootersection); |
public Report5() |
{ |
InitializeComponent(); |
SqlConnection sqlConnection1 = new SqlConnection(); |
SqlCommand sqlSelectCommand1 = new SqlCommand(); |
SqlDataAdapter sqlDataAdapter1 = new SqlDataAdapter(); |
sqlConnection1.ConnectionString = myconnectionString; |
sqlSelectCommand1.CommandText = mycommand; |
sqlSelectCommand1.Connection = sqlConnection1; |
sqlDataAdapter1.SelectCommand = sqlSelectCommand1; |
this.table1.DataSource = sqlDataAdapter1; |
} |
For my application I need to build report parameters programmatically. I have tried to follow the examples available but I cannot get the parameters to display as a dropdown list of values. The parameter does show up in the viewer but as a textbox. Below is the code that I am using to build my parameter -
Dim vals As New ArrayList |
<fill vals with strings of option values> |
Dim param As New ReportParameter |
param.Type = ReportParameterType.String |
param.UI.Visible = True |
param.UI.MultiValue = True |
param.Value = vals |
Me.ReportParameters.Add(param) |
This is wrapped in a routine that is called when the report is bound to it's data source. When I try to call the routine from the report's constructor it results in a run-time error.
My questions are:
1. How do I get my options to show up as a dropdown list?
2. When should this routine be called?
3. Is it possible to build it with a value/key pair rather than just a list of values?
----------------------------------------------------------------------------------------------------------------
Upon further investigation, either programmatic definition of parameters is not supported or the documentation is severely lacking because I have tried every example (there are just a few) that I can find and it either results in no parameter or a run-time error. For example, just trying to add a simple test parameter with the following code results in no parameter in the viewer:
Public Sub New() |
InitializeComponent() |
ReportParameters.Add("Test", ReportParameterType.String, "test") |
End Sub |
Thanks,
Dave
private void MyTable_NeedDataSource(object sender, EventArgs e) |
{ |
SqlCommand sqlSelectCommand = new SqlCommand |
{ |
CommandText = "SP_MyStoredProc", |
Connection = new SqlConnection {ConnectionString = ConnectionString}, |
CommandType = CommandType.StoredProcedure |
}; |
sqlSelectCommand.Parameters.Add("@individualId", SqlDbType.Int); |
sqlSelectCommand.Parameters["@individualId"].Value = txtIndividualId.Value; //This is incorrect |
Telerik.Reporting.Processing.Table tbl = (Telerik.Reporting.Processing.Table)sender; |
tbl.DataSource = new SqlDataAdapter { SelectCommand = sqlSelectCommand }; |
} |