Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Populate aspx page from application object

Posted on 2008-06-25
2
Medium Priority
?
318 Views
Last Modified: 2010-04-21
My code is attached

The code attached is the code which my primary site is redirecting to

I have text fields on this form that i want to fill from the following variables

application("WebUserContact")
application("WebUserCompany")
dict("JobDetailDescription")
dict("PurchaseOrder")
dict("ProofEmail")


should fill the text fields

txtname
txtcompany
txtpo
txtemail
txtdescription

The result would be that when the form loads these values will be populated.
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Upload.aspx.cs" Inherits="_Default" %>
 
<%@ Register Assembly="Mediachase.FileUploader" Namespace="Mediachase.FileUploader.Web.UI"
    TagPrefix="cc1" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>KG File Upload</title>
    <link href="customerPortal.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="upload" runat="server" onsubmit="return validateData()">    
    <div style="left: 0px; position: absolute; top: 0px;">
        <asp:Image ID="imgHeader" runat="server" ImageUrl=".\grafix\home_page_logo.jpg" />
    </div>                
    <div id="divRAD" style="width: 764px; height: 60px; position: absolute; left: 10px; top: 110px;">
        <div id="divUploadInstructions" style="width: 750px; height: 58px; border-top-style: double; border-right-style: double; border-left-style: double; background-color: silver; border-bottom-style: double;">
            Use the "Browse" button to choose up to three files to be uploaded. 
            To decrease upload time, we recommend using
            <asp:HyperLink ID="lnkWinZip" runat="server" NavigateUrl="http://www.winzip.com"
                Target="_blank">WinZip</asp:HyperLink>
            or
            <asp:HyperLink ID="lnkStuffit" runat="server" NavigateUrl="http://www.stuffit.com"
                Target="_blank">Stuffit</asp:HyperLink>
            to compress the files. Warning: Files over 350MB may not upload properly when using
            Safari version 1.x</div>
        &nbsp; &nbsp;
        <asp:RequiredFieldValidator ID="rfvFile1" runat="server" ControlToValidate="mcFileUp"
            ErrorMessage="File #1: Name is Missing" SetFocusOnError="True"></asp:RequiredFieldValidator>&nbsp;
        <table bordercolor="#000000" bordercolordark="#000000" cellpadding="3" cellspacing="1"
            class="customerInfoTable" style="width: 754px">
            <tr>
                <td align="right" style="width: 88px">
                    <asp:Label ID="lblFile1" runat="server">File #1:</asp:Label></td>
                <td style="width: 493px">
                    <cc1:McHtmlInputFile ID="mcFileUp" runat="server" Height="25px" Size="60" />
                </td>
                <td align="right" style="width: 45px">
                    <asp:Label ID="lblType1" runat="server" Width="36px">Type:</asp:Label></td>
                <td>
                    <asp:DropDownList ID="lstFileType1" runat="server" Width="137px">
                    </asp:DropDownList></td>
            </tr>
            <tr>
                <td align="right" style="width: 88px">
                    <asp:Label ID="lblFile2" runat="server">File #2:</asp:Label></td>
                <td style="width: 493px">
                    <cc1:McHtmlInputFile ID="mcFileUp2" runat="server" Height="25px" Size="60" />
                </td>
                <td align="right" style="width: 45px">
                    <asp:Label ID="lblType2" runat="server" Width="36px">Type:</asp:Label></td>
                <td>
                    <asp:DropDownList ID="lstFileType2" runat="server" Width="137px">
                    </asp:DropDownList></td>
            </tr>
            <tr>
                <td align="right" style="width: 88px">
                    <asp:Label ID="lblFile3" runat="server">File #3:</asp:Label></td>
                <td style="width: 493px">
                    <cc1:McHtmlInputFile ID="mcFileUp3" runat="server" Height="25px" Size="60" />
                </td>
                <td align="right" style="width: 45px">
                    <asp:Label ID="lblType3" runat="server" Width="36px">Type:</asp:Label></td>
                <td>
                    <asp:DropDownList ID="lstFileType3" runat="server" Width="137px">
                    </asp:DropDownList></td>
            </tr>
        </table>
        &nbsp;
        &nbsp; &nbsp;&nbsp;
        <br />
        
       
        
        <div id="Div2" style="width: 750px; height: 19px; border-top-style: double; border-right-style: double; border-left-style: double; background-color: silver; border-bottom-style: double;">
            Be certain to provide details about this file upload to avoid delays in processing
            your order.</div>
        <br />
        <table border="0" bordercolor="#000000" bordercolordark="#000000" cellpadding="3"
            cellspacing="1" style="width: 754px" class="customerInfoTable">            
            <tr>
                <td align="right" style="width: 138px">
                    <asp:Label ID="lblName" runat="server">Name:</asp:Label></td>
                <td align="left" style="width: 514px">
                    <asp:TextBox ID="txtName" runat="server" Width="300px"></asp:TextBox>
                    *
                    <asp:RequiredFieldValidator ID="rfvName" runat="server" ControlToValidate="txtName" ErrorMessage="bugu" SetFocusOnError="True">Required</asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td align="right" style="width: 138px">
                    <asp:Label ID="lblCompany" runat="server">Company Name:</asp:Label></td>
                <td align="left" style="width: 514px">
                    <asp:TextBox ID="txtCompany" runat="server" Width="300px"></asp:TextBox>
                    *
                    <asp:RequiredFieldValidator ID="rvfCompany" runat="server" ControlToValidate="txtCompany"
                        ErrorMessage="bugu" SetFocusOnError="True">Required</asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td align="right" style="height: 30px; width: 138px;">
                    <asp:Label ID="lblPO" runat="server">P.O. Number:</asp:Label></td>
                <td align="left" style="height: 30px; width: 514px;">
                    <asp:TextBox ID="txtPO" runat="server"></asp:TextBox></td>
            </tr>
            <tr>
                <td align="right" style="width: 138px">
                    <asp:Label ID="lblEmail" runat="server">E-mail Address:</asp:Label></td>
                <td align="left" style="width: 514px">
                    <asp:TextBox ID="txtEmail" runat="server" Width="300px"></asp:TextBox>
                    *
                    <asp:RequiredFieldValidator ID="rfvEmail" runat="server" ControlToValidate="txtEmail" SetFocusOnError="True">Required</asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td align="right" style="width: 138px">
                    <asp:Label ID="lblPhone" runat="server" Width="121px">Phone:</asp:Label></td>
                <td align="left" style="width: 514px">
                    <asp:TextBox ID="txtPhone" runat="server"></asp:TextBox>
                    *
                    <asp:RequiredFieldValidator ID="rfvPhone" runat="server" ControlToValidate="txtPhone" SetFocusOnError="True">Required</asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td align="right" style="width: 138px">
                    <asp:Label ID="lblRep" runat="server" Width="137px">KG Account Rep:</asp:Label></td>
                <td align="left" style="width: 514px">
                    <asp:DropDownList ID="lstAccountRep" runat="server" OnSelectedIndexChanged="lstAccountRep_SelectedIndexChanged"
                        Width="155px">
                    </asp:DropDownList>
                    <asp:RequiredFieldValidator ID="rfvAccountRep" runat="server" ControlToValidate="lstAccountRep"
                        SetFocusOnError="True">Required</asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td align="right" style="width: 138px">
                    <asp:Label ID="lblDescription" runat="server">Job Description:</asp:Label></td>
                <td align="left" style="width: 514px">
                    <asp:TextBox ID="txtDescription" runat="server" Height="77px" Rows="3" TextMode="MultiLine"
                        Width="499px"></asp:TextBox></td>
            </tr>
        </table>
        <br />
        &nbsp;
        <asp:Button ID="btnSubmit" runat="server" CssClass="uploadButton" OnClick="btnSubmit_Click" Text="Upload" />
        <asp:Button ID="btnCancel" runat="server" CssClass="uploadButton" OnClick="btnCancel_Click" Text="Cancel" CausesValidation="False" /><br />
        <br />
        If you experience problems uploading your files, click
        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="mailto:webmaster@Testee.com">here</asp:HyperLink>
        to notify the webmaster<br />
        <br />
        &nbsp;</div><div style="left: 0px; position: absolute; top: 0px;">
            <asp:Image ID="Image1" runat="server" ImageUrl=".\grafix\home_page_logo.jpg" />
        </div>
        <div style="left: 0px; position: absolute; top: 780px;">
            <asp:Image ID="Image2" runat="server" ImageUrl="~/grafix/why_bottom_banner.jpg" />
        </div>
    </form>
    
    <SCRIPT LANGUAGE="JavaScript" type="text/javascript" src="CustomerPortal.js"></SCRIPT> 
 
                
</body>
</html>

Open in new window

0
Comment
Question by:rmardis
2 Comments
 
LVL 18

Accepted Solution

by:
philipjonathan earned 2000 total points
ID: 21871596
In your code behind, handle the Page_Load event and key in the following.
Alternatively, enclose the following code with <script runat="server">.
  Sub Page_Load
    If Not IsPostBack Then
      txtname.Text = application("WebUserContact")
      txtcompany.Text = application("WebUserCompany")
      txtpo.Text = dict("PurchaseOrder")
      txtemail.Text = dict("ProofEmail")
      txtdescription.Text = dict("JobDetailDescription")
    End If
  End Sub

Open in new window

0
 

Author Closing Comment

by:rmardis
ID: 31470842
You nailed it!  Thank you so much for the speedy answer!!!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

927 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