Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Master page / content Page / standard button.

Reply
Thread Tools

Master page / content Page / standard button.

 
 
Francois
Guest
Posts: n/a
 
      09-24-2007
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.




 
Reply With Quote
 
 
 
 
Elroyskimms
Guest
Posts: n/a
 
      09-24-2007
On Sep 24, 1:00 pm, "Francois" <francois@corebridgecom> wrote:
> 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

 
Reply With Quote
 
 
 
 
Francois
Guest
Posts: n/a
 
      09-24-2007
This http://www.dotnet-news.com/lien.aspx?ID=25702 is what I was looking
after.

Thanks.

"Elroyskimms" <(E-Mail Removed)> a écrit dans le message de news:
(E-Mail Removed) om...
On Sep 24, 1:00 pm, "Francois" <francois@corebridgecom> wrote:
> 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


 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      09-24-2007
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)

Francois wrote:
> 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.
>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error: Only Content controls are allowed directly in a content page that contains Content controls. hazz ASP .Net 6 06-09-2010 01:54 PM
Missing Content Placeholder in nested master content page John ASP .Net 2 01-15-2008 11:48 AM
Master-Content in Asp.net - How to set individual Head for each content page Rolf Welskes ASP .Net 7 08-22-2006 02:47 PM
limit on number of content placeholders(which are editable in content pages) in master page nemesis.saurabh@gmail.com ASP .Net 0 05-25-2006 04:44 AM
seeking servlet "Master" keep getting "Master/servlet/Master" not found. Tomcat 5.0.25 Doug McCann Java 1 08-05-2004 09:16 PM



Advertisments