Click here to Skip to main content
15,894,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
i need to acess the server side variable for my href, at run time i need to passs the content inside variable as the url for the Href tag.
below is my aspx code:

<a id="btnSave" runat="server" href="<%=strAddUrl%> " class="button">Add

in my cs file i declared,
public string strAddUrl;


and at run time ur will be passed to this string.

but iam getting an error BAD URL,pls help me out.
Posted

1 solution

in page load write bellow line
C#
string strAddUrl = "http://www.google.com";
       Session["strAddUrl"] = strAddUrl;


& in aspx page

a href='<%= Session["strAddUrl"].ToString() %>'>Testing
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900