I'm reposting this, because I had a bit of difficulty last time and think
that it might have fallen through the cracks. If I'm posting to the wrong
groups, please let me know. Surely someone has some experience with this...
I've been building custom web controls in C# with VS2005. Currently I'm
looking into adding design-time functionality and have reached a point where
I need to generate code in the page the custom control is on. Enter the
CodeDomSerializ er class.
I've found several examples creating Designer Serializers, nearly all of
them for windows forms, but a few claiming to work for Web Controls;
however, I have been singularly unsuccessful at every attempt to modify
source code during the design-time experience. Clearly I'm doing something
wrong, but what it is escapes me.
Below is a sample of the technique I've been using, scaled down to the
barest minimum and excluding designers and other things you might expect for
a custom control. It appears to me that this should work, though adding this
"newtest" control to a page clearly does not add the comment expected.
Can anyone add some clarity at to what I'm doing wrong? Thank you in
advance.
-Jim Fisher
/--/begin sample code....
namespace testcontrol {
[DesignerSeriali zer(typeof(newt est_serializer) ,
typeof(CodeDomS erializer))]
public partial class newtest : System.Web.UI.W ebControls.Text Box {
public newtest() {
InitializeCompo nent();
}
public newtest(IContai ner container) {
container.Add(t his);
InitializeCompo nent();
}
}
internal class newtest_seriali zer : CodeDomSerializ er {
public override object Deserialize(IDe signerSerializa tionManager
manager, object codeObject) {
CodeDomSerializ er serial =
(CodeDomSeriali zer)manager.Get Serializer(type of(newtest).Bas eType,
typeof(CodeDomS erializer));
return serial.Deserial ize(manager,cod eObject);
}
public override object Serialize(IDesi gnerSerializati onManager
manager, object value) {
CodeDomSerializ er serial =
(CodeDomSeriali zer)manager.Get Serializer(type of(newtest).Bas eType,
typeof(CodeDomS erializer));
CodeStatementCo llection statements =
(CodeStatementC ollection)seria l.Serialize(man ager, value);
statements.Add( new CodeCommentStat ement("//--Comment!--"));
return statements;
}
}
} 0 1397 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: SammyBar |
last post by:
Hi,
I'm trying to bind a custom collection class to a data grid, following the
guidelines from the article
http://msdn.microsoft.com/msdnmag/issues/05/08/CollectionsandDataBinding/default.aspx.
The problem is the article is in VisualBasic. I already get the collection
to be recognized as a Data Source by the IDE. It populated the DataGrid
correctly from the fields on the items object of the collection, but I can't
get the DataGrid to...
|
by: tshad |
last post by:
Many (if not most) have said that code-behind is best if working in teams -
which does seem logical.
How do you deal with the flow of the work?
I have someone who is good at designing, but know nothing about ASP. He can
build the design of the pages in HTML with tables, labels, textboxes etc.
But then I would need to change them to ASP.net objects and write the code
to make the page work (normally I do this as I go - can't do this...
|
by: Shimon Sim |
last post by:
I have a custom composite control
I have following property
|
by: George Jordanov Ivanov |
last post by:
Folks,
I am implementing a WebUserControl, which will have its own custom event
StateChanged. Now, I want to add this event to the Events tab in the control
properties, so that the users of my control can set the event handler from
this tab. However, I can't see my custom StateChanged event over there and I
don't know what is the reason. Setting BrowsableAttribute to the public
event property doesn't solve the problem. Any other ideas?
...
|
by: Brant Estes |
last post by:
So try this. Create a new ASP.NET 2.0 website. Add a theme. Add a
skin to the theme. In your web.config, add the <pages theme="MyTheme"
styleSheetTheme="MyTheme" /tag under your system.web node.
Now, on a page, drag out any built in control, such as a label.
Style/Skin it. The control will take the style of the theme at both
runtime and in the designer. Cool!
Now, create a custom server control (inherits from WebControl)....
| |
by: Mark Olbert |
last post by:
I've written a composite custom control which I would like to have update its design-time display when one of several properties
changes at design time. These custom properties are not simply the exposed properties of the constituent controls (e.g., they
control how many constitutent controls are displayed).
I am at a loss as to how to go about doing this. I have a custom designer for the control, but I don't see any functionality in the...
|
by: Mark Olbert |
last post by:
Has anyone else noticed that the design-time support for databinding in custom controls in ASPNET2 sucks? At least for GridViews? So
far I've spent going on two days trying to get the following simple statements to actually generate something at design-time:
gridView = new GridView();
gridView.AutoGenerateColumns = true;
gridView.DataSource = ;
gridView.DataBind();
I have tried everything I could think of, or read about in four books...
|
by: |
last post by:
How do you debug the design time behavior of user controls? I have code in the controls resize event and I've flagged a break point, but the code never breaks when I play with the control on the form in the test project at design time.
Thoughts?
J
|
by: Ken Fine |
last post by:
I've been living with a frustrating issue with VS.NET for some months now
and I need to figure out what the problem is. Hopefully someone has run into
the same issue and can suggest a fix. I suspect some permissions problem.
I'm running VS.NET 2008 in Vista. Symptoms and observations:
* ASP.NET's native ImageMap and Image controls work just fine and provide a
design-time preview of images that are referenced via the ImageUrl property
*...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |