我正在尝试调用一个函数来更改<p>
标签的内容,这似乎没有被调用,谢谢。
我检查了所有标记是否都带有runat="server"
,并确保函数名称正确。
using System;
using System.Collections.Generic;
using System.Linq;
using system.web;
using system.web.UI;
using system.web.UI.WebControls;
namespace StepFollowingDemo
{
public partial class Test1 : system.web.UI.Page
{
protected void Page_Load(object sender,EventArgs e)
{
void Yeah()
{
string Some = Something.Value;
this.Result.InnerHtml = Some;
}
}
}
}
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Test1.aspx.cs" Inherits="StepFollowingDemo.Test1" %>
测试用例
<label runat="server" for="Something">Type:</label>
<input runat="server" type="Text" class="from-control" id="Something"/>
<button runat="server" type="button" onclick="Yeah();" class="btn btn-success">Project your words</button>
<br /><br />
<label runat="server" for="Result">Output: </label>
<p runat="server" id="Result"></p>