Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8441573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:35:46+00:00 2026-06-10T08:35:46+00:00

<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

  • 0
<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

enter image description here

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

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:35:47+00:00Added an answer on June 10, 2026 at 8:35 am

    So basically your actual question is how to change a DateTime's DayOfWeek value by it’s distance to a specified first day of week?

    Then you could use this method:

    public static int Weekday(DateTime dt, DayOfWeek startOfWeek)
    {
        return (dt.DayOfWeek - startOfWeek + 7) % 7;
    }
    

    For example, assuming that the user entered today to specify that Tuesday is the beginning of the week:

    DateTime value = new DateTime(2012, 8, 20);
    DayOfWeek weekday = (DayOfWeek)Weekday(value, DateTime.Now.DayOfWeek);
    Console.Write("normally:{0} changed to:{1}", value.DayOfWeek, weekday); 
    

    Demo: http://ideone.com/Zk99b

    If this is true you only have to use this method in RowDataBound of the GridView to set the Text of a Label in a TemplateField manually according to the specified date in tbFirstDate and the date value in the DataItem of the GridViewRow. Use GridViewRow.FindControl("LabelID") to get a reference to the Label.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have GridView: <asp:GridView ID=MyGridView runat=server ShowFooter=true AutoGenerateColumns=False Visible=True> <Columns> <asp:BoundField DataField=id ItemStyle-HorizontalAlign=center/> <asp:BoundField
Markup <asp:GridView ID=GridView1 runat=server AutoGenerateColumns=False> <Columns> <asp:BoundField DataField=insured_first_name HeaderText=First Name /> <asp:BoundField DataField=insured_first_name HeaderText=Middle
I have a Gridview <asp:GridView ID=GridView1 runat=server Width=400px AutoGenerateColumns=false OnSelectedIndexChanged=GridView1_SelectedIndexChanged1> <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox
Sample <asp:GridView ID=data_basic_addresses runat=server AllowPaging=False BorderWidth=0 AllowSorting=True AutoGenerateColumns=False DataKeyNames=AddressId HorizontalAlign=Center DataSourceID=LinqAddressDS PageSize=20 CssClass=GridViewClass> <Columns>
I have a simple grid view like this : <asp:GridView ID=gv_userActivities runat=server AutoGenerateColumns=False> <Columns>
i have a asp.net webpage with a GridView <asp:GridView ID=grid_view runat=server AllowPaging=True AutoGenerateColumns=False BackColor=White
I have a grid like below. <asp:GridView ID=GridView1 runat=server AutoGenerateColumns=False s onrowcommand=GridView1_RowCommand> <Columns> <asp:ButtonField
I want to provide custom paging in grid view. <asp:GridView ID=gvFirst runat=server AutoGenerateColumns=false AllowPaging=true
I have a Datagrid which looks as under <asp:GridView ID=dgTask runat=server Width=100% AutoGenerateColumns=False> <Columns>
I have a Gridview with these parameters: <asp:GridView runat=server ID=ItemGrid CssClass=Grid AutoGenerateColumns=false AutoGenerateDeleteButton=true OnRowDeleting=RowDeleting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.