Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / July 2006

Tip: Looking for answers? Try searching our database.

Design Time Rendering User Control?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill Cohagan - 21 Jul 2006 22:14 GMT
I've created a user control (not a custom control) consisting of a table
with a single row containing three cells, each cell containing a button.
Following is the code for this user control.

<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="NewEditDeleteButtons.ascx.cs"
Inherits="UserControls_NewEditDeleteButtons" %>
<%@ Register TagPrefix="ctrl" Namespace="IDWeb.Web.Control"
Assembly="IDWeb.Web" %>
<asp:Table ID="AEDBTable" runat="server">
 <asp:TableRow runat="server">
   <asp:TableCell ID="TableCell26" runat="server" CssClass="data">
       <ctrl:Button ID="btnNew" runat="server" Text="+"
OnClick="btnNew_Click"/>
   </asp:TableCell>
   <asp:TableCell ID="TableCell1" runat="server" CssClass="data">
       <ctrl:Button ID="btnEdit" runat="server" Text="e"
OnClick="btnEdit_Click"/>
   </asp:TableCell>
   <asp:TableCell ID="TableCell27" runat="server" CssClass="data">
       <ctrl:Button ID="btnDelete" runat="server" Text="X"
OnClick="btnDelete_Click"/>
   </asp:TableCell>
 </asp:TableRow>
</asp:Table>

This user control works fine at runtime and renders as expected.  In design
view however the page containing the NewEditDeleteButtons tag doesn't show
anything for this control.  Is there a way I can get it to render in the
designer?

TIA,
Bill Cohagan
Riki - 22 Jul 2006 11:54 GMT
> I've created a user control (not a custom control) consisting of a
> table with a single row containing three cells, each cell containing
[quoted text clipped - 29 lines]
> TIA,
> Bill Cohagan

I'm suspecting the custom button controls that you're using.

Try replacing the custom buttons with standard buttons, and see if that
helps.

Signature

Riki

Bill Cohagan - 22 Jul 2006 18:15 GMT
Riki
 Thank, but I already tried that.  Should have mentioned that in my
posting. FWIW, the custom button (at this point) is trivial anyway:

namespace IDWeb.Web.Control
{
   public class Button : System.Web.UI.WebControls.Button
   {
       public Button()
       {
       }
   }
}

>> I've created a user control (not a custom control) consisting of a
>> table with a single row containing three cells, each cell containing
[quoted text clipped - 34 lines]
> Try replacing the custom buttons with standard buttons, and see if that
> helps.
Walter Wang [MSFT] - 24 Jul 2006 12:21 GMT
Hi Bill,

Thank you for your post.

Depending on which ASP.NET version you are using, the answer to your
question varies:

1) If you are using ASP.NET 1.1, the UserControl's design-time rendering is
very limited and the behavior you're experiencing is expected.

2) If you are using ASP.NET 2.0, the UserControl's design-time rendering
should reflect the controls it's using. However, if the custom control
(IDWeb.Web.Control.Button) is placed under the website's App_Code folder,
due to ASP.NET 2.0 compilation model, it will show the custom control on
UserControl successfully, but will not show correctly if the UserControl is
used in WebForm or another UserControl again. You need to place the custom
control in a separate Class Library to get correct design-time rendering.

Hope this helps. Please feel free to post here if anything is unclear.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Bill Cohagan - 25 Jul 2006 15:34 GMT
Walter
 Thanks for the suggestions; however the button custom control is already
in a dll. I'm using ASP.Net 2.0. Following is the code for the user control
as well:

<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="NewEditDeleteButtons.ascx.cs"
Inherits="UserControls_NewEditDeleteButtons" %>
<%@ Register TagPrefix="ctrl" Namespace="IDWeb.Web.Control"
Assembly="IDWeb.Web" %>
<asp:Table ID="AEDBTable" runat="server">
 <asp:TableRow runat="server">
   <asp:TableCell ID="TableCell26" runat="server" CssClass="data">
       <ctrl:Button ID="btnNew" runat="server" Text="+"
OnClick="btnNew_Click"/>
   </asp:TableCell>
   <asp:TableCell ID="TableCell1" runat="server" CssClass="data">
       <ctrl:Button ID="btnEdit" runat="server" Text="e"
OnClick="btnEdit_Click"/>
   </asp:TableCell>
   <asp:TableCell ID="TableCell27" runat="server" CssClass="data">
       <ctrl:Button ID="btnDelete" runat="server" Text="X"
OnClick="btnDelete_Click"/>
   </asp:TableCell>
 </asp:TableRow>
</asp:Table>

Note the Register element referencing the IDWeb.Web assembly. If I
understand your response correctly, you're saying this should work as-is,
right?

Regards,
Bill

> Hi Bill,
>
[quoted text clipped - 29 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.