前台:
<style type="text/css">
a
{
text-decoration: none;
font-size: 13px;
color: #666666;
}
a:hover
{
text-decoration: none;
color: #666666;
}
.style1
{
width: 380px;
color:#666666;
font-size: 13px;
font-family: 黑体;
}
.style3
{
width: 300px;
height: 20px;
color:#666666;
font-size: 13px;
font-family: 宋体;
}
.style4
{
width: 80px;
height: 20px;
color:#666666;
font-size: 13px;
font-family: 黑体;
}
.NewsTabMenu
{
background-image: url("../images/tab2off.gif");
width: 95px;
height: 27px;
font-family: 黑体;
color: #666666;
font-size: 15px;
font-weight: bold;
line-height: 20px;
text-decoration: none;
text-align: center;
}
.selectedStyle
{
background-image: url("../images/tab2off.gif");
width: 95px;
height: 27px;
font-family: 黑体;
font-size: 15px;
font-weight: bold;
text-decoration: none;
text-align: center;
}
.selectedStyle a,a:hover{text-decoration:none; color:#1A8A98;}
</style>
<div style="float: left;">
<asp:Menu ID="Menu1" runat="server" OnMenuItemClick="Menu1_MenuItemClick" Orientation="Horizontal"
Width="320px">
<LevelMenuItemStyles>
<asp:MenuItemStyle CssClass="NewsTabMenu"/>
</LevelMenuItemStyles>
<LevelSelectedStyles>
<asp:MenuItemStyle CssClass="selectedStyle" BorderStyle="None"
ForeColor="#1A8A98"/>
</LevelSelectedStyles>
<Items>
<asp:MenuItem Text="综合信息" Value="0" Selected="True"></asp:MenuItem>
<asp:MenuItem Text="市场快递" Value="1"></asp:MenuItem>
<asp:MenuItem Text="服务咨询" Value="2"></asp:MenuItem>
</Items>
</asp:Menu>
</div>
<br />
<br />
<div style="width: 480px;height:100%;float: left;">
<asp:MultiView ID="NewsMultiView" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Font-Size="Smaller"
ShowHeader="False" CssClass="GridView" PageSize="3" GridLines="None" Width="450px">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table cellspacing="1" class="style1">
<tr>
<td class="style3">
<a href="zhxx_content.aspx?id=<%#Eval("n_id")%>">
·<lable><%#Eval("title").ToString().Length > 20 ? (Eval("title").ToString().Substring(0, 17) + "...") : Eval("title").ToString()%>
</lable>
<%--<asp:Label ID="Label1" runat="server" Text='<%#Eval("title").ToString().Length > 20 ? (Eval("title").ToString().Substring(0, 17) + "...") : Eval("title").ToString()%>'></asp:Label>--%>
</a>
</td>
<td class="style4">
<%# DataBinder.Eval(Container.DataItem, "add_Time ", "{0:yyyy-MM-dd}")%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle BorderStyle="None"/>
</asp:GridView>
<a href="gongsixinwen.aspx">
<asp:Image ID="Image2" runat="server" ImageUrl="../images/more.gif" style="float: right; margin: 10px 30px 0 0;" /></a>
</asp:View>
<asp:View ID="View2" runat="server">
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" Font-Size="Smaller"
ShowHeader="False" CssClass="GridView" PageSize="3" GridLines="None">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table cellspacing="1" class="style1">
<tr>
<td class="style3">
<a href="sckd_content.aspx?id=<%#Eval("n_id")%>">
·<lable><%#Eval("title").ToString().Length > 20 ? (Eval("title").ToString().Substring(0, 17) + "...") : Eval("title").ToString()%></lable>
</a>
</td>
<td class="style4">
<%# DataBinder.Eval(Container.DataItem, "add_Time ", "{0:yyyy-MM-dd}")%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<a href="gongsixinwen1.aspx">
<asp:Image ID="Image3" runat="server" ImageUrl="../images/more.gif" style="float: right; margin: 10px 30px 0 0;" /></a>
</asp:View>
<asp:View ID="View3" runat="server">
<asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" Font-Size="Smaller"
ShowHeader="False" CssClass="GridView" PageSize="3" GridLines="None">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table cellspacing="1" class="style1">
<tr>
<td class="style3">
<a href="fwzx_content.aspx?id=<%#Eval("n_id")%>">
·<lable><%#Eval("title").ToString().Length > 20 ? (Eval("title").ToString().Substring(0, 17) + "...") : Eval("title").ToString()%></lable>
</a>
</td>
<td class="style4">
<%# DataBinder.Eval(Container.DataItem, "add_Time ", "{0:yyyy-MM-dd}")%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<a href="gongsixinwen2.aspx">
<asp:Image ID="Image4" runat="server" ImageUrl="../images/more.gif" style="float: right; margin: 10px 30px 0 0;" /></a>
</asp:View>
</asp:MultiView>
</div>
后台:
protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{
NewsMultiView.ActiveViewIndex = int.Parse(this.Menu1.SelectedItem.Value);
}