markzzz
markzzz

Reputation: 47995

AcceptButton directive?

Code:

form1.AcceptButton = accessButton;

and I put:

using System.Windows.Forms;

but it doesnt find it. It says System.Web.UI.HtmlControl.HtmlForm doesnt have this definition. Uhm?

Upvotes: 0

Views: 108

Answers (3)

Abdusalam Ben Haj
Abdusalam Ben Haj

Reputation: 5433

Put the controls in a panel and set the DefaultButton :

<asp:Panel DefaultButton="accessButton" runat="server">     
  <asp:TextBox id="myname" runat="server" />
  <asp:Button id="accessButton" Text="Submit" runat="server" />
</asp:Panel>

Upvotes: 1

SysDragon
SysDragon

Reputation: 9888

Use Page.Form.DefaultButton instead.

Upvotes: 1

bash.d
bash.d

Reputation: 13207

System.Windows.Forms and System.Web.UI are two completely distinct systems. Windows Forms are for creating desktop-applications and System.Web.UI is for creating ASP.NET-pages. You can't use WinForms in ASP.NET.

See here on ASP.NET.

Upvotes: 1

Related Questions