0
我想选择一个asp里面所有的文本:文本框,但它口口声声说:TextBox缺少SelectAll()的定义。为什么缺少?
“文本框”不包含“全选”,并没有扩展方法接受一个类型的第一个参数定义“文本框'可以找到(你是否缺少一个使用指令或程序集引用?)
我读到我需要Systems.Windows.Forms,所以我添加了对它的引用,但没有奏效。我不明白我做错了什么,我试着寻找答案,什么也没有。
这是Default.aspx文件:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
,这是Default.cs文件:
using System;
using System.Windows.Forms;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.SelectAll();
}
}