Solved

converting asp to aspx, need designer

Posted on 2013-02-01
6
363 Views
Last Modified: 2013-02-05
I've been converting a website to aspx from asp.

The problem I just hit is that I need to add controls to the new aspx page but the code behind won't recognize these controls and there isn't a designer page.  How do I make this work?
0
Comment
Question by:UnderSeven
  • 3
  • 3
6 Comments
 
LVL 41

Expert Comment

by:guru_sami
ID: 38844990
You won't have the designer page if your project type is "Website".
If you can share part of your code of .aspx and codebehind it will help identify the problem.
0
 

Author Comment

by:UnderSeven
ID: 38845013
This is the code segments, basically the aspx code ends with a if statement I am migrating to the code behind, to do that I am creating a control.  Codebehind is below.  The portion where the label is called to change the text is getting and undeclared error.

Closing and opening project, clicking on label in aspx design and switching back to code is not working.




<%@ Page Language="VB" AutoEventWireup="True"  CodeBehind="GBill_Registration.aspx.vb" Inherits="WebApplication1.Cogsdale.gbillreg" %>
<% REM ##########################################################################%>
<% REM                                                                          #%>
<% REM   GBill_Registration.asp                                                 #%>
<% REM   Cogsdale CSM on Web v1.10                                        	    #%>
<% REM                                                                         	#%>
<% REM   Copyright (c) 2001-05 Cogsdale.  All rights reserved.     				#%>
<% REM                                                                          #%>
<% REM ##########################################################################%>




<form method="POST" runat="server" action="gbill_registration.aspx?action=register"  onsubmit2="return validate(this);" name="Form1">
	<table border="0" style="border-collapse: collapse" bordercolor="#111111" width="800" bgcolor="#FFFFFF" cellpadding="2">
		<tr valign="top">
			<td align="center" width="325"><br><br><font color="#000000" size="2" face="Verdana">Example of a statement with your customer number highlighted.</font><br><br>
				<img border="0" src="./images/pictures/statementShot2.jpg" align="center" border="0">
			</td>
			<td width=475>
				<table border="0" cellspacing="0" cellpadding="5" width=100%>
					<tr>
						<td colspan="2" align="center" height="60">
							<div align="center"><font face="Arial" size="5" color="#336699">Registration Form</font></div><br>
							<asp:Label ID="lblwarn" runat="server" />
							<% if CustomerIDError <> "" or NameError <> "" or ServiceAddressError <> "" or EmailError <> "" or PasswordError <> "" or AgreeTermsError <> "" then%>
							<div align="left"><font color="#FF0000" size="2" face="Verdana"><B><CENTER>WARNING! We were unable to set up your account<BR> Please check your information and try again or call Customer Service at <%=Application1("CustServicePhoneNumber") %></CENTER></B></font></div>
							<% End If %>
<asp:label id="lblwarn" runat="server />

Open in new window


Namespace Cogsdale


    Partial Public Class gbillreg
        Inherits getoption



        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

            If allSecure("action") = "register" Then
                Dim strErrorMsg = ""
                Dim CustomerID = allSecure("CustomerID")
                Dim Name = Trim(Replace(allSecure("Name"), ".", ""))
                Dim ServiceAddress = Trim(allSecure("ServiceAddress"))
                Dim Email = Trim(allSecure("Email"))
                Dim Email2 = Trim(allSecure("Email2"))
                Dim Password = Trim(allSecure("Password"))
                Dim Password2 = Trim(allSecure("Password2"))
                Dim AgreeTerms = allSecure("AgreeTerms")
                Dim rsCustomer As System.Data.SqlClient.SqlDataReader
                Dim CustomerIDError = ""
                Dim NameError = ""
                Dim ServiceAddressError = ""
                Dim EmailError = ""
                Dim PasswordError = ""
                Dim AgreeTermsError = ""
                Dim CustName As String
                Dim isServiceAddressRequired = Application1("IsServAddressRequired")
                Dim callFunctionStr As New System.Data.SqlClient.SqlCommand()
                Dim connect As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection()
                Const serviceAddressMaxLength = 30
                Dim ServiceAddress1 As String
                Dim ServiceAddress2 As String
                Dim emailFrom, emailto, subject, content, sendEmail As String ' for email section


                Dim maxCustNumLen
                maxCustNumLen = CInt(Application1("MaxCustNumberLength"))


                lblwarn.text = "text"

Open in new window

0
 
LVL 41

Expert Comment

by:guru_sami
ID: 38845292
What error do you get?
for lblwarn.text = "text" it should be lblwarn.Text="text"

Also you cannot simply bring code from asp to .aspx page.
You should not use If...Else inside your .aspx page. Whatever conditions you need, try to do that in the code-behind.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:UnderSeven
ID: 38845311
What error do you get?
The error is that lblwarn is undeclared
for lblwarn.text = "text" it should be lblwarn.Text="text"


Also you cannot simply bring code from asp to .aspx page.
You should not use If...Else inside your .aspx page. Whatever conditions you need, try to do that in the code-behind.
I know this, the code snippet is a work in progress, I was trying to fix the lines one at a time.  I've already migrated quite a few other pages without this problem, though I may not have been trying to add new controls in those instances.
0
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 38845535
What I would do is one thing at a time instead of porting everything at a time.
Sometimes if the page cannot be compiled, the designer won't pickup the changes.

Start with a blankpage and adjusting it as per asp.net standards. And since you are porting it, you don't want to do things same as in asp, but improve it as well.
0
 

Author Closing Comment

by:UnderSeven
ID: 38855419
So this is kind of what I'm having to do.  In addition I just manually created the designer file and then it started working. I know it isn't supposed to be something that you should need to create, or edit, but by making it myself it fixed the problem.  I am also taking your advice and rather than pasting the asp page and updating it I am porting it over line by line and addressing if the line is properly written before putting it in.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now