error "A form tag with runat=server must exist" but there is a form tag!!
- From: "André" <ssdqs@xxxxxx>
- Date: Sun, 22 Jun 2008 22:34:30 +0200
Hi,
i get sometimes an very unexpected error:
"A form tag with runat=server must exist on the Page to use SetFocus() or
the Focus property"
at line: If j = 1 Then txta(i).Focus()
There is a form tag as you can see in the aspx file. Is there any other
reason for this error?
Thanks for help
André
The aspx code is this:
<%@ Page Language="VB" MaintainScrollPositionOnPostback="true"
AutoEventWireup="false" CodeFile="~/myfile.aspx.vb" Inherits="myfile" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server"><title>Untitled Page</title></head>
<body>
<form id="form1" runat="server">
<div style="text-align: center">
<asp:Label ID="Label1" runat="server" ></asp:Label>
</div>
<div style="text-align: center">
<asp:Label ID="Label1" runat="server" Font-Bold="True"></asp:Label>
</div>
</form>
</body>
</html>
The code-behind:
Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.PreInit
........
txta(i) = New TextBox
txta(i).TextMode = TextBoxMode.MultiLine
frm.Controls.Add(txta(i))
If j = 1 Then txta(i).Focus()
........
.
- Follow-Ups:
- RE: error "A form tag with runat=server must exist" but there is a for
- From: Milosz Skalecki [MCAD]
- RE: error "A form tag with runat=server must exist" but there is a for
- Prev by Date: Silverlight question
- Next by Date: Re: Asp.net Questions-Answers
- Previous by thread: Silverlight question
- Next by thread: RE: error "A form tag with runat=server must exist" but there is a for
- Index(es):
Relevant Pages
|