我在DataGrid设了一个模板列,名为(详细信息),我想在点击详细信息的时候把编号传到另一个页面
在另一个页面显示相信内容,但是我现在在弹出一个新窗口的时候主页面会刷新,有什么办法可以控制吗(让主页不刷新),拜托了,各位大哥!!帮帮我!!
这是我的弹出新窗口的代码
private void dgFreight_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
try
{
int id=int.Parse(this.dgFreight.DataKeys[e.Item.ItemIndex].ToString());
string tt="worklog = window.open('"+Request.ApplicationPath+"/FreightVehicleByID/FreightVehicleInfoByID.aspx?fid="+id+"&test=0"+"'"
+",'','scrollbars=yes,top=0,left=0,resizable=no,status=no,toolbar=no,menubar=no,location=no,width=500,height=450');";
Response.Write("<script language=javascript>");
Response.Write(tt);
Response.Write("</script>"); }
catch(Exception ex)
{
RegisterStartupScript("Error","<script>alert('"+ex.Message+"')</script>");
} }

解决方案 »

  1.   

    你现在是post回去后才执行的事件,然后再往前写脚本,当然要闪了这样写就行
    <itemtemplate>
     <a href="FreightVehicleByID/FreightVehicleInfoByID.aspx?fid=<%#DataBinder.Eval(Container.DataItem,"ID")%>"> Click</a>
    </itemtemplate>
    ____________________________
    (2005年04月26日 16时39分37秒)
      

  2.   

    当然 <a  要加个  target
    ____________________________
    (2005年04月26日 16时40分15秒)
      

  3.   

    但是我的有好多数据的啊,每一行都有一个(详细信息)的点击按纽,所以我只能在服务器端的DataGrid的ItemCommand里写啊,不能直接在客户端写啊,如果要把动态写,在Itemcommand的事件里应该怎么写呢!!