我的页面上有这样一个列表:热门菜系:川菜 京菜 自助餐 江浙 粤菜 湘菜这是用DataList从数据库里邦定读出来的。
(select DiningType from Dining group by DiningType)我现在必须点击相应的菜系从而在本页上的一个DataGrid列表中显示相应餐馆的信息。难点就是怎么能把 "@DiningType"这个参数在本页上传给DataGrid.有人这么用过吗?谢谢大侠指点,说具体点,最好附原码。感激不尽

解决方案 »

  1.   

    在DataList中加个链接如:
    <a href="本页.aspx?typeid=<%#DataBinder.Eval(Container.DataItem,"DiningType")">
    <%#DataBinder.Eval(Container.DataItem,"DiningType")"></a>
    在.cs 中写个显示datagrid的方法void BindGrid()
    {
         string sType = Request.QueryString["typeId"];
         if(sType ==null) return ;
    string strSQL = "Select 菜名 from 菜表 where diningtype='"+ sType +"'";
    .....
    ....}
      

  2.   

    repert里面套repert也可以实现你的要求啊
      

  3.   

    大哥 能把直传给本页吗?怎么获得呀传过来的参数呀 string type = Request.Parms["type"].ToString()
    是这样吗?不行吧 本页好像不能获得参数
      

  4.   

    听我们老大说 要在DataList中嵌套DataGrid 或者iframe引入页面。
    但后者方法比较笨,就看前面那个了。那位高手能发个demo看看。
      

  5.   

    在datalist里的onselectindex change事件里写