选择我已经制定了在ASP.NET预订票务应用上面的示例页面。我使用<asp:Table>
标签创建了上述布局。该<asp:RadioButtonList>
在第二行的第一小区可用,我的主要内容应该是在第二小区或第二排。每当我选择一个单选按钮第二小区的第2行中的内容应自动与该HomePage.aspx本身的新的aspx页面无需重新加载页面更新。我这样做,在HTML <frameset>
,但我想这样做在ASP.NET网页形式的.aspx形式。是否有可能在<asp:Table>
布局中做到这一点,或者我应该使用其他布局?如果有任何解决方案,最好在<asp:Table>
布局。
我用于上述布局的代码如下所示(仅ASP.NET页面的HTML部分)
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HomePage.aspx.cs" Inherits="TicketBookingRequest.HomePage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Online Ticket Booking Request Portal</title>
<link rel='stylesheet' type='text/css' href='Styles/Main.css'/>
<script type='text/javascript' src='Scripts/HomePage.js'></script>
</head>
<body>
<form id="main_form" runat="server">
<div>
<asp:Table ID="main_table" CssClass="table" runat="server" GridLines="Both" Height="100%" Width="100%">
<asp:TableRow ID="row_head" Height="100px">
<asp:TableCell ID="logo_cell" Width="20%">
</asp:TableCell>
<asp:TableCell Width="65%">
<asp:Label ID="label_heading" Text="ONLINE TICKET BOOKING REQUEST PORTAL" CssClass="label" runat="server"></asp:Label>
</asp:TableCell>
<asp:TableCell Width="15%">
<div id="clockDisplay" class="clockStyle"></div>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="row_main" Height="500px">
<asp:TableCell>
<asp:RadioButtonList ID="menu_list" CssClass="list" runat="server" RepeatDirection="Vertical" OnSelectedIndexChanged="menu_list_SelectedIndexChanged" AutoPostBack="true">
<asp:ListItem Value="profile" Text="Edit User Profile"></asp:ListItem>
<asp:ListItem Value="booking" Text="Request New Booking"></asp:ListItem>
<asp:ListItem Value="status" Text="View Existing Booking Status"></asp:ListItem>
<asp:ListItem Value="approval" Text="Request Awaiting Your Approval"></asp:ListItem>
<asp:ListItem Value="cancel" Text="Cancel Existing Booking"></asp:ListItem>
</asp:RadioButtonList>
</asp:TableCell>
<asp:TableCell ID="master_cell" ColumnSpan="2" runat="server">
<div id="master_cell_div" runat="server"></div>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="row_foot" Height="10%">
<asp:TableCell ColumnSpan="3">
<center>
<asp:Label Text="All Rights Reserved. Company Name @ 2016" CssClass="label" runat="server"></asp:Label><br />
<asp:Label Text="Click here to contact us." CssClass="label" runat="server"></asp:Label>
</center>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</div>
</form>
</body>
</html>
使用<div>
标签和InnerHtml
的CS代码如下并且这之后现在工作加入的AutoPostBack = “真”
protected void menu_list_SelectedIndexChanged(object sender, EventArgs e)
{
string value = menu_list.SelectedValue;
if (value.Equals("profile"))
{
master_cell_div.InnerHtml = "<p>WELCOME TO PROFILE</p>";
}
else if (value.Equals("booking"))
{
master_cell_div.InnerHtml = "<p>WELCOME TO BOOKING</p>";
}
else
{
master_cell_div.InnerHtml = "<p>WELCOME TO OTHERS</p>";
}
}
我加入用于细胞是代码,
<asp:TableCell ID="master_cell" ColumnSpan="2" Width="80%" runat="server">
<div id="master_cell_div" runat="server"></div>
</asp:TableCell>
但在这里,而不是使用innerHTML的是它可以创建5个不同的.aspx表单并将它们加载到对这些选择5个不同的单选按钮靶细胞?
但是''没有CS代码中的InnerHtml属性..我t里德。我认为InnerHtml是一个属性,仅用于像''这样的HTML标记。在ASP.NET的情况下,我们使用'',所以它不支持。 –
你是对的 - 这是一段时间。然后,您只需以相同的方式放置一个div标签即可。我会编辑。对不起混音 –
好的,应该更好。 –