Design Time Rendering Within Tables

Discussion in 'ASP .Net Building Controls' started by James F. Kubecki, Oct 23, 2003.

  1. Hello,
    I'm attempting to build a composite control which for
    purposes of layout renders its content as an HTML table
    row (<tr>). At runtime, it works just fine, but at
    design time, the control doesn't render at all.
    The following is a simplified example which will
    illustrate this:

    (CONTROL CLASS)

    public class RowTypeControl : Control
    {
    protected override void Render(HtmlTextWriter writer)
    {
    writer.Write("<tr><td>Foo</td><td>Bar</td></tr>");
    }
    }

    (ASPX PAGE)

    <table border=5>
    <cc1:RowTypeControl id="RowTypeControl1"
    runat="server"></cc1:RowTypeControl>
    </table>

    Again, at runtime, this renders perfectly, but at design
    time, it doesn't show ANYTHING in the designer.

    What am I missing?
    JFK
    James F. Kubecki, Oct 23, 2003
    #1
    1. Advertising

  2. Hi James,

    Based on your posted Render method, it should render ok. Could you post a
    very small sample to repro this?

    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    http://obies.com/vga/blog.aspx
    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    and not by private mail.

    "James F. Kubecki" <> wrote in message
    news:01e501c3999f$928e1260$...
    > Hello,
    > I'm attempting to build a composite control which for
    > purposes of layout renders its content as an HTML table
    > row (<tr>). At runtime, it works just fine, but at
    > design time, the control doesn't render at all.
    > The following is a simplified example which will
    > illustrate this:
    >
    > (CONTROL CLASS)
    >
    > public class RowTypeControl : Control
    > {
    > protected override void Render(HtmlTextWriter writer)
    > {
    > writer.Write("<tr><td>Foo</td><td>Bar</td></tr>");
    > }
    > }
    >
    > (ASPX PAGE)
    >
    > <table border=5>
    > <cc1:RowTypeControl id="RowTypeControl1"
    > runat="server"></cc1:RowTypeControl>
    > </table>
    >
    > Again, at runtime, this renders perfectly, but at design
    > time, it doesn't show ANYTHING in the designer.
    >
    > What am I missing?
    > JFK
    Victor Garcia Aprea [MVP], Oct 23, 2003
    #2
    1. Advertising

  3. Hi,
    Not sure what you need beyond the sample that was
    originally posted. Can you elaborate?

    JFK
    >-----Original Message-----
    >Hi James,
    >
    >Based on your posted Render method, it should render ok.

    Could you post a
    >very small sample to repro this?
    James F. Kubecki, Oct 23, 2003
    #3
  4. The RowTypeControl you just posted is *really* very simple and should work
    okay. I'm guessing your real code its a bit different and it may contain
    something that its causing the unexpected behavior. Could you describe what
    exactly is being rendered on the design-surface? Nothing at all? Are you
    able to select the control and move it around? Also if the control is not
    apparently showing try selecting with the mouse a big region to see if
    anything becomes selected.

    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    http://obies.com/vga/blog.aspx
    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    and not by private mail.

    "James F. Kubecki" <> wrote in message
    news:03f101c399a5$e3653460$...
    > Hi,
    > Not sure what you need beyond the sample that was
    > originally posted. Can you elaborate?
    >
    > JFK
    > >-----Original Message-----
    > >Hi James,
    > >
    > >Based on your posted Render method, it should render ok.

    > Could you post a
    > >very small sample to repro this?

    >
    Victor Garcia Aprea [MVP], Oct 23, 2003
    #4
  5. Oh OK. The RowTypeControl example shown below IS much
    simpler than the "real code", HOWEVER it behaves exactly
    the same way.
    Specifically, on the design surface, NOTHING is
    rendered. There is not even a handle for selecting the
    control. If you select the control in the properties
    window or in Document Outline, there is no change to the
    rendered view to indicate that anything selected.

    Also, if you add any other table rows, those rows are
    rendered (so you can now see the table) but the control
    remains unrendered.

    Example:
    <table border=5>
    <tr>
    <td>Foo</td>
    <td>Bar</td>
    </tr>
    <cc1:RowTypeControl id="RowTypeControl1"
    runat="server"></cc1:RowTypeControl>
    <tr>
    <td>Foo</td>
    <td>Bar</td>
    </tr>
    </table>

    Renders as:

    +---+---+
    |Foo|Bar|
    +---+---+
    |Foo|Bar|
    +---+---+

    The rendering above is simulated, of course... :)

    JFK

    >-----Original Message-----
    >The RowTypeControl you just posted is *really* very

    simple and should work
    >okay. I'm guessing your real code its a bit different

    and it may contain
    >something that its causing the unexpected behavior.

    Could you describe what
    >exactly is being rendered on the design-surface? Nothing

    at all? Are you
    >able to select the control and move it around? Also if

    the control is not
    >apparently showing try selecting with the mouse a big

    region to see if
    >anything becomes selected.
    >
    >--
    >Victor Garcia Aprea
    >Microsoft MVP | ASP.NET
    >Looking for insights on ASP.NET? Read my blog:
    >http://obies.com/vga/blog.aspx
    >To contact me remove 'NOSPAM'. Please post all questions

    to the newsgroup
    >and not by private mail.
    James F. Kubecki, Oct 23, 2003
    #5
  6. Please try creating a brand new test web app project (to isolate as much as
    possible from your current project), include the code for the control you
    posted and see how it works. If you still don't get any design-time support
    then I'm guessing your VS.NET installation may have been corrupted or
    something.

    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    http://obies.com/vga/blog.aspx
    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    and not by private mail.

    "James F. Kubecki" <> wrote in message
    news:053701c399a8$add48f50$...
    > Oh OK. The RowTypeControl example shown below IS much
    > simpler than the "real code", HOWEVER it behaves exactly
    > the same way.
    > Specifically, on the design surface, NOTHING is
    > rendered. There is not even a handle for selecting the
    > control. If you select the control in the properties
    > window or in Document Outline, there is no change to the
    > rendered view to indicate that anything selected.
    >
    > Also, if you add any other table rows, those rows are
    > rendered (so you can now see the table) but the control
    > remains unrendered.
    >
    > Example:
    > <table border=5>
    > <tr>
    > <td>Foo</td>
    > <td>Bar</td>
    > </tr>
    > <cc1:RowTypeControl id="RowTypeControl1"
    > runat="server"></cc1:RowTypeControl>
    > <tr>
    > <td>Foo</td>
    > <td>Bar</td>
    > </tr>
    > </table>
    >
    > Renders as:
    >
    > +---+---+
    > |Foo|Bar|
    > +---+---+
    > |Foo|Bar|
    > +---+---+
    >
    > The rendering above is simulated, of course... :)
    >
    > JFK
    >
    > >-----Original Message-----
    > >The RowTypeControl you just posted is *really* very

    > simple and should work
    > >okay. I'm guessing your real code its a bit different

    > and it may contain
    > >something that its causing the unexpected behavior.

    > Could you describe what
    > >exactly is being rendered on the design-surface? Nothing

    > at all? Are you
    > >able to select the control and move it around? Also if

    > the control is not
    > >apparently showing try selecting with the mouse a big

    > region to see if
    > >anything becomes selected.
    > >
    > >--
    > >Victor Garcia Aprea
    > >Microsoft MVP | ASP.NET
    > >Looking for insights on ASP.NET? Read my blog:
    > >http://obies.com/vga/blog.aspx
    > >To contact me remove 'NOSPAM'. Please post all questions

    > to the newsgroup
    > >and not by private mail.

    >
    Victor Garcia Aprea [MVP], Oct 23, 2003
    #6
  7. James F. Kubecki

    Andrew Guest

    From what I have learned, the chunk of html you generate in Render will be
    separate from any html in the page.

    The simplest illustration of this is touse two literal, one has .Text to
    open a table, the other to close it.
    This will work at runtime for the browser, but the designer surface will not
    show them as a single table.

    While I doubt it is what you want, you can check my meaning by putting the
    html for the table into the custom control's render method (with the row and
    cell tags).

    To get around this, you could try working with the asp:table or building
    annother table control of your own, that will render the table tags and your
    custom row controls.

    -Andrew Stevenson
    UITemplates.net


    "Victor Garcia Aprea [MVP]" <> wrote in message
    news:...
    > Please try creating a brand new test web app project (to isolate as much

    as
    > possible from your current project), include the code for the control you
    > posted and see how it works. If you still don't get any design-time

    support
    > then I'm guessing your VS.NET installation may have been corrupted or
    > something.
    >
    > --
    > Victor Garcia Aprea
    > Microsoft MVP | ASP.NET
    > Looking for insights on ASP.NET? Read my blog:
    > http://obies.com/vga/blog.aspx
    > To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    > and not by private mail.
    >
    > "James F. Kubecki" <> wrote in message
    > news:053701c399a8$add48f50$...
    > > Oh OK. The RowTypeControl example shown below IS much
    > > simpler than the "real code", HOWEVER it behaves exactly
    > > the same way.
    > > Specifically, on the design surface, NOTHING is
    > > rendered. There is not even a handle for selecting the
    > > control. If you select the control in the properties
    > > window or in Document Outline, there is no change to the
    > > rendered view to indicate that anything selected.
    > >
    > > Also, if you add any other table rows, those rows are
    > > rendered (so you can now see the table) but the control
    > > remains unrendered.
    > >
    > > Example:
    > > <table border=5>
    > > <tr>
    > > <td>Foo</td>
    > > <td>Bar</td>
    > > </tr>
    > > <cc1:RowTypeControl id="RowTypeControl1"
    > > runat="server"></cc1:RowTypeControl>
    > > <tr>
    > > <td>Foo</td>
    > > <td>Bar</td>
    > > </tr>
    > > </table>
    > >
    > > Renders as:
    > >
    > > +---+---+
    > > |Foo|Bar|
    > > +---+---+
    > > |Foo|Bar|
    > > +---+---+
    > >
    > > The rendering above is simulated, of course... :)
    > >
    > > JFK
    > >
    > > >-----Original Message-----
    > > >The RowTypeControl you just posted is *really* very

    > > simple and should work
    > > >okay. I'm guessing your real code its a bit different

    > > and it may contain
    > > >something that its causing the unexpected behavior.

    > > Could you describe what
    > > >exactly is being rendered on the design-surface? Nothing

    > > at all? Are you
    > > >able to select the control and move it around? Also if

    > > the control is not
    > > >apparently showing try selecting with the mouse a big

    > > region to see if
    > > >anything becomes selected.
    > > >
    > > >--
    > > >Victor Garcia Aprea
    > > >Microsoft MVP | ASP.NET
    > > >Looking for insights on ASP.NET? Read my blog:
    > > >http://obies.com/vga/blog.aspx
    > > >To contact me remove 'NOSPAM'. Please post all questions

    > > to the newsgroup
    > > >and not by private mail.

    > >

    >
    >
    Andrew, Nov 24, 2003
    #7
    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. Barry Carr
    Replies:
    4
    Views:
    780
    Barry Carr
    Jan 15, 2004
  2. Otuatail

    Tables within tables

    Otuatail, Jul 31, 2004, in forum: HTML
    Replies:
    7
    Views:
    486
  3. Elmo Watson
    Replies:
    1
    Views:
    583
    Eliyahu Goldin
    May 8, 2007
  4. Oleg Ogurok

    design-time rendering doesn't happen unless properties changed

    Oleg Ogurok, Jul 11, 2003, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    108
    Oleg Ogurok
    Jul 11, 2003
  5. Gergely Varadi

    WebControl rendering an ActiveX ctrl - design time problem

    Gergely Varadi, Jul 25, 2003, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    113
    Gergely Varadi
    Jul 25, 2003
Loading...

Share This Page