Fame th
Fame th

Reputation: 1038

How to set textbox by value which get from each row of tablix?

If Datasource has 4 rows like these

 ___Item_____
     AA
     BB
     CC
     DD

If I make 10 textboxes I need to input 4 value (AA,BB,CC and DD) to textboxes. if some textbox isn't value, It will show (***) like below .

enter image description here

1st row put to the first textbox.

2nd row put to the second textbox.

3rd row put to the third textbox.

4th row put to the fourth textbox.

and other put (***) because of Datasource has only 4 rows.

I mean I need to show free layout .I not mean horizontal tablix . enter image description here

Upvotes: 0

Views: 419

Answers (1)

Oceans
Oceans

Reputation: 3509

Because you wish to display the data in a fixed amount of textboxes and your dataset only has a single column, you shouldn't really try to fill the report dynamically. Instead of using an undefined datasource you could simply format the data and pass it as a list of parameters to the report.

ReportParameter[] reportParameters = new ReportParameter[10];
for (int i = 0; i < reportParameters.Length; i++)
{
   reportParameters[i] = new ReportParameter(string.Format("pParam{0}", i),
        (i < myDataSource.Count) ? myDataSource[i] : "***");
}

myViewer.LocalReport.SetParameters(reportParameters);

Then simply make sure you have parameters defined for the ones you are trying to display (e.g. pParam0 , pParam1, ... , pParam9) and add those in the wanted textboxes.

Upvotes: 1

Related Questions