您的位置:程序门 -> .net技术 -> c#



子窗体为什么打不开?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


子窗体为什么打不开?
发表于:2007-03-28 09:21:53 楼主
我要实现点击datagrid中模板列中的一个linkbutton后,弹出一个模式窗口,代码如下:
    private   void   datagrid1_itemcommand(object   source,   system.web.ui.webcontrols.datagridcommandeventargs   e)
{
  string   empid=(string)datagrid1.datakeys[e.item.itemindex];
if(e.commandname.equals( "edit "))
{
for(int   i=0;i <datagrid1.items.count;i++)
{
((linkbutton)(datagrid1.items[i].findcontrol( "linkbutton2 "))).attributes.add( "onclick ", "javascript:showmodaldialog( 'webform1.aspx?tag= "+empid+ " ', 'newwindow, 'dialogwidth:600px;dialogheight:200px;help:0;center:yes;resizable:0;status:0;scroll:yes ');return(false); ");
}
}


}
可是为什么打不开子窗体呢,请指点指点我啊,谢谢!
发表于:2007-03-28 09:50:261楼 得分:0
打开datagrid属性生成器,添加一个超链接按扭列。指定它的字段名(你想显示的标题)url地址为数据库中表的url字段。记得用字段绑定,去掉自动生成列。
发表于:2007-03-28 10:15:012楼 得分:0
楼上说的我不是很明白,我又改了,还是不行
private   void   datagrid1_itemdatabound(object   sender,   system.web.ui.webcontrols.datagriditemeventargs   e)
{
if(e.item.itemtype   ==   listitemtype.item     ¦ ¦   e.item.itemtype   ==   listitemtype.alternatingitem)
{

e.item.attributes.add( "onmouseover ", "currentcolor=this.style.backgroundcolor;this.style.backgroundcolor= '#f3e9e0 ' ");

e.item.attributes.add( "onmouseout ", "this.style.backgroundcolor=currentcolor ");
e.item.cells[5].attributes.add( "onclick ", "javascript:window.parent.mainframe.location= 'webform1.aspx?xk= "+   e.item.cells[1].text.trim()   +   " ';return   false; ");
}
}


快速检索

最新资讯
热门点击