CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 9/20/2005 9:48:47 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 32 Favorited: 0 Favorite
2 Items, 1 Pages 1 |< << Go >> >|
jack1234
Asp.Net User
Problem on Composite server control9/20/2005 9:48:47 AM

0/0

To make the composite control can be viewed at design time, we need to do the following

For the composite control, put the Designer attributes, specify the designer class

****Code start******
<Designer(GetType(CompositeControlDesigner))>
Public class CompositeControl
...
****Code End******

And for the CompositeControlDesigner Class,

****Code start******
public class CompositeControlDesinger
 Inherits System.Web.UI.Design.ControlDesigner

Public overrides Function GetDesignTimeHtml() as String
 Dim Control As CompositeLogin = Ctype(Component, CompositeLogin)
 Dim childControls As ControlCollection = Control.Controls
 
 Return MyBase.GetDesignTimeHtml
End Function

End Class
****Code End*****

My Problem is for

 Dim Control As CompositeLogin = Ctype(Component, CompositeLogin)
 Dim childControls As ControlCollection = Control.Controls

seems like it has no use as finally the function just return MyBase.GetDesignTimeHtml,
but it is needed to show the controls. How the mechanism going behind?

FancyKetsup
Asp.Net User
Re: Problem on Composite server control9/20/2005 3:07:42 PM

0/0

This method(GetDesignTimeHtml) has to return the html for it to be displayed in VS. You have to build up your html string then return it. IE if i return  "<INPUT type=\"button\" value=\"Button\"> then the work space displays a button so BUILD YOUR HTML STRING and return it. This is one of the simplest methods of design time don't make it harder than it is, there is no magic going on here.

took the below code from this post ---> http://forums.asp.net/1025877/ShowPost.aspx

public override string GetDesignTimeHtml() {

StringWriter sw = new StringWriter();

HtmlTextWriter tw = new HtmlTextWriter(sw);

TextBox txbox = new TextBox();

Label lbl = new Label ();

lbl.Text = "something";

txbox.RenderControl(tw);

lbl.RenderControl (tw);

return base.GetDesignTimeHtml() + sw.ToString();

}

Below is a snippet from a designer to let you see what kind of things you do inside this method.
Doesn't get much easier than this.  Hint  Component is the currently selected control ie...


public override string GetDesignTimeHtml()
  {
   MyControl mycontrol = (MyControl )Component;
   mycontrol.Font.Name = mycontrol.Font.Names;//this is for my custom font class to intialize in the designer
   HtmlGenericControl logtab = (HtmlGenericControl)mycontrol.Controls[0];
   logtab.Attributes["style"].Remove(0,logtab.Attributes["style"].Length);
   logtab.Attributes.Add("style","background-color:"+mycontrol.SetTabBackColor+";height:20px;"+mycontrol.GetAlignment());
   HtmlGenericControl logbody = (HtmlGenericControl)mycontrol.Controls[1];
   logbody.Attributes["style"].Remove(0,logbody.Attributes["style"].Length);
   if(mycontrol.Expanded)
    ShowBody = true;
   if(ShowBody)
   {
    logbody.Attributes.Add("style","background-color:"+mycontrol.SetBodyBackColor+";height:100px;visibility:show;display:block;"+mycontrol.GetAlignment());
   }
   else
   {
    logbody.Attributes.Add("style","background-color:"+mycontrol.SetBodyBackColor+";height:100px;visibility:hidden;display:none;"+mycontrol.GetAlignment());
   }

   StringWriter sw = new StringWriter();
   HtmlTextWriter tw = new HtmlTextWriter(sw);
   mycontrol.RenderControl(tw);
   return sw.ToString();
  }

  protected override void PreFilterProperties(System.Collections.IDictionary properties)
  {
   base.PreFilterProperties(properties);
   PropertyDescriptor prop = System.ComponentModel.TypeDescriptor.CreateProperty(this.GetType(), ShowBody", ShowBody.GetType() ,null);
   properties["ShowBody"] = prop;
  }



Hope this helps have a nice day!


Answering a question increases your knowledge asking a question shows your Intelligence!
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Designing Microsoft ASP.NET Applications Authors: Douglas J. Reilly, Pages: 402, Published: 2001
Professional ASP.NET 2.0 Server Control and Component Development Authors: Shahram Khosravi, Pages: 1186, Published: 2006
OOP: Building Reusable Components with Microsoft Visual Basic . NET Authors: Ken Spencer, Tom Eberhard, John Alexander, Pages: 500, Published: 2002
ASP.NET AJAX Programmer's Reference: With ASP.NET 2.0 Or ASP.NET 3.5 Authors: Shahram Khosravi, Pages: 1522, Published: 2007
Pro ASP. Net 3. 5 Server Controls and AJAX Components Authors: Rob Cameron, Dale Michalk, Pages: 740, Published: 2008
Visual Basic .NET Developer's Guide to ASP.NET, XML, and ADO.NET Authors: Jeffrey P. McManus, Chris Kinsman, Pages: 592, Published: 2002
ASP.Net Solutions: 23 Case Studies : Best Practices for Developers Authors: Rick Leinecker, Richard C. Leinecker, Pages: 912, Published: 2003
Professional ASP.NET 1.1 Authors: Alex Homer, Dave Sussman, Rob Howard, Brian Francis, Karli Watson, Richard Anderson, Pages: 1337, Published: 2004

Web:
Composite Server Control Sample The following sample develops a composite control ( Composite ) that combines four ASP.NET server controls: two Textbox controls, a Label control, ...
Creating Composite Server Controls in ASP.NET 2.0 Jan 25, 2006 ... In this article I will explain the basics of how to create a type of server control called a Composite control, and to highlight some of the ...
Building Composite Server Controls: ASP Alliance Composite server controls are a collection controls to create one unified control; however, do not confuse this term that two control's functionality and ...
problem setting the skinID for a composite server control - ASP ... problem setting the skinID for a composite server control. Last post 12-05-2006 10:07 AM by andieje. 3 replies. Sort Posts: ...
Composite Web Control Example This example shows how to create a control named Register that demonstrates the main steps required to implement a composite ASP.NET server control. ...
DotNetSlackers: Creating a Composite Server Control used for ... The first of two articles where I explaine how a custom composite server control , with five different field type's included, can be used to render dynamic ...
Authoring a composite custom server control to access NASDAQ stock ... Develop a composite custom server control in ASP.NET to add instant, ..... I tried to develop this composite custom server control to illustrate how ...
Problem with composite control Talk about Problem with composite control. ... [ToolboxData("<{0}:LabelMaskEdit runat=server>")] ...
Composite Databound Control Design view error - ASP.NET Forums I was able to come up with a simplified version that has the same problem. Server Control:. using System; using System.Collections.Generic; using System. ...
GetAFreelancer.com - Converting an ASP.NET Composite server ... NET Composite server control to a Templated control. ... NET Composite Server Control project. This control has a file upload control, a label control and a ...

Videos:
Monsoon HAVA Server Showcase Turn your PC into a PVR and record favorite TV shows directly to an internal PC hard disk or an externally attached USB hard disk or simpley burn the...
Montreal Highland games July 2004, watch for Ulrik Jette 5 year olds, 1st mass bands with Montreal Pipes & Drums. The best is yet to come !




Search This Site:










accessing page object from within an assembly

i cant set the value of a propety in my user control

page_validators undefined

single style declaration for multiple control instances

building server controls in whidbey?

hosting 2.0 w/atlas?

hosting business relate question: provide domain name registar service

looking for free asp.net hosting for research

advanced help required: templates and styles mixed together...

the sse provider did not find the database file specified in the connection string

help find control on usercontrol

properties and methods not recognised

datagrid in a user control making ma click twice before a firing itemcommand........

design-time support for external stylesheets - possible?

hosting advice?

changing the "browse" button in a file control?

integrating images (gif) into dll

adding design time support for customparse2 example

custom event in user control call event method by name

building a .net component to render a .jpg

accessing properties in datagrid

can a listitem in a radiobuttonlist be a textbox?

web custom control question

what happened to serversea?

horrible service by webhost4life

control dropdown w/in a custom control

looking for providers that will help our customer install our software?

setting style tags for designers

??? is inaccessible due to its protection level.

software delivery recommendation

  Privacy | Contact Us
All Times Are GMT