求教用下面的方法为什么获取不到gridview中linkbutton的值?
protectedvoidLinkButton2_Click(objectsender,EventArgse){intindex=((GridViewRow)(((Lin...
protected void LinkButton2_Click(object sender, EventArgs e)
{
int index = ((GridViewRow)(((LinkButton)sender).Parent.Parent)).RowIndex;
string link = (this.GVTestReport.Rows[index].FindControl("LinkButton2") as LinkButton).Text;
//string link = (this.GVTestReport.Rows[index].Cells[6].Controls[0].FindControl("LinkButton2") as LinkButton).Text;
if (link == "查看")
{
JavaScriptLocationHref("StuTestReportView.aspx?id=" + rybh, this.Page);
}
else
{
JavaScriptLocationHref("StuTestReportEdit.aspx?id=" + rybh, this.Page);
}
}
link的值获取不到,是空的,求高手赐教。。。 展开
{
int index = ((GridViewRow)(((LinkButton)sender).Parent.Parent)).RowIndex;
string link = (this.GVTestReport.Rows[index].FindControl("LinkButton2") as LinkButton).Text;
//string link = (this.GVTestReport.Rows[index].Cells[6].Controls[0].FindControl("LinkButton2") as LinkButton).Text;
if (link == "查看")
{
JavaScriptLocationHref("StuTestReportView.aspx?id=" + rybh, this.Page);
}
else
{
JavaScriptLocationHref("StuTestReportEdit.aspx?id=" + rybh, this.Page);
}
}
link的值获取不到,是空的,求高手赐教。。。 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询