PC Review


Reply
Thread Tools Rate Thread

C# within HTML

 
 
Mike P
Guest
Posts: n/a
 
      17th Jun 2008
I have a HTML menu that I want to add some C# code around which will
include a variable declaration and an if statement. How do I add this
code within my HTML?

*If statement here, if true then show div
<div id="idButton3" class="otherLeftBarLink" onmouseover="javascript:
changeStylesMouseOver('3');" onmouseout="javascript:
changeStylesMouseOut('3');" onclick="location='/AllProjects.aspx'">
<div class="leftBarLinkText">
All Projects
</div>
</div>
*If statement here, if true then show div
<div id="idButton4" class="otherLeftBarLink"
onmouseover="javascript: changeStylesMouseOver('4');"
onmouseout="javascript: changeStylesMouseOut('4');"
onclick="location='/MyProjects.aspx'">
<div class="leftBarLinkText">
My Projects
</div>
</div>



*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
clintonG
Guest
Posts: n/a
 
      17th Jun 2008
There are several approaches but for you perhaps the easiest to understand
and implement could be the following:

<div id="idButton3" runat="server"
style="visibility:hidden">
....
</div>
<div id="idButton4" runat="server"
style="visibility:hidden">
....
</div>

You are telling the compiled each div is now an HTML Control. By default
each control is not visible at runtime. In code you are going to determine
which control should be visible and displayed. The source for each div will
remain visible in the HTML but only one HTML control will be displayed and
active on the UI at runtime...

// Your C# code...
#region Task: Determine display of idButtons...
HtmlGenericControl button3 =
FindControl("idButton3") as HtmlGenericControl;
HtmlGenericControl button4 =
FindControl("idButton4") as HtmlGenericControl;

// determine which to make visible
if(some condition is true)
{
button3.Visible = true;
}
else
{
button4.Visible = true;
}
#endregion

<%= Clinton Gallagher

"Mike P" <(E-Mail Removed)> wrote in message
news:ufL$(E-Mail Removed)...
>I have a HTML menu that I want to add some C# code around which will
> include a variable declaration and an if statement. How do I add this
> code within my HTML?
>
> *If statement here, if true then show div
> <div id="idButton3" class="otherLeftBarLink" onmouseover="javascript:
> changeStylesMouseOver('3');" onmouseout="javascript:
> changeStylesMouseOut('3');" onclick="location='/AllProjects.aspx'">
> <div class="leftBarLinkText">
> All Projects
> </div>
> </div>
> *If statement here, if true then show div
> <div id="idButton4" class="otherLeftBarLink"
> onmouseover="javascript: changeStylesMouseOver('4');"
> onmouseout="javascript: changeStylesMouseOut('4');"
> onclick="location='/MyProjects.aspx'">
> <div class="leftBarLinkText">
> My Projects
> </div>
> </div>
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***


 
Reply With Quote
 
Peter Morris
Guest
Posts: n/a
 
      17th Jun 2008
You should ask this question the ASP.NET group.



--
Pete
=========================================
I use Enterprise Core Objects (Domain driven design)
http://www.capableobjects.com/
=========================================


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2003 - copy from html email to calendar shows html tags Bob Murdoch Microsoft Outlook Discussion 0 12th Mar 2010 02:58 PM
Howto Listen html link clicks and change them in STATIC HTML pages..... Aykut Canturk Microsoft ASP .NET 2 4th Jun 2008 12:31 PM
Find feature does not work with HTML messages (Content-type: text/html) Bill Renaud Microsoft Outlook 0 17th Aug 2004 11:18 PM
HTML/XML format for Excel 2000. Multiple sheets in single HTML file xargon Microsoft Excel Misc 0 25th Feb 2004 09:34 AM
How to send an html message with inline images and text for non html mail clients? John Sutter Microsoft ASP .NET 0 13th Jan 2004 08:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:40 PM.