I create a report by allowing users to select certain criteria from dropdownlistbox.

Dropdowns: site, project, startDate, endDate, reporting level (summary or agent detail)

I have the following datagrid with 7 columns:

<asp:datagrid id="grdResults" runat="server" Height="50px" Font-Names="Tahoma" Width="900px" Font-Size="XX-Small" BorderColor="Silver" ForeColor="Black" PageSize="1" adding="1" AutoGenerateColumns="False" BorderStyle="Solid"
CellSpacing="1" HorizontalAlign="Center">
<Columns>
<asp:BoundColumn DataField="iMsSiteId" HeaderText="Site"></asp:BoundColumn>
<asp:BoundColumn DataField="sProject" HeaderText="Project"></asp:BoundColumn>
<asp:BoundColumn DataField="sCalldate" HeaderText="Calldate"></asp:BoundColumn>
<asp:BoundColumn DataField="sAgentId" HeaderText="Agentid"></asp:BoundColumn>
<asp:BoundColumn DataField="sFirstName" HeaderText="First Name"></asp:BoundColumn>
<asp:BoundColumn DataField="sLastName" HeaderText="Last Name"></asp:BoundColumn>
<asp:BoundColumn DataField="sRevenue" HeaderText="Revenue" DataFormatString="{0:$###,###.##}"></asp:BoundColumn>
</Columns>
</asp:datagrid>

When agent detail is selected from the dropdown the datagrid should contain agentid, firstname, and lastname columns.
When summary is selected those 3 columns shouldn't be visible.

How can I do this dynamically?

Thanks,
Ninel

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.