FORM TAG Problem.

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.
 
G

Guest

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.
 
L

LamSoft

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)
 
G

Guest

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();");
 
L

LamSoft

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();");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top