Choice of datacontrol(webcontrol)
I would like to know which webcontrol is best choice for my requirement. My requirement is like this.
I have a sql statement which will return resultset of which the first 5 columns will have same value for each row and remaining columns will have different values. I want to display the first 5 column value as header of my report page(which will appear only once) and remaining columns as detail report section.
I tried using datalist but I could not use bind expression in the headertemplate and I am not sure whether I can use datagrid.
Monday, March 10, 2003
I would use a DataGrid to show the 6th...nth columns. Just make sure that you set AutoGenerateColumns property to false and provide definitions for each and every column.
a) If your resultset has allways the same number of columns, you can do the column definition directly in the XML of the .aspx:
<asp:DataGrid id="theGrid" runat="server" AutoGenerateColumns="False">
<asp:BoundColumn DataField="theNameOfYour6thField" />
<asp:BoundColumn DataField="theNameOfYour7thField" />
<asp:BoundColumn DataField="theNameOfYourNthField" />
b) If the number of columns is not constant, you can add the columns to the datagrid on the Page_Load event, I dont have the conde handy, but check this out:
Regarding the Page Header, just go back to the dataset and extract manually the first five fields of the first row and assign it to your header labels or controls.
Tuesday, March 11, 2003
I have a similar problem. I have a result set that has some columns that repeat through successive rows. I only want to show the item that repeats once, and then I want to show the rest of the columns for each of the rows with that value. Like this (not sure if formatting is preserved):
xx yyy zz
as ssq cv
It would seem to mean a nested repeater, but attempts at getting it to work failed. I did find someone who supposedly did get it working:
That is a slightly different scenario though. It might help the original poster. If anyone has ideas for which control I should use or knowledge that would help, please reply.
Tuesday, March 11, 2003
I've done nested datagrids before; the trick there is to do the databinding on the inner grid in the ItemDataBound event of the outer grid.
Thursday, March 13, 2003
Maybe this can give you some ideas?
Just me (Sir to you)
Friday, March 14, 2003
Fog Creek Home