I'd like clicking on the element to append the hash to the url and then initiate a postback, but I can only get one or the other to happen.
Clicking on the element with an onserverclick attribute initiates the postback, but doesn't append the hash.
<a href="#message" class="anchorButton" onserverclick="BackwardsPost" id="subAnchor" runat="server">Submit</a>
Clicking on the element without the onserverclick attribute causes the hash to be appended to the url, but no postback occurs.
<a href="#message" class="anchorButton" id="subAnchor" runat="server">Submit</a>
My objective is to display another element through the use of the CSS target pseudo selector as soon as the user clicks the element and have that same click initiate a postback. I know JavaScript is the appropriate tool for this task, but it isn't an option.
Here's the element I want to set to visible with the target pseudo selector:
<p class="targetMessage" id="message">Insert text here.</p>
and here are the CSS classes I'm using:
.targetMessage {
display: none;
}
.targetMessage:target {
display: block;
color: red;
}
I've also considered using an html meta element to automatically refresh the page while storing the page's state in session state; causing the page to reload with the message upon the user's click and then refresh automatically a few seconds later to do the actual work, but I'd rather not employ this option.
Your input is appreciated. Thank you!