ItemDataBound中打开新页面如何增加参数?

deria 2007-05-16 11:30:33
我在dgProduct_ItemDataBound事件中写了如下代码:
if((e.Item.ItemType==ListItemType.Item)||(e.Item.ItemType==ListItemType.AlternatingItem)||(e.Item.ItemType==ListItemType.SelectedItem))
{
Button bt=(Button)e.Item.FindControl("dgBarcodeInput");
bt.Attributes.Add("onclick", "javascript:window.showModalDialog('/scm/BarcodeInPut.aspx','window','dialogwidth:450px;dialogheight:400px;help:0;center:yes;resizable:0;status:0;scroll:yes');");
}

现在我想在弹出的新页面路径中增加一个参数。就是当前行的第一列的值,不知道如何才能实现?谢谢大家!
...全文
126 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
antiking 2007-05-16
  • 打赏
  • 举报
回复
加判断if(Request.QueryString["id"]!=null)
{
}
deria 2007-05-16
  • 打赏
  • 举报
回复
非常感谢amandag(高歌),用你这个是可以,但是我在打开的新窗体中用string str=Request.QueryString["id"].ToString();时提示未将对象引用设置到实例的错误!
tian123xxx 2007-05-16
  • 打赏
  • 举报
回复
bt.Attributes.Add("onclick", string.Format("javascript:window.showModalDialog('/scm/BarcodeInPut.aspx?id={0}','window','dialogwidth:450px;dialogheight:400px;help:0;center:yes;resizable:0;status:0;scroll:yes');",e.Item.Cells[0].Text);
tian123xxx 2007-05-16
  • 打赏
  • 举报
回复
bt.Attributes.Add("onclick", string.Format("javascript:window.showModalDialog('/scm/BarcodeInPut.aspx?id={0}','window','dialogwidth:450px;dialogheight:400px;help:0;center:yes;resizable:0;status:0;scroll:yes');",e.Item.Cells[0].Text);
tian123xxx 2007-05-16
  • 打赏
  • 举报
回复
bt.Attributes.Add("onclick", string.Format("javascript:window.showModalDialog('/scm/BarcodeInPut.aspx?id={0}','window','dialogwidth:450px;dialogheight:400px;help:0;center:yes;resizable:0;status:0;scroll:yes');",e.Item.Cells[0].Text);
  • 打赏
  • 举报
回复
取得第一列的值e.item[0]
再('/scm/BarcodeInPut.aspx'+"值"
amandag 2007-05-16
  • 打赏
  • 举报
回复
if((e.Item.ItemType==ListItemType.Item)||(e.Item.ItemType==ListItemType.AlternatingItem)||(e.Item.ItemType==ListItemType.SelectedItem))
{
Button bt=(Button)e.Item.FindControl("dgBarcodeInput");
bt.Attributes.Add("onclick", "javascript:window.showModalDialog('/scm/BarcodeInPut.aspx?id=" + e.Item.Cell[0].Text + "','window','dialogwidth:450px;dialogheight:400px;help:0;center:yes;resizable:0;status:0;scroll:yes');");
}

deria 2007-05-16
  • 打赏
  • 举报
回复
就这么点分了,希望会的朋友能帮助下!谢谢了!
deria 2007-05-16
  • 打赏
  • 举报
回复
谢谢xray2005,那句是不行的,出现错误
“System.Web.UI.WebControls.TableCell”并不包含对“innerText”的定义
xray2005 2007-05-16
  • 打赏
  • 举报
回复
e.Item.Cells[0].innerText 呢?
deria 2007-05-16
  • 打赏
  • 举报
回复
非常感谢楼上好心帮助的朋友,但是我发现现在这个e.Item.Cells[0].Text怎么都是空啊?而这一列的确是有值存在的!这是什么原因啊?

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧