Go Back   SitePoint Forums > Forum Index > Program Your Site > .NET
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Nov 6, 2009, 02:15   #1
webnoob
SitePoint Wizard
 
webnoob's Avatar
 
Join Date: Dec 2004
Location: At My Desk!!
Posts: 1,620
Unable to cast .HtmlGenericControl as .HtmlMeta

Guys,

I have some code I have just moved to another machine running IIS7 (the same as my web server). When I try and run it on the new machine I am getting this invalid typecast error. I am not sure why it doesn't work. Both machines are running the same version of ASP.NET.

My tag is declared like:

Code:
<meta name="keywords" id="lbSiteKeywords" runat="server" />
And my code to declare and sign it is (code is in Delphi/Pascal):

Code:
lbSiteKeywords: System.Web.UI.HtmlControls.HtmlMeta;
Code:
lbSiteKeywords := Page.Master.FindControl('lbSiteKeywords') as HtmlMeta;
Does anyone have any ideas why this could be failing. As you can see I am making no mention to HtmlGenericControl.
webnoob is offline   Reply With Quote
Old Nov 6, 2009, 02:35   #2
webnoob
SitePoint Wizard
 
webnoob's Avatar
 
Join Date: Dec 2004
Location: At My Desk!!
Posts: 1,620
Oh dear. Ignore me. I added runar="server" to the <head> html tag and didn't notice.
webnoob is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 17:52.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved