我使用了一个DataGrid的超连接,其中的 NavigateUrl想使用数据绑定,但是运行时总是报错,说
超连接列不支持DataBinding???
NavigateUrl='<%# myfunc(DataBinder.Eval(Container.DataItem,"id"),DataBinder.Eval(Container.DataItem,"title")) %>' >另外,DataNavigateUrlFormatString="Manual.aspx?isDepartment={0}&receiveID={1}&receiveDepartment={2}"对于URL字段 DataNavigateUrlField="isdepartment;receiveID;receiveDepartment" 是错的
中间是用什么分隔的呀?????
超连接列不支持DataBinding???
NavigateUrl='<%# myfunc(DataBinder.Eval(Container.DataItem,"id"),DataBinder.Eval(Container.DataItem,"title")) %>' >另外,DataNavigateUrlFormatString="Manual.aspx?isDepartment={0}&receiveID={1}&receiveDepartment={2}"对于URL字段 DataNavigateUrlField="isdepartment;receiveID;receiveDepartment" 是错的
中间是用什么分隔的呀?????
NavigateUrl='<%# DataBinder.Eval(Container.DataItem,"id")%><%#DataBinder.Eval(Container.DataItem,"title")) %>' DataNavigateUrlFormatString中{1},{2}是不能用的。你必须要用{0}
<asp:TemplateColumn HeaderText="标题">
<ItemTemplate>
<a href='<%# myfunc(DataBinder.Eval(Container.DataItem,"title").ToString(),DataBinder.Eval(Container.DataItem,"id").ToString())%>'>
<%# DataBinder.Eval(Container.DataItem,"title")%></a>
</ItemTemplate>
</asp:TemplateColumn>
后台:
protected string myfunc(string title,string id)
{
return "Manual.aspx?title=" + title + "&id=" + id;
}