Hi,
I have just created a class that removes action attribute from HtmlForm. The
code looks like here.
namespace ComIT.Applicati ons.Common
{
public class Form : System.Web.UI.H tmlControls.Htm lForm
{
protected override void RenderAttribute s(HtmlTextWrite r writer)
{
writer.WriteAtt ribute("name", this.Name);
base.Attributes .Remove("name") ;
writer.WriteAtt ribute("method" , this.Method);
base.Attributes .Remove("method ");
this.Attributes .Render(writer) ;
base.Attributes .Remove("action ");
if (base.ID != null)
writer.WriteAtt ribute("id", base.ClientID);
}
}
}
I have registered it in my ASPX page. It looks like this.
<%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt.aspx.cs"
Inherits="_Defa ult" %>
<%@ Register TagPrefix="ca" Namespace="ComI T.Applications. Common"
Assembly="ComIT .Applications.C ommon" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title id="PageTitle" runat="server"> Default</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="imagetoo lbar" content="no" />
</head>
<body>
<ca:Form id="form1" method="post" runat="server">
</ca:Form>
</body>
</html>
When I switch my ASPX page to design mode, it shows following error.
Unable to cast object of type
'System.Web.Ui. Design.HtmlIntr insicControlDes igner' to type
'System.Web.Ui. Design.ControlD esigner'.
Why is this error coming? Am I doing anything wrong?
Thanks in advanced.
Tabi 3 4147
Well, my first question would have to be, why do you want to do this at all?
You are breaking the object model of a WebForm by doing so.
The exception seems to indicate that the Designer for an HtmlForm is running
into a problem with your override. Designers use various methods of the
Controls they design, particularly those methods which render the Control in
the Page, to render the Control at design-time. As I have no way of peeking
inside the Designer code for the HtmlForm Control, that is all I can say.
But it does beg the question I started with.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
"Tabi" <Ta**@discussio ns.microsoft.co m> wrote in message
news:98******** *************** ***********@mic rosoft.com... Hi,
I have just created a class that removes action attribute from HtmlForm. The code looks like here.
namespace ComIT.Applicati ons.Common { public class Form : System.Web.UI.H tmlControls.Htm lForm { protected override void RenderAttribute s(HtmlTextWrite r writer) { writer.WriteAtt ribute("name", this.Name); base.Attributes .Remove("name") ;
writer.WriteAtt ribute("method" , this.Method); base.Attributes .Remove("method ");
this.Attributes .Render(writer) ;
base.Attributes .Remove("action ");
if (base.ID != null) writer.WriteAtt ribute("id", base.ClientID); } } }
I have registered it in my ASPX page. It looks like this.
<%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt.aspx.cs" Inherits="_Defa ult" %> <%@ Register TagPrefix="ca" Namespace="ComI T.Applications. Common" Assembly="ComIT .Applications.C ommon" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title id="PageTitle" runat="server"> Default</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="imagetoo lbar" content="no" /> </head> <body> <ca:Form id="form1" method="post" runat="server"> </ca:Form> </body> </html>
When I switch my ASPX page to design mode, it shows following error.
Unable to cast object of type 'System.Web.Ui. Design.HtmlIntr insicControlDes igner' to type 'System.Web.Ui. Design.ControlD esigner'.
Why is this error coming? Am I doing anything wrong?
Thanks in advanced.
Tabi
Dear Kevin,
Thanks for answer. I am actually using url rewriting as described at msdn http://msdn.microsoft.com/library/de...lrewriting.asp
Please check out the "Handling Postbacks" section. I am using 100% same
code. The problem is that this code does not work in asp.net 2.0.
Is there any other way to work around this in asp.net 2.0?
Thanx once again.
Tabi
"Kevin Spencer" wrote: Well, my first question would have to be, why do you want to do this at all? You are breaking the object model of a WebForm by doing so.
The exception seems to indicate that the Designer for an HtmlForm is running into a problem with your override. Designers use various methods of the Controls they design, particularly those methods which render the Control in the Page, to render the Control at design-time. As I have no way of peeking inside the Designer code for the HtmlForm Control, that is all I can say. But it does beg the question I started with.
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer You can lead a fish to a bicycle, but it takes a very long time, and the bicycle has to *want* to change.
"Tabi" <Ta**@discussio ns.microsoft.co m> wrote in message news:98******** *************** ***********@mic rosoft.com... Hi,
I have just created a class that removes action attribute from HtmlForm. The code looks like here.
namespace ComIT.Applicati ons.Common { public class Form : System.Web.UI.H tmlControls.Htm lForm { protected override void RenderAttribute s(HtmlTextWrite r writer) { writer.WriteAtt ribute("name", this.Name); base.Attributes .Remove("name") ;
writer.WriteAtt ribute("method" , this.Method); base.Attributes .Remove("method ");
this.Attributes .Render(writer) ;
base.Attributes .Remove("action ");
if (base.ID != null) writer.WriteAtt ribute("id", base.ClientID); } } }
I have registered it in my ASPX page. It looks like this.
<%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt.aspx.cs" Inherits="_Defa ult" %> <%@ Register TagPrefix="ca" Namespace="ComI T.Applications. Common" Assembly="ComIT .Applications.C ommon" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title id="PageTitle" runat="server"> Default</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="imagetoo lbar" content="no" /> </head> <body> <ca:Form id="form1" method="post" runat="server"> </ca:Form> </body> </html>
When I switch my ASPX page to design mode, it shows following error.
Unable to cast object of type 'System.Web.Ui. Design.HtmlIntr insicControlDes igner' to type 'System.Web.Ui. Design.ControlD esigner'.
Why is this error coming? Am I doing anything wrong?
Thanks in advanced.
Tabi
Hi Tabi,
My apologies. You are correct. In any case, if you're having problems with
the Designer, I think you will have to write a custom Designer for your
form, or don't switch to Design view. It's the Designer that is throwing an
exception.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
"Tabi" <Ta**@discussio ns.microsoft.co m> wrote in message
news:35******** *************** ***********@mic rosoft.com... Dear Kevin,
Thanks for answer. I am actually using url rewriting as described at msdn http://msdn.microsoft.com/library/de...lrewriting.asp
Please check out the "Handling Postbacks" section. I am using 100% same code. The problem is that this code does not work in asp.net 2.0.
Is there any other way to work around this in asp.net 2.0?
Thanx once again.
Tabi
"Kevin Spencer" wrote:
Well, my first question would have to be, why do you want to do this at all? You are breaking the object model of a WebForm by doing so.
The exception seems to indicate that the Designer for an HtmlForm is running into a problem with your override. Designers use various methods of the Controls they design, particularly those methods which render the Control in the Page, to render the Control at design-time. As I have no way of peeking inside the Designer code for the HtmlForm Control, that is all I can say. But it does beg the question I started with.
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer You can lead a fish to a bicycle, but it takes a very long time, and the bicycle has to *want* to change.
"Tabi" <Ta**@discussio ns.microsoft.co m> wrote in message news:98******** *************** ***********@mic rosoft.com... > Hi, > > I have just created a class that removes action attribute from > HtmlForm. > The > code looks like here. > > namespace ComIT.Applicati ons.Common > { > public class Form : System.Web.UI.H tmlControls.Htm lForm > { > protected override void RenderAttribute s(HtmlTextWrite r writer) > { > writer.WriteAtt ribute("name", this.Name); > base.Attributes .Remove("name") ; > > writer.WriteAtt ribute("method" , this.Method); > base.Attributes .Remove("method "); > > this.Attributes .Render(writer) ; > > base.Attributes .Remove("action "); > > if (base.ID != null) > writer.WriteAtt ribute("id", base.ClientID); > } > } > } > > I have registered it in my ASPX page. It looks like this. > > <%@ Page Language="C#" AutoEventWireup ="true" > CodeFile="Defau lt.aspx.cs" > Inherits="_Defa ult" %> > <%@ Register TagPrefix="ca" Namespace="ComI T.Applications. Common" > Assembly="ComIT .Applications.C ommon" %> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d"> > > <html xmlns="http://www.w3.org/1999/xhtml" > > <head runat="server"> > <title id="PageTitle" runat="server"> Default</title> > <meta http-equiv="Content-Type" content="text/html; > charset=iso-8859-1" > /> > <meta http-equiv="Content-Script-Type" content="text/javascript" /> > <meta http-equiv="Content-Style-Type" content="text/css" /> > <meta http-equiv="imagetoo lbar" content="no" /> > </head> > <body> > <ca:Form id="form1" method="post" runat="server"> > </ca:Form> > </body> > </html> > > When I switch my ASPX page to design mode, it shows following error. > > Unable to cast object of type > 'System.Web.Ui. Design.HtmlIntr insicControlDes igner' to type > 'System.Web.Ui. Design.ControlD esigner'. > > > Why is this error coming? Am I doing anything wrong? > > > Thanks in advanced. > > > Tabi > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Carlos Kirkconnell |
last post by:
When printing, there is a definition for a Custom paper size, the custom
paper size can be setted programatically and everything is supposed to work
normally. But in windows 2000 and xp, the user must first define a paper
form with the size of the format. My application NEEDS to dinamically define
the size of paper to use. Using some unmanaged code, it is possible to
programatically define a new paper form. Is there any way of...
|
by: Alvo von Cossel I |
last post by:
hi,
i have been asked to make a good-looking app for a friend. i have an options
form with a big tabstrip in it.
1. how can i customize it e.g. change from the standard system style
tabcontrol to what i want?
2. if #1 isnt possible to do, what would be the best way to make something
look like a tabstrip?
|
by: Kyle Fitzgerald |
last post by:
I've started a web control library project and can build
my own controls to add to the toolbox in the .NET
environment. The problem I'm having is I want to create a
control just like the HTML table where I could drag my
control on the page and then drag and drop other controls
into the cells of the table. I've tried creating my own
and I tried to inherit from
system.ui.htmlcontrols.htmltable but I can not get it to
have the borders and...
|
by: |
last post by:
Trying to learn about manipulating collections of objects, and populating
these objects dynamically from datasources. Could someone post a code sample
that shows the following:
Instantiating a collection object -- say, a dictionary.
Populating that collection object with custom objects, say, Person. What I
really want to see is how to populate the properties of those Person objects
from a datasource: instantiate one Person, fill...
|
by: shanthsp2002 |
last post by:
well friends i have a small tip here which may be helpfull for u
there may be situations where we need to use a customized dilogue box while doveloping setup and dyployment project, so u can do that simply by using custom actions .
1st create setup and deployment project...
add->new project->windows application name it ReadmeDilogue
now customize Form as per ur requirement
now again
| |
by: Jake Forson |
last post by:
Hi there,
I'd like to re-create a form given only its resource file. I was going to
simply read the resource file and re-create the "Form" object and all its
controls as found in this file (applying all properties in the file and
relying on the default properties for those not found). After looking at
"InitializeComponent()" however (which is what I'm really trying to
re-produce here), can somone explain why this function does the...
|
by: zyberboy |
last post by:
I am a beginner in programming(c#),and this is my first post in this forum.
I want to know how to create custom shaped windows form in vs2005 express edition. I was able to create a oval shaped form by creating a bmp file in paint, setting it as a background & and also setting
FormBorderStyle to None
BackgroundImage to my bmp
TransparencyKey to blue(oval shape is red and rest is blue)
It works perfectly when run in 16 bit but when i...
|
by: Doc John |
last post by:
I need to create several Windows Forms and I'm thinking of creating a base
Form from which I can derive all Forms. Is it possible to include something
in that Base Form so that all Forms I create will use some specific controls
with some specific properties? For example, if I add to the Base Form a
button with a black background ans Arial Font, will all the Forms be
required to use this same Button?
Thanks.
|
by: str1ker |
last post by:
Hi,
I've been working with C# for quite a while now, and I'd like to start creating programs which aren't the usual old regular Windows controls. I'd like to have controls which are graphically unique, much like this (although this screenie doesn't show any, I intend to have buttons, and sliders and various other regular controls as well):
http://www.tok2.com/home/avionics/msfsx/main1.jpg
I've searched for 'Custom UI' in the help files,...
|
by: deepapanch |
last post by:
Hi All:
I am new to C#. Have created a simple outlook add-in, which adds a
command bar in Outlook. On click of the button, I would like to load
the a simple dialog with a Text Box and a Button. I would like to
populate the textbox with a value, before displaying it.
To accomplish this, I tried creating a custom control (Test Control)
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |