Click here to Skip to main content
15,893,486 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionRetrieving ViewState value across Page events Pin
tjkota3-Apr-07 13:43
tjkota3-Apr-07 13:43 
AnswerRe: Retrieving ViewState value across Page events Pin
N a v a n e e t h3-Apr-07 17:20
N a v a n e e t h3-Apr-07 17:20 
QuestionAssembly problem Pin
DanB19833-Apr-07 10:21
DanB19833-Apr-07 10:21 
Questionmanage session Pin
ASPDevelopper12348753-Apr-07 7:52
ASPDevelopper12348753-Apr-07 7:52 
AnswerRe: manage session Pin
ToddHileHoffer3-Apr-07 8:01
ToddHileHoffer3-Apr-07 8:01 
GeneralRe: manage session Pin
ASPDevelopper12348753-Apr-07 8:27
ASPDevelopper12348753-Apr-07 8:27 
QuestionEdit <head> in page with code behind file Pin
Alice@mywonderland3-Apr-07 7:08
Alice@mywonderland3-Apr-07 7:08 
AnswerRe: Edit <head> in page with code behind file Pin
kubben3-Apr-07 7:43
kubben3-Apr-07 7:43 
Yes. There is a Page variable that has a Header object.

Here is a sample from MS help:

Visual Basic
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    
    Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        
        ' Create a Style object for the body of the page.
        Dim bodyStyle As New Style()
        
        bodyStyle.ForeColor = System.Drawing.Color.Blue
        bodyStyle.BackColor = System.Drawing.Color.LightGray
                    
        ' Add the style to the header of the current page. 
        Page.Header.StyleSheet.CreateStyleRule(bodyStyle, Nothing, "BODY")
            
        ' Add the page title to the header element.
        Page.Header.Title = "HtmlHead Example"

    End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >

<head id="head1"
      runat="server">
      <title>To be replaced.</title>
</head>

<body>
  <form id="Form1" runat="server">
  
  <h3>HtmlHead Class Example </h3>  
    
  <asp:label id="Label1" 
    text = "View the HTML source code of this page to see the title 
            and body style added to the header element."
    runat="server">
  </asp:label>   
    
  </form>
</body>
</html>


C#
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">  
  
  protected void Page_Load(object sender, System.EventArgs e)
  {
      
      // Create a Style object for the body of the page.
      Style bodyStyle = new Style();

      bodyStyle.ForeColor = System.Drawing.Color.Blue;
      bodyStyle.BackColor = System.Drawing.Color.LightGray;

      // Add the style to the header of the current page.
      Page.Header.StyleSheet.CreateStyleRule(bodyStyle, null, "BODY");
 
      // Add the page title to the header element.
      Page.Header.Title = "HtmlHead Example"; 
                   
  }
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >

<head id="head1"
      runat="server">
      <title>To be replaced.</title>
</head>

<body>
  <form runat="server">
  
  <h3>HtmlHead Class Example</h3>  
    
  <asp:label id="Label1" 
    text = "View the HTML source code of this page to see the title 
            and body style added to the header element."
    runat="server">
  </asp:label>   
    
  </form>
</body>
</html>


Hope that helps.
Ben
AnswerRe: Edit &lt;head> in page with code behind file - Thanks Pin
Alice@mywonderland3-Apr-07 22:52
Alice@mywonderland3-Apr-07 22:52 
QuestionASP.Net from Scratch Pin
xbiplav3-Apr-07 6:25
xbiplav3-Apr-07 6:25 
AnswerRe: ASP.Net from Scratch Pin
MinhajuddinK3-Apr-07 7:10
MinhajuddinK3-Apr-07 7:10 
QuestionPage-wide state with Master pages? Pin
Tom Welch3-Apr-07 6:11
Tom Welch3-Apr-07 6:11 
AnswerRe: Page-wide state with Master pages? Pin
ToddHileHoffer3-Apr-07 7:58
ToddHileHoffer3-Apr-07 7:58 
GeneralRe: Page-wide state with Master pages? Pin
Tom Welch3-Apr-07 11:05
Tom Welch3-Apr-07 11:05 
Questionprinting a code behind textbox text value Pin
indian1433-Apr-07 5:53
indian1433-Apr-07 5:53 
QuestionPLease help getting error as The process cannot access the file 'D:\Inventracksys\Inventorytracking Vendorwisereport_1.emf' because it is being used by another process Pin
mohd imran abdul aziz3-Apr-07 4:33
mohd imran abdul aziz3-Apr-07 4:33 
Questiondate range search Pin
Kunal P3-Apr-07 4:24
Kunal P3-Apr-07 4:24 
QuestionRun time access Pin
viveknair203-Apr-07 4:02
viveknair203-Apr-07 4:02 
AnswerRe: Run time access Pin
Jaiprakash M Bankolli3-Apr-07 4:21
Jaiprakash M Bankolli3-Apr-07 4:21 
Questionsending a message Pin
Oga M3-Apr-07 3:53
Oga M3-Apr-07 3:53 
QuestionDynamically created button holding relevant data Pin
joon vh.3-Apr-07 3:52
joon vh.3-Apr-07 3:52 
AnswerRe: Dynamically created button holding relevant data Pin
Venkatesh Mookkan3-Apr-07 19:07
Venkatesh Mookkan3-Apr-07 19:07 
Question2 connect compare validator wit database [modified] Pin
mvj_asp3-Apr-07 2:22
mvj_asp3-Apr-07 2:22 
AnswerRe: 2 connect compare validator wit database Pin
Not Active3-Apr-07 3:36
mentorNot Active3-Apr-07 3:36 
Questionpop up blocker Pin
harsh_c3-Apr-07 2:13
professionalharsh_c3-Apr-07 2:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.