I need a datagrid that has 4 columms & 2 rows.
Each cell in that datagrid will represent one row from my database table.

can someone plz giv me some sample code for that ?
or any tips on how to achieve the same ??

Recommended Answers

All 4 Replies

In my opinion there are 2 ways of doing it:
1. Make your datasource such that it resembels what is required in the datagrid. Say, For example, you make a array of array and the base array would have table rows in it. So it would be like Array A has two arrays and each of the array has data from the Table row.
and then you simply do a custom binding of your datagrid by calling the event handler of databinding.
2. Other method is more adhoc, where you generate table dynamically. so you declare asp:Table as runat server and then in code behind you add rows and columns in it.

Hope that helps

Hi,

Thanx for ur help !
I'm not much experienced with .NET but will surely try ur suggestions.


Thanx
- Prasadd

Hi all here any one knows how to assign color for each rows cell value on the bases of some logics.
Regards.

Ali.

Hi all here any one knows how to assign color for each rows cell value on the bases of some logics.
Regards.

Ali.

try to loop the table then provide the color you wanted to be in every loop... got it? it better to for() statement

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.