Master page / content Page / standard button.

F

Francois

I plan a master page / content page design for next application.

The master page would contain some standard button for my app. For instance
a "Save" button. (present on all pages).

But how can I call code in the content.cs page from the Save_Click in the
master.cs page ?


Thanks.

François.
 
E

Elroyskimms

I plan a master page / content page design for next application.

The master page would contain some standard button for my app. For instance
a "Save" button. (present on all pages).

But how can I call code in the content.cs page from the Save_Click in the
master.cs page ?

Thanks.

François.

I work in VB so you'll have to find the C# equivalent but I think this
should work for you...

In the master.cs code Save_Click event handler, you should be able to
access controls in the content.cs file by:
me.findcontrol("MyControlName")

So, if the content to be saved is in a textbox, you should try (in
your master.cs file):

dim ContentTextBox as system.web.ui.webcontrols.textbox =
ctype(me.findcontrol("MyTextBox"), system.web.ui.webcontrols.textbox)

Now you should be able to access the contents of textbox using the
ContentTextBox.text

I'm also new to Master Pages so this may not be 100% accurate. If it
doesn't work, let me know.

-E
 
F

Francois

This http://www.dotnet-news.com/lien.aspx?ID=25702 is what I was looking
after.

Thanks.

"Elroyskimms" <[email protected]> a écrit dans le message de
(e-mail address removed)...
I plan a master page / content page design for next application.

The master page would contain some standard button for my app. For
instance
a "Save" button. (present on all pages).

But how can I call code in the content.cs page from the Save_Click in
the
master.cs page ?

Thanks.

François.

I work in VB so you'll have to find the C# equivalent but I think this
should work for you...

In the master.cs code Save_Click event handler, you should be able to
access controls in the content.cs file by:
me.findcontrol("MyControlName")

So, if the content to be saved is in a textbox, you should try (in
your master.cs file):

dim ContentTextBox as system.web.ui.webcontrols.textbox =
ctype(me.findcontrol("MyTextBox"), system.web.ui.webcontrols.textbox)

Now you should be able to access the contents of textbox using the
ContentTextBox.text

I'm also new to Master Pages so this may not be 100% accurate. If it
doesn't work, let me know.

-E
 
B

bruce barker

the first thing to understand is that the master page is a control on
the content web page (not the other way around).

this means the master page can expose properties, methods and events
that the content page can use.

-- bruce (sqlwork.com)
 

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,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top