Results 1 to 2 of 2

Thread: Accessing the form control from a master page

  1. #1
    Addicted Member
    Join Date
    Jun 09
    Posts
    223

    Accessing the form control from a master page

    I have a master page, sub master page and content page.

    The master page has a form control which both masters can access by name alone:

    Code:
        <form id="form1" runat="server">
    The content page contains a contact form, with the form tags removed as they conflict with the form tags on the master.

    What I want to do now is access form1 on the content page so I can change its properties for use in the contact form. I'm not sure if this is how its done in ASP? Anyway, here's how I've tried to:

    Code:
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim f As Control = CType(Master.FindControl("form1"), Control)
            f.Action = Request.Url.ToString()
            f.Name = "contactForm"
            f.Method = IsPostBack
        End Sub
    If someone can advise me please that would be great as I've been on this for ages.

    Thanks!

    Garry

  2. #2
    Addicted Member
    Join Date
    Jun 09
    Posts
    223

    Re: Accessing the form control from a master page

    bump up

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •