my webside has a gridview i bind it to a dataset recived from powershell
in this dataset are a lot of different data types.
everything is working fine but for one field i would like to bind a deeper property to the boundfield!
i bind it like this:
c#
GridViewAgentGroups.DataSource = dt;
GridViewAgentGroups.DataBind();
Markup
<asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True" />
<asp:BoundField HeaderText="Service" ReadOnly="True"
DataField="Identity" />
<asp:BoundField DataField="Description" HeaderText="Description"
ReadOnly="True" />
the boundfield of service binds to data of type: "Microsoft.Rtc.Rgs.Management.RgsIdentity"
it contains an instanceID
and serviceID
propertyand the serviceID
contains a property fullName
!
when i bind it directly like "DataField="Identity"
it shows a very long string with the fullName included!
is there a way to only bind the fullName? like "DataField="Identity.ServiceID.FullName"
? in xml? (this does not work :-)
Yes it is possible with
TemplateFields
but it depends upon thedataSource
design too. Have a look at this sample:Markup:
Code behind: