如何得到选定的那一列的按钮列所绑定的值
按着模板列的方式取:string script = "parent.sbottom.location.href="
+ "'ResInfo.aspx?HotelName=" + Server.UrlEncode(((LinkButton)e.Item.Cells[2].FindControl("Select")).Text)
结果提示对象未实例化,看来这样是不行的。毕竟它是按钮列啊。
请问如何得到这个LINKBUTTON所绑定的值?
谢谢了。
按着模板列的方式取:string script = "parent.sbottom.location.href="
+ "'ResInfo.aspx?HotelName=" + Server.UrlEncode(((LinkButton)e.Item.Cells[2].FindControl("Select")).Text)
结果提示对象未实例化,看来这样是不行的。毕竟它是按钮列啊。
请问如何得到这个LINKBUTTON所绑定的值?
谢谢了。
这个应该是可以的,可能是你调用的地方不对,我记得好像覆盖一个什么 ???bound???(不知道是不是,函数名意思大概是数据绑定吧) 的方法,在里面这样就可以的〉。。
Contorl ctrl = e.Item.Cells[2].FindControl("Select");
LinkButton lb = ctrl as LinkButton;
if(lb != null)
{
string script = "parent.sbottom.location.href="+ "'ResInfo.aspx?HotelName=" + Server.UrlEncode(lb.Text);
}
可是按着上面这位高手的代码参照了一下,它判断不为空就跳出了。
怎么回事?
为什么要那样判断???