Hi mukesh1,
Please take reference the below code and correct your code.
HTML
Default.aspx
<asp:Label ID="lblMessage" runat="server"></asp:Label>
Code
CS.aspx.cs
[System.Web.Services.WebMethod]
public static string GetCurrentTime()
{
return DateTime.Now.ToString();
}
Default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
lblMessage.Text = GetTime();
}
public string GetTime()
{
return CS.GetCurrentTime();
}
Output
6/13/2018 5:08:53 PM