如何打开一个asp.net子窗口,我希望代表父窗口中的某些键显示一些数据 [英] how to open an asp.net child window on which i want to show some data on behalf of some key from parent window

查看:50
本文介绍了如何打开一个asp.net子窗口,我希望代表父窗口中的某些键显示一些数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好....



i希望在我的父窗口中打开一个子窗口(必须是一个aspx页面,而不是一个html页面) 单击链接按钮,...并且一些数据从父窗口转到子窗口,代表od我在子页面上显示一些信息 (必须是aspx页面)我无法打开这种类型的窗口。父页面和子页面..两者都是aspx页面。我怎么能这样做....请提出建议.... thnx提前...





i在我写这个head section ...



函数openChildPopup(id)

{

window.open(childPage。 aspx?id =+ id,myWindow);

返回false;

}





和这在rowdatabound事件中...



if(e.Row.RowType = DataControlRowType.DataRow)

{

string id = YourGridView.DataKeys [e.Row.RowIndex] .Value.ToString();

Button btn = new Button();

btn =(Button)e.Row.FindControl(yourButtonID); // yourButtonID是GridView行中

//按钮的ID。

btn.Attributes.Add(onclick,return openChildPopup(''+ id +''););

}



但它在新标签中打开与父级相同大小的窗口...(我已经这样做了,这不是我的问题)我想在父窗口中打开一个小尺寸的窗口(不是新的tab)...这就是我的问题...建议

解决方案

在页面的head部分添加此JavaScript函数:

< pre lang =Javascript> function openChildPopup(id)
{
window .open( childPage.aspx?id = + id, myWindow);
return false ;
}



在GridView的RowDataBound事件中添加此代码:

  if (e.Row.RowType = DataControlRowType.DataRow)
{
string id = YourGridView.DataKeys [e.Row.RowIndex] .Value.ToString();
Button btn = new Button();
btn =(按钮)e.Row.FindControl( yourButtonID); // yourButtonID是
的id // GridView行中的按钮。
btn.Attributes.Add( onclick 返回openChildPopup(' + id + '););
}



现在你的childPAge.aspx使用查询字符串来访问细节。


hello all....

i want to open a child window (which must be a aspx page , not an htmlpage) in my parent window on click of a link button ,...and some data goes from parent window to child window , on behalf od this i show some information on child page(which is must be a aspx page) i am unable to open this type of window. parent page and child page ..both are aspx page. how can i do this....pls give suggestion....thnx in advance...


i write this in my head section...

function openChildPopup(id)
{
window.open("childPage.aspx?id=" + id,"myWindow");
return false;
}


and this in rowdatabound event...

if(e.Row.RowType = DataControlRowType.DataRow)
{
string id = YourGridView.DataKeys[e.Row.RowIndex].Value.ToString();
Button btn = new Button();
btn = (Button)e.Row.FindControl("yourButtonID");//yourButtonID is the id of
// button in GridView row.
btn.Attributes.Add("onclick","return openChildPopup(''" + id + "'');");
}

but it open a same size of window as parent in new tab...(i have already do this, it''s not my problem) i want to open a small size window inside parent window(, not in new tab)...thats my problem...suggest

解决方案

Add this JavaScript function in the head section of your page:

function openChildPopup(id)
{
window.open("childPage.aspx?id=" + id,"myWindow");
return false;
}


Add this code inside your GridView''s RowDataBound event:

if(e.Row.RowType = DataControlRowType.DataRow) 
{
string id = YourGridView.DataKeys[e.Row.RowIndex].Value.ToString();
Button btn = new Button();
btn = (Button)e.Row.FindControl("yourButtonID");//yourButtonID is the id of 
// button in GridView row.
btn.Attributes.Add("onclick","return openChildPopup('" + id + "');");
}


Now on your childPAge.aspx use querystring to access the details.


这篇关于如何打开一个asp.net子窗口,我希望代表父窗口中的某些键显示一些数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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