zoukankan      html  css  js  c++  java
  • .NET

    ---恢复内容开始---

    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="~ esult"/>(有误 ,用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个字符

  • 相关阅读:
    贪心——poj百炼3468:电池寿命
    贪心——部分背包
    C++编程规范
    调和级数求和
    人工神经网络
    Latex各种符号
    poj1088 滑雪,dp
    数据挖掘建模过程
    Java MyEclipse:The type java.lang.CharSequence cannot be resolved. It is indirectly referen
    Java调用阿里云短信接口发送手机验证码
  • 原文地址:https://www.cnblogs.com/wangkaipeng/p/4193035.html
Copyright © 2011-2022 走看看