2015-09-14 30 views
-5

目標:將html網頁鏈接到Microsoft訪問文件。此訪問文件非常大,並且具有標題爲:客戶名稱,訂單號,街道地址,追蹤號碼和驗證日期的列。對於網頁,我們希望asp文本框和按鈕可以搜索後端的微軟訪問文件。新來asp和不明白爲什麼我的文本框不可見

我們使用微軟表達式4來編寫.aspx文件,並且它在設計視圖中正確呈現我們想要的。但是,在複製代碼(.aspx文件)並將其放入notepad ++並將其另存爲html文件後,瀏覽器窗口中將看不到按鈕。如何將.aspx文件轉換爲在瀏覽器上呈現?謝謝!

下面是代碼:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<% @ Page Language="C#" %> 
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> 
<title>Returns Received Report</title> 

<style type="text/css"> 
.auto-style1 { 
    font-size: xlarge; 
} 
.auto-style2 { 
    text-align: center; 
} 
.auto-style3 { 
    margin-left: 0px; 
} 
.auto-style4 { 
    margin-left: 280px; 
} 

.auto-style5 { 
    margin-left: 0px; 
    margin-bottom: 0px; 
} 


</style> 
</head> 
<body> 


<div class="auto-style2"> 
&nbsp;<body bgcolor="#black"><p></p> 
    <div class="auto-style2"> 
<br /> 

<br /> 
<strong><span class="auto-style1"><u>Search for a Return:</u><br/> 
     <br /> 
</span></strong> 
    </div> 


    <form id="form1" runat="server"> 
     <div class="auto-style4"> 
    <asp:TextBox id="Customer" runat="server" Visible="true" Width="261px" CssClass="auto-style5" Height="22px" BackColor="Black" BorderColor="Black"></asp:TextBox> 
      <asp:Button id="Button1" runat="server" Visible="true" PostBackUrl="Customer.aspx" Text="Search by Customer" BorderStyle="Outset" /> 
     </div> 

    <br /> 
    <br /> 
    <asp:TextBox id="PO" runat="server" Visible="true" Width="261px" EnableViewState="True"></asp:TextBox> 
    <asp:Button id="Button2" runat="server" Visible="true" PostBackUrl="Order Number.aspx" Text="Search by Order Number" BorderStyle="Outset" Width="181px" /> 
    <br /> 
    <br /> 
    <asp:TextBox id="ADDRESS" runat="server" Visible="true" Width="261px"></asp:TextBox> 
    <asp:Button id="Button3" runat="server" PostBackUrl="Street_Address.aspx" Text="Search by Street Address" BorderStyle="Outset" Width="181px" /> 
    <br /> 
    <p> 
    <asp:TextBox id="TrackingNumber" runat="server" Visible="true" Width="261px"></asp:TextBox> 
    <asp:Button id="Button4" runat="server" PostBackUrl="TrackingNumber.aspx" Text="Search by Tracking Number" BorderStyle="Outset" Width="181px" /> 
    </p> 
    <p> 
    <asp:TextBox id="VerifiedDate" runat="server" Visible="true" Width="261px" CssClass="auto-style3"></asp:TextBox> 
    <asp:Button id="Button5" runat="server" PostBackUrl="TrackingNumber.aspx" Text="Search by Verified Date" BorderStyle="Outset" Width="181px" /> 
    </p> 
<asp:TextBox runat="server" id="TextBox1"></asp:TextBox> 
    </div> 
    <p>&nbsp;</p> 
</form> 

    </body> 

</html> 
+4

HTML不解釋爲ASP.Net代碼。這將永遠不會工作。 –

+0

'asp'!='asp.net' – freefaller

+4

顯然,您對http://stackoverflow.com/questions/32529455/asp-net-controls-not-visible-in-ie8的迴應並不滿意。您需要服務器端.NET框架來執行。對於瀏覽器來說, Igor

回答

1

您聲明的目標是將您的網頁鏈接到您的Access數據庫。這是可能的,但你需要先做一些基礎工作。是的,請查看asp.net上的入門教程,microsoftvirtualacademy.com等。

但是,您似乎缺少基本知識。 HTML文件是可以在桌面上雙擊的文件,它會在瀏覽器中打開。一個ASP.net頁面被設計爲在服務器上運行。

這意味着當它從服務器請求時,首先完成一定量的處理,然後服務器將生成發送到瀏覽器的HTML。這使服務器能夠查詢您的Access數據庫,接收輸入,處理輸入並按需生成HTML。

在Windows上,您可能會使用類似IIS的東西。如果您下載Visual Studio或WebMatrix,它將運行一個開發服務器以供您測試您的代碼。當您準備部署時,您需要一臺服務器(本地,您的網絡或第三方託管服務提供商),以便任何人都能看到您的頁面。

+0

感謝您的幫助我真的很感激! – dkwalker2392

1

.aspx文件是服務器將與由ASP定義調用數據填充模板文件。將文件重命名爲html將不允許服務器使用ASP調用,因爲它們不再由服務器處理。

+0

這是問題,但不是一個解決方案...謹慎詳細說明? :) –

+0

你不能把它用作* .aspx嗎?如果顯示正確,你爲什麼需要轉換它?將數據填充到網頁中的其他選項可能並不簡單。如果您試圖從網站中刪除ASP框架,您仍然需要一種機制來填充頁面。 – Rob10e

+0

我們希望能夠創建一個網頁,我們的代理可以進行必要的搜索。但將其從微軟表達式轉移到瀏覽器時感到困惑。 – dkwalker2392