You can do this with a datagrid/datatable/gridview the thing is that you need to create a datagrid/datatable/gridview for each result returned. I did something similar to this using a datagrid. I created a datagrid with two TemplateColumns and then used the Template columns to create the rows for the datagrid. Here is a portion of my html code.
- <asp:datagrid id="dgResults" Runat="server" ShowFooter="False" ShowHeader="False" BorderWidth="1" BorderColor="Black" BorderStyle="Solid" Width="70%" AutoGenerateColumns="False" PageSize="10" AllowPaging="True">
-
<Columns>
-
<asp:TemplateColumn>
-
<ItemTemplate>
-
<asp:Label ID="lblFirstColumn" Runat="server"></asp:Label>
-
</ItemTemplate>
-
</asp:TemplateColumn>
-
<asp:TemplateColumn>
-
<ItemTemplate>
-
<asp:Label ID="lblSecondColumn" Runat="server"></asp:Label>
-
</ItemTemplate>
-
</asp:TemplateColumn>
-
</Columns>
-
PagerStyle Visible="False" NextPageText="" PrevPageText=""></PagerStyle>
-
</asp:datagrid>
For the set up of your datagrid you will want to create two TemplateColumns and then create a label control for each row that will be displayed in your datagrid. Looking at the website that your provided it looks like you will need 15 labels in each template column.
Now in the code behind I loop through each item returned to the datagrid.
//first create a global DataTable variable;
DataTable dtable = new DataTable();
//now create a method that you will call after you bind your data to the grid. I called this method BindTemplateColumns();
- private void BindTemplateColumns()
-
{
-
dtable = ds.Tables["WhateverYouNamedYourDataSetTable"];
-
for (int i = 0; i < dgResults.Items.Count; i++)
-
{
-
DataRow row = dtable.Rows[i]; //this may affect your paging I had to use a Session value * a pageSize variable to correct an issue with paging.
-
Label lbl1 = (Label)dgResults.Items[i].FindControl("lblFirstColumn")';
-
lbl1.Text = row["columnname"].ToString();
-
Label lbl2 = (Label)dgResults.Items[i].FindControl("lblSecondColumn")';
-
lbl2.Text = row["columnname"].ToString();
-
//repeat for every label that you create.
-
}
-
}
In your search button click event you will want to execute your search proc put the results in ds.Tables["WhateverYouNamedYourDataSetTable"] then assign your datasource of the datagrid to ds.Tables["WhateverYouNamedYourDataSetTable"]. Then call the DataBind method of the datagrid. Next call BindTemplateColumns().
- dgResults.DataSource = ds.Tables["WhateverYouNamedYourDataSetTable"];
-
dgResults.DataBind();
-
BindTemplateColumns();
I hope this helps.
Nathan