...

View Full Version : Passing variables, then using them to select code in a IF statement...



robuc
01-17-2012, 05:39 AM
Hi all, i need some help with something i have done in Coldfusion before but i have no clue how to do it in ASP.NET, i would like to do the following:

1. i would like to sent a "variable" from a "link" i.e.
**********************************************
<div id="pro_top_nav">
<ul>
<li><a id="P1" href="presentations/" runat="server">Presentations</a></li>
<li><a id="P2" href="proposals/default.aspx?" runat="server">Proposals</a></li>
<li><a id="P3" href="postings/" runat="server">Postings</a></li>
<li><a href="myaccount/" class="current">My Account</a></li>
</ul>
</div>
***********************************************

2. then, i would like to use that "variable" (P1, P2 or P3) with an IF, ELSE or ELSE IF statement to cycle throught FOUR (4) possible out comes to be displayed in the BODY of an ASP.NET page.

i.e.:
*************************************
if (something == P1)

{
show this only
}
else if (something else == P2)
{
show this only
}
else if (something else == P3)
{
show this only
}
else ()
{
just show this
}
************************************

3. something like that.... in short, i woould like to pass a variable from a selected link THEN, use that variable to display some code in a IF statement. everything will be on the page in the BODY of the page.

Thanks.:D

alykins
01-17-2012, 02:50 PM
this should help you with sending arguments ref (http://stackoverflow.com/questions/830152/asp-net-how-to-use-eventargs-for-parameter-passing-on-button-onclick)

this should help you with panels ref (http://www.dotnetjohn.com/articles.aspx?articleid=33)

the answer to this (http://stackoverflow.com/questions/2896467/asp-net-object-visibility) question should help you with the .visible property in your code behind- post back any more Q's or if you don't understand

robuc
01-18-2012, 03:46 AM
this should help you with sending arguments ref (http://stackoverflow.com/questions/830152/asp-net-how-to-use-eventargs-for-parameter-passing-on-button-onclick)

this should help you with panels ref (http://www.dotnetjohn.com/articles.aspx?articleid=33)

the answer to this (http://stackoverflow.com/questions/2896467/asp-net-object-visibility) question should help you with the .visible property in your code behind- post back any more Q's or if you don't understand

Thanks! Alykins, i will check it out asap.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum