DATE & TIME CONCEPT
² DATE & TIME CONCEPT
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class pagedate : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
// display current date and time
Label1.Text = DateTime.Now.ToString();
// display only date
Label1.Text = DateTime.Now.ToString("dd/MM/yyyy");
// display only month
Label1.Text = DateTime.Now.ToString("MMMM");// if we put (MM) it return numerical value .
//if (MMM) short form of month.if (MMMM)it will print full form.
// how to increase days
Label1.Text = DateTime.Now.AddDays(4).ToString("dd/MM/yyyy");
// how to increase month
Label1.Text = DateTime.Now.AddMonths(3).ToString("MMMM");
// how to increase year
Label1.Text = DateTime.Now.AddYears(3).ToString("yyyy");
// display current time
Label1.Text = DateTime.Now.ToString("hh:mm:ss tt");
}
}
}
Task 1
Input date from the user & check input date if a current date or not
If condition is true then display welcome user mess otherwise display invalid user mess
v Content Management :-
1) Content management is a process of displaying multiple information(content) in a single page.
2) Content management is used with the help of multiview control.
3) Multiview users array property(0).
View1-0
View2-1
View3-2
View4-3
u Property of multiview:-
1. ACTIVEVIEWINDEX=(0)
Prog:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class pagecontent : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
//activate view0
MultiView1.ActiveViewIndex = 0;
}
protected void Button2_Click(object sender, EventArgs e)
{
//activate view1
MultiView1.ActiveViewIndex = 1;
}
protected void Button3_Click(object sender, EventArgs e)
{
//activate view2
MultiView1.ActiveViewIndex = 2;
}
protected void Button4_Click(object sender, EventArgs e)
{
//activate view 3
MultiView1.ActiveViewIndex = 3;
}
}
}
Comments
Post a Comment