在DataGrid中建一个模板列,在模板列中放一个客户端的Button,或者直接写你要的字句,然后用<a href>连接
例:
<TABLE id="Table1" cellSpacing="0" cellPadding="0" width="100%" align="center" border="0">
<TR>
<TD width="100%">
<asp:datagrid id="dgFreightInfo" runat="server" Width="96%" GridLines="Horizontal" AllowCustomPaging="True"
AllowPaging="True" AutoGenerateColumns="False" DataKeyField="id" BorderColor="White" BorderWidth="1px"
PageSize="20">
<ItemStyle Height="25px" BackColor="#F7F7F7"></ItemStyle>
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" Height="25px" BackColor="#E8E8E8"></HeaderStyle>
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<A href='javascript:οnclick=LoadFreight(<%# DataBinder.Eval(Container,"DataItem.id")%>)'>
详细信息</A>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
</TD>
</TR>
然后写一个JavaScript方法
<script language="javascript">
function LoadFreight(id)//id为传进的参数
{
var url='url.aspx?tid='+id+'';
window.open(url,'','scrollbars=yes,top=0,left=0,resizable=no,status=no,toolbar=no,menubar=no,location=no,width=430,height=600');
}
</script>
例:
<TABLE id="Table1" cellSpacing="0" cellPadding="0" width="100%" align="center" border="0">
<TR>
<TD width="100%">
<asp:datagrid id="dgFreightInfo" runat="server" Width="96%" GridLines="Horizontal" AllowCustomPaging="True"
AllowPaging="True" AutoGenerateColumns="False" DataKeyField="id" BorderColor="White" BorderWidth="1px"
PageSize="20">
<ItemStyle Height="25px" BackColor="#F7F7F7"></ItemStyle>
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" Height="25px" BackColor="#E8E8E8"></HeaderStyle>
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<A href='javascript:οnclick=LoadFreight(<%# DataBinder.Eval(Container,"DataItem.id")%>)'>
详细信息</A>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
</TD>
</TR>
然后写一个JavaScript方法
<script language="javascript">
function LoadFreight(id)//id为传进的参数
{
var url='url.aspx?tid='+id+'';
window.open(url,'','scrollbars=yes,top=0,left=0,resizable=no,status=no,toolbar=no,menubar=no,location=no,width=430,height=600');
}
</script>