Master Page and Web User Control Problem

Discussion in 'ASP .Net' started by mazdotnet, May 24, 2006.

  1. mazdotnet

    mazdotnet Guest

    Hi everyone,

    I have placed a simple Web User Control (Response.Write("hello")) on
    my page which uses a Master Page to test this problem that we have.
    Every time I run the web app it displays
    the word "hello" at the top of the Master Page. Why is that? Why
    doesn't it display it where you want it to display it? Isn't a Web User
    Control sort of like place holder?


    Example. Default.aspx contains
    1
    2
    3
    Reference to my Web User Control to display 'hello'

    When I execute it I get
    hello
    1
    2
    3
    Instead of hello appearing at the end.

    Thanks
    MA
     
    mazdotnet, May 24, 2006
    #1
    1. Advertising

  2. Response.write does display at the top - not sure why - possibly something to
    do with compile time.
    Try adding label controls to your page, then setting the Label1.Text
    property from your code behind. This way you can separate your display from
    your code.
    Hope this helps
    Andy

    "mazdotnet" wrote:

    > Hi everyone,
    >
    > I have placed a simple Web User Control (Response.Write("hello")) on
    > my page which uses a Master Page to test this problem that we have.
    > Every time I run the web app it displays
    > the word "hello" at the top of the Master Page. Why is that? Why
    > doesn't it display it where you want it to display it? Isn't a Web User
    > Control sort of like place holder?
    >
    >
    > Example. Default.aspx contains
    > 1
    > 2
    > 3
    > Reference to my Web User Control to display 'hello'
    >
    > When I execute it I get
    > hello
    > 1
    > 2
    > 3
    > Instead of hello appearing at the end.
    >
    > Thanks
    > MA
    >
    >
     
    =?Utf-8?B?QW5keQ==?=, May 24, 2006
    #2
    1. Advertising

  3. mazdotnet

    keith

    Joined:
    Jul 20, 2006
    Messages:
    1
    I would say that the control is a server side process, so it is happening first then the page writes are following it. If you put the control in a panel on the page where you want it I think it will show up where you want it to or do all the work on the server.

    Keith
     
    keith, Jul 20, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Reny J Joseph Thuthikattu
    Replies:
    1
    Views:
    600
    =?Utf-8?B?UHJha2FzaC5ORVQ=?=
    Dec 30, 2004
  2. Doug McCann
    Replies:
    1
    Views:
    1,136
    William Brogden
    Aug 5, 2004
  3. Replies:
    5
    Views:
    56,005
    Sharals
    Jun 18, 2010
  4. Zeba
    Replies:
    1
    Views:
    541
    Mark Rae
    Feb 22, 2007
  5. Nathan Sokalski
    Replies:
    25
    Views:
    1,495
    Nathan Sokalski
    Mar 4, 2010
Loading...

Share This Page