<object> as server side HtmlGenericControl

M

Martin Eyles

Hi,

I want to have an <object> tag in my .aspx file, so that it is shown as part
of my webpage. I want to add data to the "data" attribute using server side
code, so I thought I would add the runat="server" attribute. In order for
ASP.net to treat this as a generic html control, I have declared it in my
..aspx.vb codebehind file as

Protected WithEvents myObjectTag As
System.Web.UI.HtmlControls.HtmlGenericControl

Unfortunatley I get the following error when I run the code

Parser Error

Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.

Parser Error Message: An object tag must contain a Class, ClassID or ProgID
attribute.

Does anyone have any idea how to prevent this happening?

Thanks,
Martin
 
B

bruce barker \(sqlwork.com\)

the <object> tag just like the <script> tag is a special server control if
runat server is specified. if you include runat=server on an object tag, its
expected to be com objected created on the serverside that the code behind
can access, not a client control.

-- bruce (sqlwork.com)
 
M

Martin Eyles

Got a solution that works

data="<%Page.Response.Write(theThingIWantToPutInData)%>"

so my object doesn't have to be server side.

Thanks,

M
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top