当前位置:编程学习 > C#/ASP.NET >>

ASP.NET 控件问题,请各位帮忙解决哈,谢谢.

<%@ Page Language="C#" ContentType="text/html" Debug="true"%>
<%@ Import Namespace="System"%>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.SqlClient"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>相关书籍</title>
<script language="C#" runat="server">
void Page_Load(Object sender,EventArgs E){
if(!Page.IsPostBack)
{string bookType=(string)Request.QueryString["type"];
label1.Text="";
switch(bookType)
{case "UML":
case "SQL":
label1.Text=bookType+"相关书籍"; break;
case "NET":
label1.Text="."+bookType+"相关书籍";break;
default:break;
}
SqlConnection shopConn=new SqlConnection((String)ConfigurationSettings.AppSettings["connString"]);
String queryStr="select * from users where type='"+bookType+"'";
SqlDataAdapter shopAdapter=new SqlDataAdapter(queryStr,shopConn);
DataSet shopSet=new DataSet();
shopAdapter.Fill(shopSet,"titles");
titleList.DataSourse=shopSet.Tables["titles"].DefaultView;
titleList.DataBind();
titleList.RepeatDirection=RepeatDirection.Horizontal;
titleList.RepeatLayout=RepeatLayoutTable;
titleList.RepeatColumns=2;
}
}
</script>
</head>
<body>
<strong><font size="5" face="华文楷体">相关书籍</font></strong> 
<p>
<blockquote>
<asp:label ID="label1" runat="server"/>
</blockquote>
<asp:DataList ID="titleList" runat="server" CellPadding="10">
<ItemTemplate>
<table>
<tr>
<td>
<Img src="<%=DataBinder.Eval(Container.DataItem,"book_id") %>.gif" width="80"  height="150" align="top"/>
</td>
<td valign="top">
<a href="title.aspx? title_id="<%=DataBinder.Eval(Container.DataItem,"book_id")%>">
<%=DataBinder.Eval(Container.DataItem,"title")%></a><br/>
<%=DataBinder.Eval(Container.DataItem,"price","{0:c}")%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</body>
</html>
--------------------编程问答-------------------- 你的问题都不说,怎么解决?
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,