Click to See Complete Forum and Search --> : Help with a sub procedure and request.querystring


binici
09-08-2006, 03:45 PM
Hello all:

I am in a bit of a pickle because I have bad habits of using ASP methods to write out/ output code page-render functions. I would like to figure out how to retrieve a value from a previous page that has several links (its a how to type of page with steps 1-10) and then use only single page to write out the content depending on which step they clicked. I have this so far, but not sure how this would work? :confused:


This would be the single page that would write out the content depending on which step the user clicks... so example of content

<script language="vb" runat="server">
Public Sub Page_Load
Dim strParamData as String
StrParamData = Request.QueryString( "display_name" )

If StrParamData = "step1" Then



Else

Response.write("Please choose a step")

End If

End Sub
</script>
<asp:DataGrid ID="step1">
<div class="maintitle">Step 1 : Are You Ready? </div><br>
<table width="425" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<p>Knowledge and experience are the keys to successful real estate transactions. REALTOR.comŪ contains an enormous amount of valuable information, and such data -- combined with the expertise, experience and training of local REALTORSŪ -- can be the essential keys to your success.</p>

<p>One of the keys to making the homebuying process easier and more understandable is planning. In doing so, you'll be able to anticipate requests from lenders, lawyers and a host of other professionals. Furthermore, planning will help you discover valuable shortcuts in the homebuying process. </p>

<p><strong>Do You Know What You Want?</strong></p>
<ul>
<p>Whether you are a first-time homebuyer or entering the marketplace as a repeat buyer, you need to ask why you want to buy. Are you planning to move to a new community due to a lifestyle change or is buying an option and not a requirement? What would you like in terms of real estate that you do not now have? Do you have a purchasing timeframe? </p>

<p>Whatever your answers, the more you know about the real estate marketplace, the more likely you are to effectively define your goals. As an interesting exercise, it can be worthwhile to look at the questions above and to then discuss them in detail when meeting with local REALTORSŪ. </p>
</ul>
<p><strong>Do You Have The Money?</strong></p>
<ul>
<p>Homes and financing are closely intertwined. (Financing is the difference between the purchase price and the downpayment, commonly referred to as debt or the mortgage.) The good news is that over the years new and innovative loan programs have evolved which require a 5 percent downpayment or less. In fact, a number of programs now allow purchasers to buy real estate with nothing down. </p>

<p>In addition to a down payment, purchasers also need cash for closing costs (the final costs associated with closing the loan). Several newly emerging loan programs not only allow the purchase of a home with no money down, but also underwrite closing costs. </p>

<p>Not everyone, however, elects to purchase with little or no money down. Less money down means higher monthly mortgage payments, so most homebuyers choose to buy with some cash up front. </p>

<p>As to closing costs, in markets where buyers have leverage, it may be possible to negotiate an offer for a home that requires the owner to pay some or all of your settlement expenses. Speak with local REALTORSŪ for details. </p>
</ul>
<p><strong>Is Your Financial House in Order?</strong></p>
<ul>
<p>Those great loans with little or nothing down are not available to everyone: You need good credit. For at least one year prior to purchasing a home, you should assure that every credit card bill, rent check, car payment and other debt is paid in full and on time.</p>
</ul>
</td>
</tr>
</table>
</asp:DataGrid>


Any suggestions or ideas how to simplify thise? Should I be using ASP server controls? Multiple procedures?

Thank you,

Robert

binici
09-11-2006, 01:09 PM
Ok, to simplify matters, I created a vb file to keep the html and logic clean...

the aspx file on how it should look...


<%@ Register TagPrefix="GenHead" TagName="GenericPageHeader" Src="/template/genericheader.ascx"%>
<%@ Register TagPrefix="GenFoot" TagName="GenericPageFooter" Src="/template/genericfooter.ascx"%>
<%@ Page Language="vb" trace="false" EnableViewState="false" Inherits="MyCodeBehind" Src="Steps.aspx.vb" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Steps to Buying a Home - Step 1 - Pacific West Association of REALTORS&reg;</TITLE>
<!-- #Include Virtual="/template/genericscripts.ascx" --><% 'Contains generic scripts used on all pages %>
<link href="/css/menu.css" rel="stylesheet" type="text/css"><% 'CSS for topbar %>
<link href="/css/layout1small.css" rel="stylesheet" type="text/css"><% 'CSS for 2 column layout %>
<link href="/css/textstyles.css" rel="stylesheet" type="text/css"><% 'CSS for basic text %>
<link href="/css/custom.css" rel="stylesheet" type="text/css"><% 'CSS for PWAOR custom text %>
</HEAD>
<BODY onload="self.focus();">
<div class="wrapper">
<div class="container"><img src="/template/backgroundboxes/1column_top_small.gif" width="485" height="9"><div class="center">
<asp:DataList ID="step1" runat="server" BorderWidth="0" CellSpacing="0" CellPadding="0">

Page 1 content goes here...

</asp:DataList>
<asp:DataList ID="step2" runat="server" BorderWidth="0" CellSpacing="0" CellPadding="0">

Page 2 content goes here...

</asp:DataList>


<form name="ConsumerGuide" runat="server">
<asp:TextBox ID="test" runat="server"></asp:TextBox></form>
^^
Used for testing if the values are being read correctly

<table width="425" cellspacing="0" cellpadding="0" border="0">
<tr>
<td align="center" height="30">
<table width="350" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="40">Steps</td>
<td align="center" height="20" width="15"><a class="GlossaryPageSelected" href="/_Consumers/BuyingProcess/Step1.aspx">1</a></td><td align="center"><img src="/_Consumers/images/BlueDivide.gif" width="4" height="10"></td>
<td align="center" width="15"><a class="GlossaryPage" href="/_Consumers/BuyingProcess/Step2.aspx">2</a></td><td align="center"><img src="/_Consumers/images/BlueDivide.gif" width="4" height="10"></td>
<td align="center" width="15"><a class="GlossaryPage" href="/_Consumers/BuyingProcess/Step3.aspx">3</a></td><td align="center"><img src="/_Consumers/images/BlueDivide.gif" width="4" height="10"></td>
<td align="center" width="15"><a class="GlossaryPage" href="/_Consumers/BuyingProcess/Step4.aspx">4</a></td><td align="center"><img src="/_Consumers/images/BlueDivide.gif" width="4" height="10"></td>
<td align="center" width="15"><a class="GlossaryPage" href="/_Consumers/BuyingProcess/Step5.aspx">5</a></td><td align="center"><img src="/_Consumers/images/BlueDivide.gif" width="4" height="10"></td>
<td align="center" width="15"><a class="GlossaryPage" href="/_Consumers/BuyingProcess/Step6.aspx">6</a></td><td align="center"><img src="/_Consumers/images/BlueDivide.gif" width="4" height="10"></td>
<td align="center" width="15"><a class="GlossaryPage" href="/_Consumers/BuyingProcess/Step7.aspx">7</a></td><td align="center"><img src="/_Consumers/images/BlueDivide.gif" width="4" height="10"></td>
<td align="center" width="15"><a class="GlossaryPage" href="/_Consumers/BuyingProcess/Step8.aspx">8</a></td><td align="center"><img src="/_Consumers/images/BlueDivide.gif" width="4" height="10"></td>
<td align="center" width="15"><a class="GlossaryPage" href="/_Consumers/BuyingProcess/Step9.aspx">9</a></td><td align="center"><img src="/_Consumers/images/BlueDivide.gif" width="4" height="10"></td>
<td align="center" width="20"><a class="GlossaryPage" href="/_Consumers/BuyingProcess/Step10.aspx">10</a></td><td align="center"><img src="/_Consumers/images/BlueDivide.gif" width="4" height="10"></td>
</tr>
</table>
</td>
</tr>
</table>

<p align="center"><input type="Button" value="Close" onclick="self.close()"></p>

<p>&nbsp;</p>

</div><% 'end center box %>
<img src="/template/backgroundboxes/1column_bot_small.gif" width="485" height="10"></div>
</div>
</div>
</BODY>
</HTML>




The codebehind...


Option Strict Off

Imports System
Imports System.Collections
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Configuration

Public Class MyCodeBehind : Inherits Page

Public step1 As DataList
Public test As System.Web.UI.WebControls.TextBox
Public content As System.Web.UI.WebControls.TableCell

Public Sub Page_Load()
Dim StrParamData = Request.QueryString.GetValues("display_page")(0)
Dim strTest = "Hello World"
Dim content1 = StrParamData

If StrParamData = "2" Then

test.Text = content1

Else

test.Text = strTest

End If

End Sub

End Class


Anyone want to comment or help out? Thanks...

binici
09-12-2006, 05:39 PM
Never mind folks, I figured out a nice method. I used label controls and hide them, but when the arguement is true I display the neccessary label that pertains to that page. So much powerful than classic asp logic.

Thank you!