user1580562
user1580562

Reputation: 3

How to pass hidden field value from asp page to another in anchor tag

I have tried passing the hidden field value using href. Below is the code snippet for the same and it is not working. I do not want to use java script function as I want this to work in a particular scenario when java script is disabled by the user. Value of the variable is set in code behind

<form name ="hiddenform" method="get" action="a1.asp">
<input type="hidden" id="hasflash" value=" " />

<div class="header" id="check" style="color: red;">
please <a href="a1.asp?hasflash"+<%=hasflash.Value%>>upgrade your add-on software</a>
</div>

I have also tried the below code:

<div class="header" id="check" style="color: red;">
please <a href=("a1.asp?hasflash={0}",hasflash.Value)>upgrade your add-on software</a>
</div>

Upvotes: 0

Views: 6552

Answers (2)

codingbiz
codingbiz

Reputation: 26386

First you need to add runat="server" to your hidden field

<input type="hidden" runat="server" id="hasflash" Value="SomeValues" />

Then you can achieve that in 2 or more ways

please <a href="a1.asp?hasflash=<%=hasflash.Value %>">upgrade your add-on software</a>

or

please <a href='<%= String.Format("a1.asp?hasflash={0}",hasflash.Value) %>'>upgrade your add-on software</a>

Upvotes: 0

nashuald
nashuald

Reputation: 825

Try

<div class="header" id="check" style="color: red;">
     please <a href="a1.asp?hasflash=<%=hasflash.Value%>">upgrade your add-on software</a>
</div>

Upvotes: 1

Related Questions