Solved

converting asp to aspx, need designer

Posted on 2013-02-01
6
369 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

717 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