Solved

converting asp to aspx, need designer

Posted on 2013-02-01
6
367 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

820 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