Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 简单日期时间程序不显示日期?_C#_Asp.net - Fatal编程技术网

C# 简单日期时间程序不显示日期?

C# 简单日期时间程序不显示日期?,c#,asp.net,C#,Asp.net,我是Asp.NET的新手 我正在尝试使用此程序显示日期: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="inde.aspx.cs" Inherits="WebApplication1.inde" %> <script runat="server"> void Page_Load() { lblServerTime.Text = DateTime.Now.ToStrin

我是Asp.NET的新手

我正在尝试使用此程序显示日期:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="inde.aspx.cs" Inherits="WebApplication1.inde" %>

<script runat="server">

    void Page_Load()
    {
        lblServerTime.Text = DateTime.Now.ToString("hh:mm:yyyy");
    }

</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>First Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    The current date and time is:

    <asp:Label
        id="lblServerTime"
        Runat="server" />

    </div>
    </form>
</body>
</html>
请帮忙


当然,我们会感谢您的帮助

请尝试将页面加载方法放入代码隐藏文件inde.aspx.cs

请尝试将页面加载方法放入代码隐藏文件inde.aspx.cs

请尝试将页面加载方法放入代码隐藏文件inde.aspx.cs

请尝试将页面加载方法放入代码隐藏文件inde.aspx.cs

尝试删除:

CodeBehind=“inde.aspx.cs”继承=“WebApplication1.inde”

它会起作用。

尝试删除:

CodeBehind=“inde.aspx.cs”继承=“WebApplication1.inde”

它会起作用。

尝试删除:

CodeBehind=“inde.aspx.cs”继承=“WebApplication1.inde”

它会起作用。

尝试删除:

CodeBehind=“inde.aspx.cs”继承=“WebApplication1.inde”


它会起作用。

您可以这样做:

<asp:Label ID="lblServerTime" runat="server" ><%= System.DateTime.Now %></asp:Label>

您可以执行以下操作:

<asp:Label ID="lblServerTime" runat="server" ><%= System.DateTime.Now %></asp:Label>

您可以执行以下操作:

<asp:Label ID="lblServerTime" runat="server" ><%= System.DateTime.Now %></asp:Label>

您可以执行以下操作:

<asp:Label ID="lblServerTime" runat="server" ><%= System.DateTime.Now %></asp:Label>