首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

datagrid和gridview的代码有关问题

2012-02-03 
datagrid和gridview的代码问题protectedvoidCommandHandle(objectsender,GridViewCommandEventArgse){if(e

datagrid和gridview的代码问题
protected   void   CommandHandle(object   sender,   GridViewCommandEventArgs   e)
        {
                if   (e.CommandName= "detail "){

                Response.Redirect( "ShowDetail.aspx?sid= "+e.Item.Cells(1).Text)
                  }

        }

以上是书上给的用datagrid实现的代码 我用gridview的时候   e.item.Cell(1).text出不来 请问因该改成什么啊?

[解决办法]
那应该是e.Item.Cells(1).Text中没有值
[解决办法]
顶一下
[解决办法]
item改为Row,自己查查msdn,更详细一些~
[解决办法]
不知道你拿DATAGRID的E.COMMANDNAME出来干什么 和你后边的问题有关系么????

e.Item.Cell[1].Text
必须是该CELL是标准绑定列或者成对的HTML标记

如果CELL里边是 <input type= "text " value= "ABCD " /> 这样类型的HTML代码是得不到值的
如果是 <input type= "text " > ABCD </input> 这样类型的可以得到ABCD
[解决办法]
你用的是C#吧?
C#里是用方括号的  Cell[0]

热点排行