如何打开一个新窗口,其中包含来自 Gridview 的 onRowDataBound 事件的 POST 数据,该窗口必须传递来自其他单元格的值?
好吧,这个问题并不那么简单:让我解释一下。
我有一个网格视图,我已将其连接到数据源,一切都很顺利。我需要为每一行打开一个更详细的页面,那么最好的方法是什么?目前,我在 onRowDataBound 函数中有类似的内容:
if (e.Row.RowType == DataControlRowType.DataRow)
try
e.Row.Cells[5].Text = "<input type='image' src='images/more.png' width='20' alt='More...' onClick='test(\"" + e.Row.Cells[1].Text + "\");' />";
测试函数将采用参数,并使用当前页面上某些控件的某些值来打开一个新窗口,其中包含已发布的数据。这可能吗?目前我的测试函数没有做太多事情:
function test() {
var argv = test.arguments;
window.open('Details.aspx', 'more', 'width=300,height=200,resizable=yes,toolbar=no');
}
我希望它打开Details.aspx并将argv数据发布到它。有人吗?
Okay the question is not exactly straightforward: let me explain.
I have a gridview, that I have hooked up to a datasource and all is peachy. I need to open a more detailed page for each row, so what would be the best way to do this? Currently I have something like this in the onRowDataBound function:
if (e.Row.RowType == DataControlRowType.DataRow)
try
e.Row.Cells[5].Text = "<input type='image' src='images/more.png' width='20' alt='More...' onClick='test(\"" + e.Row.Cells[1].Text + "\");' />";
The test function would take the parameter, plus use some values of some controls on the current page to cause a new window to open with data POSTed to it. Is this possible? Currently my test function doesn't do much:
function test() {
var argv = test.arguments;
window.open('Details.aspx', 'more', 'width=300,height=200,resizable=yes,toolbar=no');
}
I'd like it to open Details.aspx with argv data POSTed to it. Anyone?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有两种方法将数据发布到服务器
1)将数据放在“?”之后的 url 中(获取请求)
2)将数据放入您的请求正文中(POST/PUT/DELETE 请求)
在您的情况下,您只有第一个数据,因为您刚刚在新页面中打开链接。
因此,只需查询字符串中的数据
http://yourdomain.com?a=val_a&b =val_b
There are two way to post data to server
1) Either put your data to url after "?" ( GET Request )
2) Either Put data in body of your request ( POST/PUT/DELETE Request )
In your case you only have first one as your just opening a link in new page.
So just your data in the query string like
http://yourdomain.com?a=val_a&b=val_b