|
-
Oct 16th, 2004, 01:01 AM
#1
Thread Starter
New Member
DataGrid in ASP.Net
I wrote a query "select * from tbl_School".
tbl_School has 7 columns say rollno, name, standard, sub1,sub2, sub3, Score.
Now I want to fill a DatagridOne using the above written query inwhich I will display first there columns(rollno, name, standard) and I want to fill an another DatagridTwo having the rest of the columns(Sub1, Sub2, Sub3 & Score) using the same query.
The problem is I do not want to write separate query for both the datagrids but want to use a common above written query. how is it possible?
-
Oct 18th, 2004, 05:58 AM
#2
Fanatic Member
use the query to create a datatable and then build two sepearte datagrids. You can add code to the html page to specify the columns to be used.
add this tag to datagrid one.
VB Code:
<Columns>
<asp:BoundColumn DataField="chnl_id" HeaderText="Channel ID"></asp:BoundColumn>
<asp:BoundColumn DataField="district" HeaderText="District"></asp:BoundColumn>
<asp:BoundColumn DataField="range01" SortExpression="range01" HeaderText="0 - 30 days" DataFormatString="{0:c}"></asp:BoundColumn>
<asp:BoundColumn DataField="range02" SortExpression="range02" HeaderText="31 - 60 days" DataFormatString="{0:c}"></asp:BoundColumn>
</Columns>
and then for datagrid two:
VB Code:
<asp:BoundColumn DataField="range03" SortExpression="range03" HeaderText="61 - 90 days" DataFormatString="{0:c}"></asp:BoundColumn>
<asp:BoundColumn DataField="range04" SortExpression="range04" HeaderText="91 - 180 days" DataFormatString="{0:c}"></asp:BoundColumn>
<asp:BoundColumn DataField="range05" SortExpression="range05" HeaderText="180 - 365 days" DataFormatString="{0:c}"></asp:BoundColumn>
<asp:BoundColumn DataField="value90" SortExpression="value90" HeaderText="90 + days" DataFormatString="{0:c}"></asp:BoundColumn>
<asp:BoundColumn DataField="value" SortExpression="value" HeaderText="Total" DataFormatString="{0:c}"></asp:BoundColumn>
obviously chnage the boundcolumn datafield to your column name
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|