Link Button Menu, Master page

M

Matt

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..
 
B

Ben Rush

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.
 
M

Matt

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..
 
M

Matt

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
 
B

Ben Rush

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....
 
M

Matt

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







- 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..
 
9

9-11 Was An Inside Job

// Submit this search term to google...
profile overview site:msdn2.microsoft.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

Top