Solved

converting asp to aspx, need designer

Posted on 2013-02-01
6
366 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

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.

Question has a verified solution.

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

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:…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

821 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