By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,583 Members | 594 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,583 IT Pros & Developers. It's quick & easy.

Link Button Menu, Master page

P: n/a
On my master page i have build 5 link buttons. First Page I receive ID
and set the ID in master page Property so i can do the work with it.
How ever when i clicked to second button i lose this ID.
How would i keep this ID thru these 5 pages. so i wont lose this ID..

Master.page
link1 link2 link3,
public string AppID
{
get { return Label1.Text; }
set { Label1.Text = value;}
}
page1.aspx
Response.write(Master.AppID); // I have the ID to work with it..
MyFunc(Master.AppID);
page2.aspx
When i click on link2 on master page, i come page2 and i dont have
this
Master.AppID
even though i have
<%@ MasterType virtualpath="~/MyMaster.master" %referance on aspx
page...

How can i carry out this ID thru all the link click..

Apr 7 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
You should store the ID in session.

Me.Session.Add(), etc.

If this is unacceptable for some reason and you never leave the page then
you can look at using ViewState.

Me.ViewState.Add(), etc.

Let me know if this helps.

--
~~~~~~~~~~~
Ben Rush
http://www.ben-rush.net/blog
"Matt" <me*******@Hotmail.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
On my master page i have build 5 link buttons. First Page I receive ID
and set the ID in master page Property so i can do the work with it.
How ever when i clicked to second button i lose this ID.
How would i keep this ID thru these 5 pages. so i wont lose this ID..

Master.page
link1 link2 link3,
public string AppID
{
get { return Label1.Text; }
set { Label1.Text = value;}
}
page1.aspx
Response.write(Master.AppID); // I have the ID to work with it..
MyFunc(Master.AppID);
page2.aspx
When i click on link2 on master page, i come page2 and i dont have
this
Master.AppID
even though i have
<%@ MasterType virtualpath="~/MyMaster.master" %referance on aspx
page...

How can i carry out this ID thru all the link click..

Apr 7 '07 #2

P: n/a
They might move the application on farm later so i did not wanted deal
with session or cookies.
Though i will try view state.. Thanks for that.
I am confuse that i cant receive the master page property on second
page / link
Master.AppID is getting me the value though i have it available on
intellisense

Would there be a better design or solution for this..
Create 5 link/job page. Do the jobs on those pages for that ID..
Apr 7 '07 #3

P: n/a
On Apr 7, 2:44 am, "Matt" <meteha...@Hotmail.comwrote:
They might move the application on farm later so i did not wanted deal
with session or cookies.
Though i will try view state.. Thanks for that.
I am confuse that i cant receive the master page property on second
page / link
Master.AppID is getting me the value though i have it available on
intellisense

Would there be a better design or solution for this..
Create 5 link/job page. Do the jobs on those pages for that ID..

Since this is second link second page, I dont have the ViewState
information on second page
view state is no good

Apr 7 '07 #4

P: n/a
Okay, well, I can only assume I'm following what's going on/what you're
trying to do.

Remember that pages are rebuilt each time by the ASP.Net runtime you make a
page request - that means that if you go to another page, even if it uses
the "same" master page, it's really a completely seperate instance of that
master page class - so you're really doing no good by setting property
values on that class because the second time everything will have been
recreated for you by scratch.

I haven't done much server farm development so someone else might offer a
better solution, but maybe store something in your query string?

Again, I'm not totally following every inch of what your'e trying to do. I'm
not as good when the code isn't right in front of me....

--
~~~~~~~~~~~
Ben Rush
http://www.ben-rush.net/blog
"Matt" <me*******@Hotmail.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
On Apr 7, 2:44 am, "Matt" <meteha...@Hotmail.comwrote:
>They might move the application on farm later so i did not wanted deal
with session or cookies.
Though i will try view state.. Thanks for that.
I am confuse that i cant receive the master page property on second
page / link
Master.AppID is getting me the value though i have it available on
intellisense

Would there be a better design or solution for this..
Create 5 link/job page. Do the jobs on those pages for that ID..


Since this is second link second page, I dont have the ViewState
information on second page
view state is no good

Apr 7 '07 #5

P: n/a
On Apr 7, 3:02 am, "Ben Rush" <kwen...@yahoo.comwrote:
Okay, well, I can only assume I'm following what's going on/what you're
trying to do.

Remember that pages are rebuilt each time by the ASP.Net runtime you make apagerequest - that means that if you go to anotherpage, even if it uses
the "same"masterpage, it's really a completely seperate instance of thatmasterpageclass - so you're really doing no good by setting property
values on that class because the second time everything will have been
recreated for you by scratch.

I haven't done much server farm development so someone else might offer a
better solution, but maybe store something in your query string?

Again, I'm not totally following every inch of what your'e trying to do. I'm
not as good when the code isn't right in front of me....

--
~~~~~~~~~~~
Ben Rushhttp://www.ben-rush.net/blog

"Matt" <meteha...@Hotmail.comwrote in message

news:11**********************@q75g2000hsh.googlegr oups.com...
On Apr 7, 2:44 am, "Matt" <meteha...@Hotmail.comwrote:
They might move the application on farm later so i did not wanted deal
with session or cookies.
Though i will try view state.. Thanks for that.
I am confuse that i cant receive themasterpageproperty on second
page/link
Master.AppID is getting me the value though i have it available on
intellisense
Would there be a better design or solution for this..
Create 5link/jobpage. Do the jobs on those pages for that ID..
Since this is secondlink secondpage, I dont have the ViewState
information on secondpage
view state is no good- Hide quoted text -

- Show quoted text -
Appricate the help. I try to keep it in xml and carry it over the
request. Since i have been asked to hide the query sting..

Apr 7 '07 #6

P: n/a
// Submit this search term to google...
profile overview site:msdn2.microsoft.com

--
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
"Matt" <me*******@Hotmail.comwrote in message
news:11*********************@y80g2000hsf.googlegro ups.com...
On Apr 7, 3:02 am, "Ben Rush" <kwen...@yahoo.comwrote:
>Okay, well, I can only assume I'm following what's going on/what you're
trying to do.

Remember that pages are rebuilt each time by the ASP.Net runtime you make
apagerequest - that means that if you go to anotherpage, even if it uses
the "same"masterpage, it's really a completely seperate instance of
thatmasterpageclass - so you're really doing no good by setting property
values on that class because the second time everything will have been
recreated for you by scratch.

I haven't done much server farm development so someone else might offer a
better solution, but maybe store something in your query string?

Again, I'm not totally following every inch of what your'e trying to do.
I'm
not as good when the code isn't right in front of me....

--
~~~~~~~~~~~
Ben Rushhttp://www.ben-rush.net/blog

"Matt" <meteha...@Hotmail.comwrote in message

news:11**********************@q75g2000hsh.googleg roups.com...
On Apr 7, 2:44 am, "Matt" <meteha...@Hotmail.comwrote:
They might move the application on farm later so i did not wanted deal
with session or cookies.
Though i will try view state.. Thanks for that.
I am confuse that i cant receive themasterpageproperty on second
page/link
Master.AppID is getting me the value though i have it available on
intellisense
>Would there be a better design or solution for this..
Create 5link/jobpage. Do the jobs on those pages for that ID..
Since this is secondlink secondpage, I dont have the ViewState
information on secondpage
view state is no good- Hide quoted text -

- Show quoted text -

Appricate the help. I try to keep it in xml and carry it over the
request. Since i have been asked to hide the query sting..

Apr 7 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.