Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Web derived controls in VS2005 designer view

Reply
Thread Tools

Web derived controls in VS2005 designer view

 
 
postings@alexshirley.com
Guest
Posts: n/a
 
      03-23-2006
Hi

I'm more or less desperate here, I've posted this in a few forums now
over the months and got absolutely no response. It would be very much
appreciate that you could help in any way here... So take pity

I have a control derived from a drop down list written in VB.NET
(ASP.NET 2.0) that dynamically displays listitems retrieved from an SQL
server database. My code works fine but when I go to designer view in
Visual Studio 2005 it renders a gray box displaying: "Error Creating
Control - MyDropDownList, object reference not set to an instance of an
object". Note the drop down list works perfectly when being displayed
in IE.

If I remove my code retrieving the values from SQL server and put in
static values like this:
----------------------------------------------------
Me.Items.Add(New ListItem("Select a Value", "0"))
Me.Items.Add(New ListItem("Test", "1"))
----------------------------------------------------


....the drop down list will render in both the designer and IE. So I am
assuming that the VS2005 designer view will not render dynamic
listitems, but will render static listitems from dropdownlists.

In order to solve this problem I've looked at using:
Protected Overrides Sub Render(ByVal writer As
System.Web.UI.HtmlTextWriter)

....to see if I can force rendering in the design view but no joy at
all, so my approach isn't working here.

I don't really care if the designer renders the exact values from the
database, a couple of dummy values will do if necessary. I just want to
see the control is designer view.

So please - any words of wisdom!

Many thanks indeed...

Alex

 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      03-23-2006
IF Me.DesignMode = True THEN
'Use Static Values
Me.Items.Add(New ListItem("Select a Value", "0"))
Me.Items.Add(New ListItem("Test", "1"))
ELSE
'get from SQL Server
END IF

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Hi
>
> I'm more or less desperate here, I've posted this in a few forums now
> over the months and got absolutely no response. It would be very much
> appreciate that you could help in any way here... So take pity
>
> I have a control derived from a drop down list written in VB.NET
> (ASP.NET 2.0) that dynamically displays listitems retrieved from an SQL
> server database. My code works fine but when I go to designer view in
> Visual Studio 2005 it renders a gray box displaying: "Error Creating
> Control - MyDropDownList, object reference not set to an instance of an
> object". Note the drop down list works perfectly when being displayed
> in IE.
>
> If I remove my code retrieving the values from SQL server and put in
> static values like this:
> ----------------------------------------------------
> Me.Items.Add(New ListItem("Select a Value", "0"))
> Me.Items.Add(New ListItem("Test", "1"))
> ----------------------------------------------------
>
>
> ...the drop down list will render in both the designer and IE. So I am
> assuming that the VS2005 designer view will not render dynamic
> listitems, but will render static listitems from dropdownlists.
>
> In order to solve this problem I've looked at using:
> Protected Overrides Sub Render(ByVal writer As
> System.Web.UI.HtmlTextWriter)
>
> ...to see if I can force rendering in the design view but no joy at
> all, so my approach isn't working here.
>
> I don't really care if the designer renders the exact values from the
> database, a couple of dummy values will do if necessary. I just want to
> see the control is designer view.
>
> So please - any words of wisdom!
>
> Many thanks indeed...
>
> Alex
>



 
Reply With Quote
 
 
 
 
ovalsquare
Guest
Posts: n/a
 
      03-31-2006
Alex,

Did this solve it for you? As I've got the same problem and Steve's
solution does not fix the issue (still get the error in design view).

Ted

Steve C. Orr [MVP, MCSD] wrote:
> IF Me.DesignMode = True THEN
> 'Use Static Values
> Me.Items.Add(New ListItem("Select a Value", "0"))
> Me.Items.Add(New ListItem("Test", "1"))
> ELSE
> 'get from SQL Server
> END IF
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) oups.com...
> > Hi
> >
> > I'm more or less desperate here, I've posted this in a few forums now
> > over the months and got absolutely no response. It would be very much
> > appreciate that you could help in any way here... So take pity
> >
> > I have a control derived from a drop down list written in VB.NET
> > (ASP.NET 2.0) that dynamically displays listitems retrieved from an SQL
> > server database. My code works fine but when I go to designer view in
> > Visual Studio 2005 it renders a gray box displaying: "Error Creating
> > Control - MyDropDownList, object reference not set to an instance of an
> > object". Note the drop down list works perfectly when being displayed
> > in IE.
> >
> > If I remove my code retrieving the values from SQL server and put in
> > static values like this:
> > ----------------------------------------------------
> > Me.Items.Add(New ListItem("Select a Value", "0"))
> > Me.Items.Add(New ListItem("Test", "1"))
> > ----------------------------------------------------
> >
> >
> > ...the drop down list will render in both the designer and IE. So I am
> > assuming that the VS2005 designer view will not render dynamic
> > listitems, but will render static listitems from dropdownlists.
> >
> > In order to solve this problem I've looked at using:
> > Protected Overrides Sub Render(ByVal writer As
> > System.Web.UI.HtmlTextWriter)
> >
> > ...to see if I can force rendering in the design view but no joy at
> > all, so my approach isn't working here.
> >
> > I don't really care if the designer renders the exact values from the
> > database, a couple of dummy values will do if necessary. I just want to
> > see the control is designer view.
> >
> > So please - any words of wisdom!
> >
> > Many thanks indeed...
> >
> > Alex
> >


 
Reply With Quote
 
postings@alexshirley.com
Guest
Posts: n/a
 
      04-18-2006
Hi Oval

No it didn't unfortunately (thanks for trying Steve).
I see the logic in the code, and I can't see why it doesn't work.
Please let me know if you get any further than I did (is this a VS2005
IDE bug?).

Thanks

Alex

 
Reply With Quote
 
Alex Shirley
Guest
Posts: n/a
 
      09-20-2006
Hi

Was there ever a solution to this, is designmode broken?

Many thanks!

Alex



*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
postings@alexshirley.com
Guest
Posts: n/a
 
      10-06-2006
Anybody? (one last go before I fizzle out

Thanks

Alex

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Derived::Derived(const Base&) and Derived& operator=(const Base&) developereo@hotmail.com C++ 1 05-23-2007 01:44 PM
Derived::Derived(const Base&) and Derived& operator=(const Base&) developereo@hotmail.com C++ 1 05-23-2007 12:07 AM
Rendering a derived drop down list in VS2005 designer view postings@alexshirley.com ASP .Net Building Controls 0 02-16-2006 10:44 AM
Rendering a derived control in design view (VS2005) postings@alexshirley.com ASP .Net 0 02-06-2006 10:46 AM
Rendering a derived control in design view (VS2005) postings@alexshirley.com ASP .Net 0 02-01-2006 03:28 PM



Advertisments