The ASP.NET automatically "connects" member variable of your class to
instances of the object that represent that HTML field (with runat=server
set).
So if you have a member variable
protected HtmlInputHidden myVariable;
and in your HTML you have
<input type="hidden" id="myVariable" runat=server>
then ASP.NET will automatically create an object with type HtmlInputHidden
and assign it to variable myVariable. And it will represent the HTML code
<input type....>
So if you have in BasePage class defined hidden variable (it must be
declared as protected) myVariable you must have corresponding HTML
<input type="hidden" id="myVariable" runat=server>
in the HTML of WebForm1 and WebForm2
George.
"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:F4**********************************@microsof t.com...
Hi George,
Please see below.
--
Joe
"George Ter-Saakov" wrote:
Your question is not clear.
Let em rephrase my question: how do I reference a control in a parent form
from within the child form if child form inherits parent form?
It should work as you described it.
If BasePage.aspx defines
protected HiddenField f;
I've got this.
you should be able to reference it in the WebForm1 and WebForm2.
the only thing is that you must have in both pages in HTML the hidden
field
with id=f;
I don't understand this. Would you please re-explain?
PS: you might look at RegisterHiddenField method of the page to
automaticly
insert hidden field into HTML.
I will look at this.
George
"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:5C**********************************@microsof t.com... > Hello All:
>
> I have two webforms (WebForm1.aspx and WebForm2.aspx) that inherit from
> a
> base class called BasePage.aspx. BasePage.aspx has no user interface
> but
> inherits System.Web.UI.Page (BasePage performs security checks in the
> Page_Load ... Handles MyBase.Load event). BasePage also has a hidden
> field
> (hdnSessionId) that I want to use to cache a sessionId (client
> requirement).
> I can not use Session, ViewState or QueryString to cache this value
> (client
> requirement).
>
> Here's my question: How do I reference hdnSessionId from within
> WebForm1.aspx and WebForm2.aspx? I'm pretty sure that I can do this.
> hdnSessionId is in WebFrom1's parent class.
>
> I'm sure that this is somewhat straightforward. I'm also sure that it
> involves the MyBase.Controls collection. I'm just not sure how to
> proceed
> when drilling upward in lieu of drilling downward when looking for a
> control.
>
> Any help would be appreciated.
>
> TIA,
> --
> Joe