Reputation: 2207
Hi all I have this code in code behind
//a == the viewing month
//b == the x or 1 which will be use to add or subtract depending on the action
//c == the previous month
//d == the next month
int a = int.Parse(actual.Text);
int b = int.Parse("1");
int c;
int d;
c = a - b; //This provides the previous month for the link
d = a + b; //This provides the next month for the link
Now on page load I want to pull the values for "c" and "d" into an anchor in my .aspx page. I've try numerous things but i can't get it right, is this even possible? if so how?
Thank you
Upvotes: 0
Views: 1533
Reputation: 2194
You can add it on a label or textbox:
On Pageload
Label1.Text = c;
Upvotes: 0
Reputation: 1393
If you want to use the numbers in the page you have to declare them as protected and make sure they are declared on the page not in your method. You can calculate them on page load or inside of the events called by the different controls you might have in your page.
Than in your .aspx page you can use
<%=c.ToString() %>
<%=d.ToString() %>
Upvotes: 4