Problem with design time rendering in VS2005

Discussion in 'ASP .Net Building Controls' started by Showjumper, Jul 23, 2006.

  1. Showjumper

    Showjumper Guest

    I have made a server control to display the average rating for content by
    showing the number of stars. The problem i have is with the design time
    display in vs 2005. It seems the problem with the design time rendering is
    due to the calls to the databse helper class. Delete those lines and it
    displasy fine in deign time. The code is below
    Any ideas on how to make design time work?
    Thanks Ashok

    Dim dbutil As New DBHelper

    Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)

    dbutil.ProductID = _productid

    Dim average As Single = dbutil.GetAverage

    If average <> 0 Then

    Select Case CInt(average * 4)

    'load the right star image based on the rating

    End Select

    output.Write("Rating: ")

    MyBase.Render(output)
    Showjumper, Jul 23, 2006
    #1
    1. Advertising

  2. Showjumper

    Gary Vidal Guest

    just add this
    If( this.DesignMode ) Then
    ' Do designmode stuff
    Else
    'Your Original code
    End If

    --
    Gary Vidal



    "Showjumper" <dfgkjhdf> wrote in message
    news:...
    >
    > I have made a server control to display the average rating for content by
    > showing the number of stars. The problem i have is with the design time
    > display in vs 2005. It seems the problem with the design time rendering
    > is due to the calls to the databse helper class. Delete those lines and it
    > displasy fine in deign time. The code is below
    > Any ideas on how to make design time work?
    > Thanks Ashok
    >
    > Dim dbutil As New DBHelper
    >
    > Protected Overrides Sub Render(ByVal output As
    > System.Web.UI.HtmlTextWriter)
    >
    > dbutil.ProductID = _productid
    >
    > Dim average As Single = dbutil.GetAverage
    >
    > If average <> 0 Then
    >
    > Select Case CInt(average * 4)
    >
    > 'load the right star image based on the rating
    >
    > End Select
    >
    > output.Write("Rating: ")
    >
    > MyBase.Render(output)
    >
    >
    >
    Gary Vidal, Jul 23, 2006
    #2
    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:
    791
    Barry Carr
    Jan 15, 2004
  2. Replies:
    0
    Views:
    361
  3. Replies:
    0
    Views:
    389
  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:
    112
    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:
    117
    Gergely Varadi
    Jul 25, 2003
Loading...

Share This Page