I know that you can use exclamation sign to bind array of simple types (like string) to GridView like this
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField HeaderText="Array Field" DataField="!" />
</Columns>
</asp:GridView>
But this doesn’t seem to be the case with DataNavigateUrlFields
<asp:HyperLinkField DataNavigateUrlFields="!" DataNavigateUrlFormatString="RoleInformation.aspx?role={0}" Text="Manage users" />
and I get following error:
A field or property with the name ‘!’ was not found on the selected data source.
Most people probably haven’t even know to use the
!field I suspect. When I read your question it actually made me remember that feature which I had read about but never actually used. With that in mind, I don’t think there is a way with that type of field because it was probably forgotten in the HyperLinkField implementation (just a guess). You could just do a quick conversion to named property and then you don’t have any issues:Example:
Notice the field named
data. Then to bind your array just do:It doesn’t replace the
!directly but it is a simple solution to get around binding to simple arrays that will always work even when the!isn’t implemented which it probably needs to be for each field type.