.NET

來源:互聯網
上載者:User

標籤:

---恢複內容開始---

repeater可以點擊內部內容進行跳轉並傳輸值

<ItemTemplate>
<tr>
<td> <a href="readArticle1.aspx(要跳轉的地址)?ID=<%#Eval("userID")%>&articleTitle=<%#Eval("articleTitle") %>"><%#Eval("userID")%></td>
<td> <a href="readArticle1.aspx(要跳轉的地址)?ID=<%#Eval("userID")%>&articleTitle=<%#Eval("articleTitle") %>"><%#Eval("articleTitle")%></a></td>
</tr>
</ItemTemplate>

 

添加音樂

 <embed src="/佟大為 - 放飛.mp3"(音樂的地址資訊)width="1" height="1" type="audio/mpeg" loop="true"(是否迴圈) autostart="true"(是否自動播放) id="MP3" />

 

頁面跳轉並傳值

if((string)SqlHelper.SqlExecuteScalar("SELECT userID,userPassword FROM users WHERE userID = N‘"+userID.Text +"‘ AND userPassword = ‘"+userPassword.Text +"‘")!=null)
{
string querystr = userID.Text;
Response.Write("<script>alert(‘登入成功‘)</script>");
Response.Redirect("http://localhost:20890/personal.aspx?a=" + querystr + "");
}
else
{
Response.Write("<script>alert(‘登入失敗‘)</script>");
}

 

接受傳值

userID.Text = Request.QueryString["ID"];
articleTitle.Text = Request.QueryString["articleTitle"];

 

綁定圖片(未實現)

<asp:Image ID="Image1" runat="server" Height="212px" Width="179px" src="~\result"/>(有誤 ,用HTML裡的控制項實現)

 

SqlConnection conn = new SqlConnection(str);
userID.Text = Request.QueryString["a"];
bloglist.DataSource = SqlHelper.SelectDT("Select * From author WHERE userID=N‘" + userID.Text + "‘");
bloglist.DataBind();
conn.Open();
userID.Text = "王愷鵬";
string srcc = "SELECT userPicture FROM users WHERE userID =N‘" + userID.Text + "‘";
SqlCommand cmd = new SqlCommand(srcc, conn);
string result = cmd.ExecuteScalar().ToString();

---恢複內容結束---

 

 

標題:
<asp:Label ID="articleTitleLabel" runat="server" />
<a href ="readArticle.aspx?articleTitle=<%#Eval("articleTitle") %>&authorid=<%#Eval ("userID") %>&articleid=<%#Eval ("articleID") %>">
<%#Eval("articleTitle") %>>
</a>
<br />

 

本文:
<asp:Label ID="articleContentLabel" runat="server" />
<%# Eval("articleContent").ToString().Substring(0,Eval ("articleContent").ToString ().Length >30?30:Eval ("articleContent").ToString ().Length ) %>
</a>
<br />//本文保留前30個字元

.NET

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.