一个HyperLink控件(在DataList项模板内),我把它的Text属性绑定了,绑定表达式如下:
DataBinder.Eval(Container.DataItem,"N_title")当点击那个HyperLink时我想跳转到另一个页面,达到如下语句的效果(即跳转的页面地址并在最后加上?id=**):
int id = (int)DataList1.DataKeys[e.Item.ItemIndex]; //获取当前选中行的行号
if (e.CommandName == "showNews")
{
try
{
Response.Redirect("showNews.aspx?id="+id.ToString());
}
catch (Exception ex)
{
Response.Write(ex);
}
}这样的话我要在NavigateUrl怎么写绑定表达式呢???
DataBinder.Eval(Container.DataItem,"N_title")当点击那个HyperLink时我想跳转到另一个页面,达到如下语句的效果(即跳转的页面地址并在最后加上?id=**):
int id = (int)DataList1.DataKeys[e.Item.ItemIndex]; //获取当前选中行的行号
if (e.CommandName == "showNews")
{
try
{
Response.Redirect("showNews.aspx?id="+id.ToString());
}
catch (Exception ex)
{
Response.Write(ex);
}
}这样的话我要在NavigateUrl怎么写绑定表达式呢???
DataBinding:“System.Data.DataRowView”不包含名为“id”的属性。