Datagrid Linkbutton单击弹出窗口 [英] Datagrid Linkbutton click Pop-up Window

查看:74
本文介绍了Datagrid Linkbutton单击弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的伙计们,

这是Shiva,我现在正在创建聊天应用程序.我有一个主要问题.我目前将在线用户放置在datagrid中,我必须为每个人打开一个单独的弹出窗口,但现在我无法打开一个单独的窗口只能解决我的问题.使用linkbutton如果我试图打开新窗口,则意味着每次将旧的弹出窗口替换为新窗口.我需要为每个linkbutton事件打开单独的弹出窗口去做?请帮助我的朋友

请帮我,这很紧急...

在此先感谢


问候

Shiva

Dear Guys,

This is Shiva,I''m creating chat application now.I have one Major problem.I have placed Currently Online persons in datagrid,I have to open a seperate pop-up window for each person but now i can''t able open a seperate window tats only my problem.Using linkbutton If i''m trying to open new window means each time the old pop-up window gets replaced by new window.I need open Seperate pop-up window for each linkbutton event What I have to Do? Please Help Me Friends

Please Help me It''s Urgent...

Thanks in advance


Regards

Shiva

推荐答案

为新窗口提供不同的名称,它将始终打开不同的名称.

现在,新窗口在所有情况下都必须使用相同的名称.这迫使只在现有的一个中打开.

例如:"myWindowName"是始终需要不同的名称.
Give different names to the new windows and it will open different all the time.

Right now, you must be using same name in all the cases for the new window. This forces to open in the existing one only.

For ex: ''myWindowName'' is the name that needs to be different all the time.
var reportWindow = window.open('CostByProject.aspx', 'myWindowName','height=650,width=900,resizable=1,status=yes,scrollbars=1,toolbar=no,menubar=no,location=no');




更新:




UPDATE:

piramanayagam.shiva写道:
piramanayagam.shiva wrote:

Page.ClientScript.RegisterStartupScript(this.GetType(),"op","window.open(""+ Request.ApplicationPath +"/Operators/Chat.aspx", null ,''width = 450,height = 450,left = 350,top = 120'');,true);

Page.ClientScript.RegisterStartupScript(this.GetType(),"op", "window.open (''" + Request.ApplicationPath + "/Operators/Chat.aspx'', null,''width=450,height=450,left=350,top=120'');", true);


您需要将此"null"更改为唯一的字符串.

因此,请执行以下操作:


You need to change this ''null'' to a unique string.

Thus do something like:

private int iCount = 0;
private string myNewWindow = String.Empty;

protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) 
{ 
   myNewWindow = "myNewWindow" + iCount.ToString();
   if (e.CommandName == "elink") 
   { 
     Page.ClientScript.RegisterStartupScript(this.GetType(),"op", "window.open ('" + Request.ApplicationPath + "/Operators/Chat.aspx','"+ myNewWindow+"','width=450,height=450,left=350,top=120');", true); 
   } 
   iCount++;
}


这也可以通过其他方式完成.这就是其中之一.


This could had been done other ways too. This is one of them.


您好Shiva

尝试将HyperLinkField的DataNavigateUrlFormatString属性用于datagrid/gridview列,请使用以下代码

Hi Shiva

try to use DataNavigateUrlFormatString property of HyperLinkField for the datagrid/ gridview column use below code

<br />
<br />
<asp:GridView ID="gvQueue" runat="server" DataSourceID="odsQueues" AutoGenerateColumns="False" HeaderStyle-BackColor="white" HeaderStyle-ForeColor="black" BorderColor="Black" BorderStyle="Solid" DataKeyNames="personid"><br />
 <Columns><br />
                <asp:HyperLinkField DataNavigateUrlFields="PersonID" DataNavigateUrlFormatString="/Operators/Chat.aspx?PersonID={0}"<br />
                    DataTextField="Person" HeaderText="Person ID" Text="AuditId" Target="_blank"  ><br />
<br />
                </asp:HyperLinkField><br />
 </Columns><br />
</asp:GridView><br />
<br />


您好Shiva,

在datagrid链接按钮上单击调用Javascript函数
Hi Shiva,

Call the Javascript function on datagrid linkbutton clicked
function()<br />
{<br />
window.open("URL");<br />
}


这篇关于Datagrid Linkbutton单击弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆