Posted 6 August 2019, 10:34 pm EST
Hello Brian,
If the condition that you use is predefined (i.e., not based on data value from the report), you can achieve both of the mentioned requirements in the ReportStart. For example, you can set the DataField conditionally as follows:
```
int i = 5, j = 10;
if (i > j)
textBox3.DataField = “CustomerId”;
else
textBox3.DataField = “Country”;
If the condition is based on the report related values, you can achieve the requirement to hide controls conditionally in Detail.Format event as follows:
private void detail_Format(object sender, EventArgs e)
{
if (textBox1.Value.ToString().StartsWith(“B”) || textBox1.Value.ToString().StartsWith(“D”))
{
textBox3.Visible = true;
textBox4.Visible = false;
}
else
{
textBox3.Visible = false;
textBox4.Visible = true;
}
}
A sample has been attached for your reference.
Regards,
Esha
[zip filename="SectionReport_Runtime.zip"]https://gccontent.blob.core.windows.net/forum-uploads/file-5ca7bcf8-04f1-4936-8251-22eb53be9a65.zip[/zip]