FORM TAG Problem.

  • Thread starter Thread starter LamSoft
  • Start date Start date
L

LamSoft

I've got some problem on some form submit problem.

In a master page, there is a form tag with the "runat=server" attribute, and
a ID called "myForm".

In the contentPlaceHolder under that master page, I cannot create another
form tag with "runat=server" attribute as ASP.NET does not allow two FORM
Server tag in the same page.

The problem now is in the contentPlaceHolder, how to control the "submit"
property of the form tag in the master page.
Thank you.
 
Use the Master property of the page (returns a ref to the master page used by
the current page) and then FindControl on the MasterPage ref to find the form.

Hope this is what you are looking for.
 
Sorry , I don't understand

I try to use FindControl to find the form, but ... how to write
(Form)Page.FindControl("myForm").onSubmit="abc" gives me no success, the VS
underlined the (Form) and (onsubmit)
 
Try the following code in the Page_Load event of the .aspx page which uses a
master page:

MasterPage mp = this.Master;
HtmlForm form = mp.FindControl ("myForm");
form.Attributes.Add ("onSubmit", "abc();");
 
Thank you very much.
Siva M said:
Try the following code in the Page_Load event of the .aspx page which uses
a
master page:

MasterPage mp = this.Master;
HtmlForm form = mp.FindControl ("myForm");
form.Attributes.Add ("onSubmit", "abc();");
 
Back
Top