473,324 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

(VS2005) Cannot use web user control in the aspx page!

I want to include ascx file, it displays some contents.
therefore I drag the ascx file from the solution explorer into the design
window of the aspx file.

However, in case that ascx file(not ascx.cs) contains select tag (<select>),
UserControl box displays error messages,
"An unhandled exception has occured. Specified cast is not valid."

so I deleted the <select> tag. results? It works~ T_T;

There is any difference in the VS2005? Please help me.
the contents of aspx file:

<%@ Page Language="C#" CompileWith="SomeFile.aspx.cs"
ClassName="SomeFile_aspx" %>
<%@ Register TagPrefix="uc1" TagName="uc_SomeFile_step1"
Src="uc_SomeFile_step1.ascx" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
...
</head>
<body text="#000000" bgColor="#ffffff" leftMargin="0" topMargin="0">

<form method=post encType="multipart/form-data" id="form1" runat="server">

<uc1:uc_WriteArticle_step1 ID="Uc_WriteArticle_step1" Runat="server" />

</form>
</body>
</html>
ascx file:
<%@ Control Language="C#" CompileWith="uc_SomeFile_step1.ascx.cs"
ClassName="uc_SomeFile_step1_ascx" %>

<select id="m_section" runat="server">
<option value="" selected>-------</option>
</select>
Thanks.

InHyuk, Song.
fl******@hanmail.net
Nov 18 '05 #1
2 1627
Select isn't a server control....
"InHyuk, Song" <ih****@mozart.kaist.ac.kr> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I want to include ascx file, it displays some contents.
therefore I drag the ascx file from the solution explorer into the design
window of the aspx file.

However, in case that ascx file(not ascx.cs) contains select tag (<select>), UserControl box displays error messages,
"An unhandled exception has occured. Specified cast is not valid."

so I deleted the <select> tag. results? It works~ T_T;

There is any difference in the VS2005? Please help me.
the contents of aspx file:

<%@ Page Language="C#" CompileWith="SomeFile.aspx.cs"
ClassName="SomeFile_aspx" %>
<%@ Register TagPrefix="uc1" TagName="uc_SomeFile_step1"
Src="uc_SomeFile_step1.ascx" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
..
</head>
<body text="#000000" bgColor="#ffffff" leftMargin="0" topMargin="0">

<form method=post encType="multipart/form-data" id="form1" runat="server">
<uc1:uc_WriteArticle_step1 ID="Uc_WriteArticle_step1" Runat="server" />
</form>
</body>
</html>
ascx file:
<%@ Control Language="C#" CompileWith="uc_SomeFile_step1.ascx.cs"
ClassName="uc_SomeFile_step1_ascx" %>

<select id="m_section" runat="server">
<option value="" selected>-------</option>
</select>
Thanks.

InHyuk, Song.
fl******@hanmail.net

Nov 18 '05 #2
meaning remove the runat

"InHyuk, Song" <ih****@mozart.kaist.ac.kr> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I want to include ascx file, it displays some contents.
therefore I drag the ascx file from the solution explorer into the design
window of the aspx file.

However, in case that ascx file(not ascx.cs) contains select tag (<select>), UserControl box displays error messages,
"An unhandled exception has occured. Specified cast is not valid."

so I deleted the <select> tag. results? It works~ T_T;

There is any difference in the VS2005? Please help me.
the contents of aspx file:

<%@ Page Language="C#" CompileWith="SomeFile.aspx.cs"
ClassName="SomeFile_aspx" %>
<%@ Register TagPrefix="uc1" TagName="uc_SomeFile_step1"
Src="uc_SomeFile_step1.ascx" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
..
</head>
<body text="#000000" bgColor="#ffffff" leftMargin="0" topMargin="0">

<form method=post encType="multipart/form-data" id="form1" runat="server">
<uc1:uc_WriteArticle_step1 ID="Uc_WriteArticle_step1" Runat="server" />
</form>
</body>
</html>
ascx file:
<%@ Control Language="C#" CompileWith="uc_SomeFile_step1.ascx.cs"
ClassName="uc_SomeFile_step1_ascx" %>

<select id="m_section" runat="server">
<option value="" selected>-------</option>
</select>
Thanks.

InHyuk, Song.
fl******@hanmail.net

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: SampathTangudu | last post by:
Hi, We are trying to use the Hash Tables for passing information from one aspx page to another aspx page. We are using the below code. IsolatedStorageFile isoStore =...
0
by: C Gatto | last post by:
Hello, In a VS2003 app I have an aspx page (default.aspx) with a PlaceHolder defined (phMain). In my aspx code-behind I am dynamically creating a reference to a web user control...
4
by: Samy | last post by:
Hi There, I have a user control with a textbox and a button which when clicked opens a calendar control(calendar.aspx page). When I select a date from the calendar control, the date is supposed to...
19
by: Alan Silver | last post by:
Hello, I have been developing ASP.NET with a text editor so far (better way to learn initially), and have now been trying Visual Web Developer. I want to create a project for an existing site...
5
by: GaryDean | last post by:
(my original post was inaccurate but this post accurately describes what I think is a very bad vs2005 bug) short description... Deleting a dataset and recreating it from the dataadapter causes...
3
by: Tim_Mac | last post by:
hi, i'm using a web application project in VS2005. i have a User Control Template.ascx in the '~/UserControls' folder with the following signature: public partial class GpTemplate :...
2
by: rn5a | last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with the IDs 'txt1' & 'txt2' respectively. To use this user control in an ASPX page, the following Register directive will be...
1
by: David Rees | last post by:
I haven't yet installed the VS2005 Web Application project type, since I'm naivly waiting for VS2005SP1 to come out before Duke Nukem Forever. My VS2005 installation also crashed twice whilst...
8
by: =?Utf-8?B?UGV0ZXJX?= | last post by:
I install Visual Studio 2005 Pro on Vista. I open and migrate a 2003 web project to 2005. I attempt to browse an aspx file from the Solution Exploer. It displays a blank html page. I create a...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.