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 / April 2006

Tip: Looking for answers? Try searching our database.

CompositeControlDesigner -

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sebastian - 15 Apr 2006 02:18 GMT
Does anyone has an Idea how to render content edited in
CompositeControlDesigner ?
This page shows nice example of editing content in design-time:
http://msdn2.microsoft.com/en-us/library/system.web.ui.design.editabledesignerre
gion(VS.80).aspx


, but Text entered in Views is not renderig at run-time when page is
displayed in browser.
How to solve this problem. What's missing in this example? Thanx for any Help!
Alessandro Zifiglio - 15 Apr 2006 08:56 GMT
hi sebastian, that sample code is a good example showing how to create
editabledesignerregions, however some pieces of code are missing.
Specifically they forgot(or maybe its intentional) to include the lines of
code that add the controls in the templates(view1 and view2) into the
specified content region. The missing code in the CreateChildControls method
is :
if (CurrentView == 0)
           {
               if (View1 != null)
               {
                   View1.InstantiateIn(tc);
               }
           }
           else if (CurrentView == 1)
           {
               if (View2 != null)
               {
                   View2.InstantiateIn(tc);
               }
           }

The complete code for the CreateChildControls method after the above
modification is :
// Create a simple table with a row of two clickable,
       // readonly headers and a row with a single column, which
       // is the 'container' to which we'll be adding controls.
       protected override void CreateChildControls()
       {
           // Always start with a clean form
           Controls.Clear();

           // Create a table using the control's declarative properties
           Table t = new Table();
           t.CellSpacing = 1;
           t.BorderStyle = BorderStyle;
           t.Width = this.Width;
           t.Height = this.Height;

           // Create the header row
           TableRow tr = new TableRow();
           tr.HorizontalAlign = HorizontalAlign.Center;
           tr.BackColor = Color.LightBlue;

           // Create the first cell in the header row
           TableCell tc = new TableCell();
           tc.Text = "View1";
           tc.Width = new Unit("50%");
           tr.Cells.Add(tc);

           // Create the second cell in the header row
           tc = new TableCell();
           tc.Text = "View 2";
           tc.Width = new Unit("50%");
           tr.Cells.Add(tc);

           t.Rows.Add(tr);

           // Create the second row for content
           tr = new TableRow();
           tr.HorizontalAlign = HorizontalAlign.Center;

           // This cell represents our content 'container'
           tc = new TableCell();
           tc.ColumnSpan = 2;
           if (CurrentView == 0)
           {
               if (View1 != null)
               {
                   View1.InstantiateIn(tc);
               }
           }
           else if (CurrentView == 1)
           {
               if (View2 != null)
               {
                   View2.InstantiateIn(tc);
               }
           }
           tr.Cells.Add(tc);

           t.Rows.Add(tr);

           // Add the finished table to the Controls collection
           Controls.Add(t);
       }

Have a good easter,
Alessandro Zifiglio.
> Does anyone has an Idea how to render content edited in
> CompositeControlDesigner ?
[quoted text clipped - 5 lines]
> How to solve this problem. What's missing in this example? Thanx for any
> Help!
Sebastian - 15 Apr 2006 11:01 GMT
Hi Alessandro,

many thanks for help!
Happy, happy easter to you!

> hi sebastian, that sample code is a good example showing how to create
> editabledesignerregions, however some pieces of code are missing.
[quoted text clipped - 93 lines]
> > How to solve this problem. What's missing in this example? Thanx for any
> > Help!

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.