DNKROZ
DNKROZ

Reputation: 2852

Href to an element in another page

As alternative to this question

I have a link in my page.Master, i would like to link the href attribute to an element which is contained in another page (Main.aspx)

<li><a href="#modal" id="login">Login</a></li>

The code above works if the modal element is placed within the master page, however the modal being in the master page causes problems. I have now placed the modal in a different page, can i still call it to be opened from the master page?

I have tried -

<li><a href="Main.aspx/#modal" id="login">Login</a></li>

However this does not work

or is this not possible?

Upvotes: 0

Views: 869

Answers (1)

Lambda
Lambda

Reputation: 1660

Can I assume than the main.aspx is a child page of you master page? If so

As a general Concept you can pass data from Child to master because child code executed before the master code. What I normally do is set a session value

within the child load section:

session("send2Master") = "data to be sent;

and collect it in the master within the Master load section.

string dataInMaster = session("send2Master").tostring();
session.remove("send2Master");

If your data is only available on child postback event, you can still send data to the master in the prerender master event. once your data is in the master code you can use it in any control in the master. As this is a hyperlink it is even simpler as there is no worries about data being available for postback event in master.

Upvotes: 1

Related Questions