473,385 Members | 1,472 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Master page / content Page / standard button.

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.


Sep 24 '07 #1
3 2037
On Sep 24, 1:00 pm, "Francois" <francois@corebridgecomwrote:
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

Sep 24 '07 #2
This http://www.dotnet-news.com/lien.aspx?ID=25702 is what I was looking
after.

Thanks.

"Elroyskimms" <el*********@yahoo.coma écrit dans le message de news:
11**********************@w3g2000hsg.googlegroups.c om...
On Sep 24, 1:00 pm, "Francois" <francois@corebridgecomwrote:
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
Sep 24 '07 #3
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.

Sep 24 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: ivanpais | last post by:
Hi, I have a Web User Control, Lets say "Foo.ascx", that contains a button "btnFoo". I have a Master Page "Bar.master", that has a label "lblBar". This label is exposed by a public property...
17
by: Rob R. Ainscough | last post by:
Again another simple concept that appears NOT to be intuitive or I'm just stupid. I've read the WROX book and the example doesn't actually show how the .master page links in the other content...
2
by: Paul | last post by:
Hello: I am struggling with something that would seem to be very easy. I am using a master page. On the content page (which includes the master page), I have a form with a submit input type...
8
by: JT | last post by:
Hi, I have done a fair amount of style editing inline in ASP. I'm now using VS 2005 with a standard web project (not Web Application Project). This is my first foray into CSS in a style sheet...
2
by: =?Utf-8?B?QmlnSm9obg==?= | last post by:
We can set the default button and focus field in ASP.Net 2.0 on the Form tag. My form tag is in the Master page, but the controls are in containers. I read through a few articles which did not...
2
by: Stratum | last post by:
It's an old question, and I apologize for raising it again. I use ImageButton objects on my ASP.Net master page to navigate to content pages. For each button, I have two images. One image shows...
6
by: anthonykallay | last post by:
Hi there, I dont this this a bug but i cant get my head around it.. I have a master page that has a login control on it, to log in i press the button and the page posts back, however on the page...
0
by: dixonjm | last post by:
Hi, I have a master page & various pages that will use this master page. Each content page will have a CSS & JS file which will be named the same as the content page. When I try to load the CSS...
1
by: sudip2008 | last post by:
When using the Calendar Popup in a content page of a masterpage the strForName is always set to aspnetForm This breaks this line from working properly window.opener.document.forms...... How can...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.