I'm trying to select all the text inside an asp:TextBox but it keeps saying:
'TextBox' does not contain a definition for 'SelectAll' and no extension method accepting a first argument of type 'TextBox' could be found (are you missing a using directive or an assembly reference?)
I read that I need Systems.Windows.Forms so I added a reference to it but that didn't work. I don't understand what I'm doing wrong and I've tried searching for answers and nothing.
This is the Default.aspx file:
<%@ 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>
and this is the Default.cs file:
using System;
using System.Windows.Forms;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.SelectAll();
}
}