大家好,因爲我在asp.net C#新我需要從前輩一些幫助使用超鏈接控制檢索數據庫中的數據
沒有與下列的表:
ID int unique not null
Title varchar(250) not null
Username varchar(100) not null
Datetime datetime not null
Shortviews varchar(500) not null
Fullviews varchar(1000) not null
Photo image not null
我已經成功地編碼在這個表中插入數據的頁面現在我想將其顯示在頁面上,我使用的中繼數據控制,只顯示其標題,並把它的屬性的代碼如下
<asp:Repeater ID="article_rep" runat="server"
onitemcommand="article_rep_ItemCommand">
<itemtemplate>
<ul class="list1">
<li><a href="#"><%# Eval("Title")%></a></li>
</ul>
</itemtemplate>
</asp:Repeater>
乙ehind的代碼,我選擇的數據與下面的代碼
protected void Page_Load(object sender, EventArgs e)
{
string strConnString = ConfigurationManager.ConnectionStrings["LgnConnectionString"].ConnectionString;
string str;
SqlCommand com;
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "select top 5 Title from table ORDER BY Datetime DESC";
com = new SqlCommand(str, con);
SqlDataReader reader;
reader = com.ExecuteReader();
world_rep.DataSource = reader;
world_rep.DataBind();
con.Close();
}
它顯示最後五排表中的記錄,我想,當我點擊任何標題它顯示與該標題,我點擊相關欄目其餘信息,在另一個頁面,這將是Details.aspx
我知道這是簡單和容易的老年人,但我得到了它,請幫助我,在此先感謝。我需要在Details.aspx上編寫代碼,以及在Details.aspx.cs上編寫什麼代碼
那麼,什麼是你的問題? –
先生的問題是:當我點擊標題鏈接時,將獲取details.aspx頁面上所有記錄的過程是什麼。就像新聞在新聞網站點擊新聞一樣,並且開始有新聞的詳細的信息的新的一頁,更早點擊 –
好的,但是有什麼問題嗎?你嘗試過什麼嗎? –