我的目的是想在index.aspx中的文章中点"查看全文",然后转到show.aspx中显示我点中的文章的全文内容.
form的提交方法是post
在index.aspx中放一个datagrid,写入
[<A href='ST_show.aspx?B_id=<%# DataBinder.Eval(Container.DataItem, "B_id") %>.aspx'>点击阅读全文</A>]
绑定了文章的ID.
请问在show.aspx中应该怎么写才能显示我点中的对应的文章内容呢???

解决方案 »

  1.   

    JS 
    window.location = "show.aspx?datagrid=" + datagrid;CS
    Response.Redirect("show.aspx?datagrid=" + datagrid);
      

  2.   

    在show中以文章的id取读取数据
      

  3.   

    show.aspx中用
    string id=Request.QureyString["B_id"]//得到id
    然后在读取这个id对应数据绑定
      

  4.   


    我在show.aspx中加入这样
    protected void Page_Load(object sender, System.EventArgs e)
    {
                SqlConnection ST_myConn=new SqlConnection();
                string ST_dns = ConfigurationSettings.AppSettings["strConn"];
                ST_myConn.ConnectionString = ST_dns;            string ST_sql = "select * from B_news where B_id='" + Request.QueryString["B_id"] + "'";            SqlDataAdapter ST_myCmd = new SqlDataAdapter(ST_sql, ST_myConn);            DataSet ST_ds = new DataSet();
                ST_myCmd.Fill(ST_ds, "NewsCheck");
                NewsShow.DataSource = ST_ds.Tables[0].DefaultView;
                NewsShow.DataBind();
    }再在show.aspx中建立一个datalist
    <%#DataBinder.Eval(Container.DataItem, "B_content")%> 文章的内容
    在index.aspx中点 查看全文的时候 提示:异常详细信息: System.Data.SqlClient.SqlException: 将数据类型 varchar 转换为 bigint 时出错。源错误: 
    行 38: 
    行 39:             DataSet ST_ds = new DataSet();
    行 40:             ST_myCmd.Fill(ST_ds, "NewsCheck");
    行 41:             NewsShow.DataSource = ST_ds.Tables[0].DefaultView;
    行 42:             NewsShow.DataBind();
     这是为什么啊!??
      

  5.   

    我是这样做的
    [<A href='ST_show.aspx?B_id=<%# DataBinder.Eval(Container.DataItem, "B_id") %>'>点击阅读全文</A>]*(你那个.aspx就不需要了)
    然后在另一个页面获取
    string strID = Request.QueryString["B_id"];
    然后读新闻的时候吧传来的值做条件 ..where id='"+strID +"'
      

  6.   

    string ST_sql = "select * from B_news where B_id=" + Request.QueryString["B_id"];
      

  7.   

    哦 可以了 谢谢啊!各位!!!!!太感谢了!
    请问ztwz(菜鸟) 我那样写为什么不行啊!???
      

  8.   

    加了''数据库认为是字符型,但你的id是int型的.
    不用加''数据库会自动把字符串转换成int的.
    给分,吃饭去了.呵呵,闪
      

  9.   

    B_id=DataGrid1.Items[i].Cells[j].Text.ToString();//i,j用來定位你想傳遞的值然後再:
     string ST_sql = "select * from B_news where B_id=" + Request.QueryString["B_id"];
      

  10.   

    cooolchen() 我没有B_id=DataGrid1.Items[i].Cells[j].Text.ToString()这个也可以实现哦!!