新视窗开启 [英] new window open
本文介绍了新视窗开启的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<asp:TemplateField HeaderText="Title" SortExpression="Title">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("Url") %>'
Text='<%# Eval("Title") %>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField
这是带有url的网格视图代码的一部分.
它正在使用url,但如果有人单击标题,我希望它能够工作,然后它将在包含数据库所有字段的新窗口中打开.
This is the part of the grid view code with url.
It is working with url but I want it to work if somesone clicks on the title, then it will open in a new window holding all the fields of database.
推荐答案
这里有一个示例链接,说明如何使用javascript打开弹出窗口.
http://www.javascript-coder.com/window-popup/javascript-window- open.phtml [^ ]
在我看来,最好创建一个javascript函数
Here a link with examples of how to open a popup using javascript.
http://www.javascript-coder.com/window-popup/javascript-window-open.phtml[^]
It seems to me it would be best to create a javascript function
function openItem(url, p1)
{
window.open (url +"?param=" + p1, "Item: " + p1);
return false;
}
并以如下方式使用它:
And use it somewhat like:
NavigateUrl="javascript:openItem(''<%# Eval("Url") %>'', ''<%#Eval(Param1)%'');">
祝您好运!
Good luck!
如果您想单击按钮控件,请使用以下功能.
onclick ="return openpopup(this.id);"
然后将脚本添加到设计页面的顶部.
< script type ="text/javascript" src ="../Scripts/saction.js"></script>
然后将该函数写入.js文件以获取以下代码..
if u want to click the button control use the below function.
onclick="return openpopup(this.id);"
then include the script to top of design page.
<script type="text/javascript" src="../Scripts/saction.js"></script>
then write the function to .js file for below code..
function openpopup(id) {
window.open("/Application/Transaction.aspx", "List", "scrollbars=no,resizable=no,width=400,height=420");
return false;
}
它将正常运行..
it will run properly..
只需将
Target ="_new"
添加到超链接
这篇关于新视窗开启的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文