Kamala Veni

Kamala Veni

  • NA
  • 65
  • 21.5k

C#,Display 30 Days in label??

Mar 15 2016 1:53 AM
Am having a seprate  form for one month ,in dat i want to display the selected dates in the label continuously as from march 28th to april 27th..
how to i display it in different page and oly can select 28-27 days from any month..datz i cycle month
 
plz help me 
 
here is the code for selecting 7 days oly,
wanna select a month day within condition and display in label... 
 
<asp:Label ID="lb7" runat="server" style="text-align: center; color: #0000FF; margin-left: 0px; font-weight: 700;" Height="25px" Width="42px"></asp:Label>
<CENTER>
<table ID="myt1" runat="server" border="0" style="text-align: center; width: 1388px; margin-left: 23px; margin-top: 30px; height: 2915px;">
<tr>
<th class="auto-style6"><asp:Label ID="lbt" runat="server" Width="154px" Text="Days" style=" color: #9933FF"></asp:Label></th>
<th class="auto-style8"><asp:Label ID="lbt1" runat="server" Width="154px" Text="" style=" color: #9933FF"></asp:Label></th>
<th class="auto-style8"><asp:Label ID="lbt2" runat="server" Width="154px" Text="" style="color: #9933FF" ></asp:Label></th>
<th class="auto-style8"><asp:Label ID="lbt3" runat="server" Width="154px" Text="" style="color: #9933FF"></asp:Label></th>
<th class="auto-style8"><asp:Label ID="lbt4" runat="server" Width="154px" Text="" style=" color: #9933FF"></asp:Label></th>
<th class="auto-style8"><asp:Label ID="lbt5" runat="server" Width="154px" Text="" style="color: #9933FF; "></asp:Label></th>
<th class="auto-style8"><asp:Label ID="lbt6" runat="server" Width="154px" Text="" style="color: #9933FF;"></asp:Label></th>
<th class="auto-style8"><asp:Label ID="lbt7" runat="server" Width="154px" Text="" style="color: #9933FF;"></asp:Label></th>
</tr>
<tr>
<th class="auto-style3">Select Date : &nbsp; <asp:ImageButton ID="img" runat="server" Height="20px"
ImageUrl="D:\Dev\App\Vaayuprj090116\images\Calendar_ICON.png" onclick="img_Click" Width="35px" style="background-color: #66CCFF" />
<asp:Calendar ID="cal" runat="server" Height="151px" style="margin-left: 0px; background-color: #FFFFFF; margin-top: 5px;" Width="203px" Format="dd/MM/yyyy" Visible="False" OnSelectionChanged="cal_SelectionChanged" BackColor="#FFFFCC" BorderColor="#FFCC66" BorderWidth="1px" Font-Names="Verdana" Font-Size="8pt" ForeColor="#663399" DayNameFormat="Shortest" ShowGridLines="True">
<DayHeaderStyle Font-Bold="True" BackColor="#FFCC66" Height="1px" />
<NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC" />
<OtherMonthDayStyle ForeColor="#CC9966" />
<SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />
<SelectorStyle BackColor="#FFCC66" />
<TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt" ForeColor="#FFFFCC" />
<TodayDayStyle BackColor="#FFCC66" ForeColor="White" />
</asp:Calendar>
</th>
<th class="auto-style8"><asp:Label ID="lbd0" runat="server" Width="154px" Text="" style=" color: #9933FF"></asp:Label></th>
<th class="auto-style8"><asp:Label ID="lbd1" runat="server" Width="154px" Text="" style="color: #9933FF" ></asp:Label></th>
<th class="auto-style8"><asp:Label ID="lbd2" runat="server" Width="154px" Text="" style="color: #9933FF"></asp:Label></th>
<th class="auto-style8"><asp:Label ID="lbd3" runat="server" Width="154px" Text="" style=" color: #9933FF"></asp:Label></th>
<th class="auto-style8"><asp:Label ID="lbd4" runat="server" Width="154px" Text="" style="color: #9933FF; "></asp:Label></th>
<th class="auto-style8"><asp:Label ID="lbd5" runat="server" Width="154px" Text="" style="color: #9933FF;"></asp:Label></th>
<th class="auto-style8"><asp:Label ID="lbd6" runat="server" Width="154px" Text="" style="color: #9933FF;"></asp:Label></th>
</tr>
 
code:
 
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
cal.SelectedDate = System.DateTime.Now;
}
}
protected void cal_SelectionChanged(object sender, EventArgs e)
{
DateTime now = DateTime.Now;
DateTime check = DateTime.Now.AddDays(7);
now = now.AddDays(2);
lbt1.Text = (now.ToString("dddd"));
now = now.AddDays(1);
lbt2.Text = (now.ToString("dddd"));
now = now.AddDays(1);
lbt3.Text = (now.ToString("dddd"));
now = now.AddDays(1);
lbt4.Text = (now.ToString("dddd"));
now = now.AddDays(1);
lbt5.Text = (now.ToString("dddd"));
now = now.AddDays(1);
lbt6.Text = (now.ToString("dddd"));
now = now.AddDays(1);
lbt7.Text = (now.ToString("dddd"));
lb7.Text = DateTime.Now.ToShortTimeString();
// lbd0.Text = cal.TodaysDate.ToShortDateString();
lbd0.Text = DateTime.Today.AddDays(2).ToShortDateString();
lbd1.Text = DateTime.Today.AddDays(3).ToShortDateString();
lbd2.Text = DateTime.Today.AddDays(4).ToShortDateString();
lbd3.Text = DateTime.Today.AddDays(5).ToShortDateString();
lbd4.Text = DateTime.Today.AddDays(6).ToShortDateString();
lbd5.Text = DateTime.Today.AddDays(7).ToShortDateString();
lbd6.Text = DateTime.Today.AddDays(8).ToShortDateString();
cal.Visible = false;
}