日期:2014-05-18  浏览次数:20438 次

请教,gridview的"hyperlinkfield"字段传递一般变量参数的问题
使用gridview显示数据库数据且加hyperlinkfield“详细说明”字段,即打开该行的详细内容,此连接在gridview中的该字段属性datanavigateurlformatstring为"info.aspx?id={0}",如需在id后再增加一个传递变量str怎么写? 


------解决方案--------------------
....一样

GridView.OnRowDataBound+=new GridViewRowEventHandler(GridViewRowDataBound)
void GridViewRowDataBound(object Sender,GridViewRowEventArgs e)
{
 if(e.Row.RowType==DataControlRowType.DataRow)
{
HyperLinkField hlf="你的HyperLinkFiled" as HyperLinkField;
string[] urlFields={"变量一","变量二"};
hlf.DataNavigateURLFields=urlFields;
}
}
收工!
------解决方案--------------------
可以参考一下Datagrid的多个参数链接 
http://dev.csdn.net/author/downmoon/8ccf20df2a2e4f0ab010343c68fa8556.html