How to show advert titles Show Ad "title"

Last post 05-12-2008 6:06 AM by roymartian. 17 replies.

Sort Posts:

  • How to show advert titles Show Ad "title"

    05-08-2008, 7:17 AM

    Hi Guys,

    I would like to show adverts descriptions rather than title "Show Ad" as an example in page text.

    See, http://www.localstar.com.au/ShowAd.aspx?id=41

    Any ideas ?

  • Re: How to show advert titles Show Ad "title"

    05-08-2008, 7:41 AM
    Answer
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 1,520

     protected void Page_Load(object sender, EventArgs e)
        {
            
            if (!IsPostBack)
            {
            if (your condition)
            {            
                Page.Header.Title = "Your Title";
            }       
        }    
        }
        
        in aspx make sure header have runat="server" like <head runat="server">

    Kamran Shahid(MCSD.NET,MCPD.net[web])
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com

    Remember to click "Mark as Answer" on the post that helps U
  • Re: How to show advert titles Show Ad "title"

    05-08-2008, 8:06 AM

    Kamii,

    Thanks for that, can you provide some further information, should I include first code in showad.aspx.vb and then modify showad.aspx for title section.

     Sorry I am a bit green.

     Thanks,

    Roger.

  • Re: How to show advert titles Show Ad "title"

    05-08-2008, 8:20 AM
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 1,520

    Yes

    1 ,In ASPX <head runat="server">

    2, In code behind

    protected void Page_Load(object sender, EventArgs e)
        {
            
            if (!IsPostBack)
            {
            if (your condition)
            {            
                Page.Header.Title = "Your Title";
            }       
        }    
        }

    Kamran Shahid(MCSD.NET,MCPD.net[web])
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com

    Remember to click "Mark as Answer" on the post that helps U
  • Re: How to show advert titles Show Ad "title"

    05-08-2008, 8:38 AM

    Kamii,

     Sorry to labour this mate,

    1. <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" CodeFile="ShowAd.aspx.vb"

    Inherits="ShowAd_aspx" Title="Show Ad" %>

    Should I change to;

    <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" CodeFile="ShowAd.aspx.vb"

    Inherits="ShowAd_aspx" Title=head runat="server" %>

    2. Not sure where to add this as all shown as Protected Sub sections?

     Grateful if you could walk me through sorry.

  • Re: How to show advert titles Show Ad "title"

    05-08-2008, 8:42 AM
    Answer
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 1,520

     you are using master page

    so in your master page do like this

     

    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="AuthenticatedUsers.master.cs"
        Inherits="MasterPages_AuthenticatedUsers" %>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">                

    ....

    <head id="Head1" runat="server">   is the line what you have to change

     

    then  let this be as same

    <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" CodeFile="ShowAd.aspx.vb"

    Inherits="ShowAd_aspx" Title="Or let it empty" %>

     

    now in code behind do as i have mentioned u before 

     

            

     

    Kamran Shahid(MCSD.NET,MCPD.net[web])
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com

    Remember to click "Mark as Answer" on the post that helps U
  • Re: How to show advert titles Show Ad "title"

    05-08-2008, 8:58 AM
    Answer
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 1,520

    VB version of the code is

     

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

        If Not IsPostBack Then
            If YourCondition Then
                Page.Header.Title = "Your Title"
            End If
        End If
    End Sub

    Kamran Shahid(MCSD.NET,MCPD.net[web])
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com

    Remember to click "Mark as Answer" on the post that helps U
  • Re: How to show advert titles Show Ad "title"

    05-08-2008, 4:28 PM
    • Loading...
    • manorfarm
    • Joined on 02-21-2008, 10:45 PM
    • Posts 39

    Hi

    I think it would help if you could expand on the question a little or may be I am missing something

    Thanks

  • Re: How to show advert titles Show Ad "title"

    05-08-2008, 4:50 PM

     

    Thanks Kamii,

    Think I am there now, great help.

  • Re: How to show advert titles Show Ad "title"

    05-09-2008, 2:16 AM
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 1,520

    U R Welcome

    Kamran Shahid(MCSD.NET,MCPD.net[web])
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com

    Remember to click "Mark as Answer" on the post that helps U
  • Re: How to show advert titles Show Ad "title"

    05-10-2008, 12:27 AM

    Kamii,

     Copied in your code pretty good except 1 error I cannot understand or fix,

    Error 1 Name 'YourCondition' is not declared. C:\Users\The Marsden\Desktop\Fatdog\WEB DESIGN\localstar\localstarMASTER\ShowAd.aspx.vb 73 12 C:\...\localstarMASTER\

    Sorry, any ideas?

     Thanks,

    R.

  • Re: How to show advert titles Show Ad "title"

    05-10-2008, 6:39 PM

    Ok, been a bit stupid with the "yourcondition" but not sure which condition to use ?

    Sorry to be an amateur!

  • Re: How to show advert titles Show Ad "title"

    05-11-2008, 2:18 PM
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 1,520

    The check for yourcondition is that for instnace you are checking that there is description available or not you can simply change it to follwoing if there is no condition

    protected void Page_Load(object sender, EventArgs e)
    {        
       if (!IsPostBack)
       {
           Page.Header.Title = "Your Title";
       }    
    }

    Kamran Shahid(MCSD.NET,MCPD.net[web])
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com

    Remember to click "Mark as Answer" on the post that helps U
  • Re: How to show advert titles Show Ad "title"

    05-11-2008, 4:47 PM

    Kamii - thanks,

    There will always be a description, so this should be ok, as a last help, could you post this in VB ?

    Thanks,

    Roger.

  • Re: How to show advert titles Show Ad "title"

    05-12-2008, 2:12 AM
    Answer
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 1,520

     Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
       If (Not IsPostBack) Then
           Page.Header.Title = "Your Title"
       End If
    End Sub

    Kamran Shahid(MCSD.NET,MCPD.net[web])
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com

    Remember to click "Mark as Answer" on the post that helps U
Page 1 of 2 (18 items) 1 2 Next >