Solved

Populate aspx page from application object

Posted on 2008-06-25
2
286 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 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

790 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