Window.open()打开一个窗体不被拦截
1 在DataGrid中建一个模板列,在模板列中放一个客户端的Button,或者直接写你要的字句,然后用<a href>连接
2 例:
3 <TABLE id="Table1" cellSpacing="0" cellPadding="0" width="100%" align="center" border="0">
4 <TR>
5 <TD width="100%">
6 <asp:datagrid id="dgFreightInfo" runat="server" Width="96%" GridLines="Horizontal" AllowCustomPaging="True"
7 AllowPaging="True" AutoGenerateColumns="False" DataKeyField="id" BorderColor="White" BorderWidth="1px"
8 PageSize="20">
9 <ItemStyle Height="25px" BackColor="#F7F7F7"></ItemStyle>
10 <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Height="25px" BackColor="#E8E8E8"></HeaderStyle>
11 <Columns>
12 <asp:TemplateColumn>
13 <ItemTemplate>
14 <A href='javascript:onclick=LoadFreight(<%# DataBinder.Eval(Container,"DataItem.id")%>)'>
15 详细信息</A>
16 </ItemTemplate>
17 </asp:TemplateColumn>
18 </Columns>
19 </asp:datagrid>
20 </TD>
21 </TR>
22 然后写一个JavaScript方法
23 <script language="javascript">
24 function LoadFreight(id)//id为传进的参数
25 {
26 var url='url.aspx?tid='+id+'';
27 window.open(url,'','scrollbars=yes,top=0,left=0,resizable=no,status=no,toolbar=no,menubar=no,location=no,width=430,height=600');
28 }
29 </script>
2 例:
3 <TABLE id="Table1" cellSpacing="0" cellPadding="0" width="100%" align="center" border="0">
4 <TR>
5 <TD width="100%">
6 <asp:datagrid id="dgFreightInfo" runat="server" Width="96%" GridLines="Horizontal" AllowCustomPaging="True"
7 AllowPaging="True" AutoGenerateColumns="False" DataKeyField="id" BorderColor="White" BorderWidth="1px"
8 PageSize="20">
9 <ItemStyle Height="25px" BackColor="#F7F7F7"></ItemStyle>
10 <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Height="25px" BackColor="#E8E8E8"></HeaderStyle>
11 <Columns>
12 <asp:TemplateColumn>
13 <ItemTemplate>
14 <A href='javascript:onclick=LoadFreight(<%# DataBinder.Eval(Container,"DataItem.id")%>)'>
15 详细信息</A>
16 </ItemTemplate>
17 </asp:TemplateColumn>
18 </Columns>
19 </asp:datagrid>
20 </TD>
21 </TR>
22 然后写一个JavaScript方法
23 <script language="javascript">
24 function LoadFreight(id)//id为传进的参数
25 {
26 var url='url.aspx?tid='+id+'';
27 window.open(url,'','scrollbars=yes,top=0,left=0,resizable=no,status=no,toolbar=no,menubar=no,location=no,width=430,height=600');
28 }
29 </script>