<asp:GridView ID="grid1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField='id' HeaderText="Id" Visible="False" />
<asp:BoundField DataField='Name' Visible="True" HeaderText="Full Name"/>
<asp:BoundField HeaderText="Monday" />
<asp:BoundField HeaderText="Tuesday" />
<asp:BoundField HeaderText="Wednesday" />
<asp:BoundField HeaderText="Thursday" />
<asp:BoundField HeaderText="Friday" />
</Columns>
</asp:GridView>
<asp:TextBox ID="tbFirstDate" runat="server"></asp:TextBox>
//In the DataTable that is the source for this grid1 I have a column ‘date’, but in the Grid I need to show weekday with that date (ex. Monday 20.08.2012). I also have a TextBox(tbFirstDate) that defines which day is monday, so using that info I need to calculate the rest of the weekdays, date format is yyyy-mm-dd
I work with PostreSQL, this is the SQL query:
SELECT * FROM Table1
WHERE id1=212 AND date BETWEEN '20.08.2012' AND '24.08.2012'
ORDER BY date

Now this result I want to represent in the grid like this

So basically your actual question is how to change a
DateTime'sDayOfWeekvalue by it’s distance to a specified first day of week?Then you could use this method:
For example, assuming that the user entered today to specify that
Tuesdayis the beginning of the week:Demo: http://ideone.com/Zk99b
If this is true you only have to use this method in
RowDataBoundof theGridViewto set the Text of a Label in aTemplateFieldmanually according to the specified date intbFirstDateand thedatevalue in theDataItemof the GridViewRow. UseGridViewRow.FindControl("LabelID")to get a reference to the Label.