I have a .aspx file with:
<%@ Page Language="C#" AutoEventWireup="true" Inherits="baa.foo" CodeFile="foo.aspx.cs" %>
<input runat="server" id="name" name="name" />
and foo.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace baa
{
public partial class foo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string s = name.Text;
}
}
How do I to name HTML control be know by foo class in .cs file? it returns an error:
Error 61 The name 'name' does not exist in the current context
NOTE: The HTML was not written by me. I'm editing .html pages to .aspx ones to make them dymically and I be able to get values from them by using C# code
<input runat='server'/>must be placed in side the<form runat='server'>.