Hi ,
I need to show the count along with the name of the bound column.The grid has only master table view and the bound column is getting the values of a list.
ex:
Category:Doc1(2)
Catgeory:Doc2(4)
Categroy:Doc3(5).....
I tried with Pre-render event but it is adding the count in the child items only. please help me to get the count of the values of the bound column.
Below
is the Grid and the Databinding
.Thanks in Advance
Jose
I need to show the count along with the name of the bound column.The grid has only master table view and the bound column is getting the values of a list.
ex:
Category:Doc1(2)
Catgeory:Doc2(4)
Categroy:Doc3(5).....
I tried with Pre-render event but it is adding the count in the child items only. please help me to get the count of the values of the bound column.
Below
<
ad:adGrid
ID
=
"grdAttachments"
runat
=
"server"
Width
=
"100%"
AllowPaging
=
"false"
GroupingEnabled
=
"true"
ShowGroupPanel
=
"false"
MasterTableView-GroupsDefaultExpanded
=
"true"
>
<
MasterTableView
HierarchyLoadMode
=
"Client"
>
<
Columns
>
<
tel:GridBoundColumn
UniqueName
=
"Name"
DataField
=
"Name"
HeaderText
=
"Category"
/>
<
tel:GridHyperLinkColumn
UniqueName
=
"Subject"
DataTextField
=
"Subject"
HeaderText
=
"Subject"
DataNavigateUrlFormatString
=
"ts/disp.aspx?id={0}"
DataNavigateUrlFields
=
"ID"
SortExpression
=
"Subject"
>
<
ItemStyle
CssClass
=
"gridhyperlink"
/>
</
tel:GridHyperLinkColumn
>
<
tel:GridHyperLinkColumn
UniqueName
=
"FileName"
DataTextField
=
"FileName"
HeaderText
=
"Attachment"
DataNavigateUrlFormatString
=
"{0}"
DataNavigateUrlFields
=
"AttachmentUrl"
SortExpression
=
"FileName"
Target
=
"_blank"
>
<
ItemStyle
CssClass
=
"gridhyperlink"
/>
</
tel:GridHyperLinkColumn
>
<
tel:GridDateTimeColumn
UniqueName
=
"CreatedDate"
DataField
=
"CreatedDate"
HeaderText
=
"Date"
/>
<
tel:GridBoundColumn
UniqueName
=
"CreatedBy"
DataField
=
"CreatedBy"
HeaderText
=
"Author"
/>
</
Columns
>
<
GroupByExpressions
>
<
tel:GridGroupByExpression
>
<
SelectFields
>
<
tel:GridGroupByField
FieldName
=
"Name"
FieldAlias
=
"Category"
/>
</
SelectFields
>
<
GroupByFields
>
<
tel:GridGroupByField
FieldName
=
"Name"
/>
</
GroupByFields
>
</
tel:GridGroupByExpression
>
</
GroupByExpressions
>
</
MasterTableView
>
<
ClientSettings
AllowExpandCollapse
=
"true"
>
</
ClientSettings
>
</
ad:adGrid
>
----------------------------------------------------------------
Private Sub grdAttachments_NeedsDataSource(ByVal sender As Object, ByVal e As GridNeedDataSourceEventArgs) Handles grdAttachments.NeedDataSource
Dim types As ADAttachmentTypeList = CMClient.GetAttacntTyps()
Dim attachments = types.Aggregate(
New List(Of Object)(),
Function(acc As List(Of Object), type As ADAttachmentType)
Dim typeAttachments As ADAttachmentList = Document.GetAttachments(type.ID)
typeAttachments.Aggregate(
acc,
Function(acc2 As List(Of Object), attachment As ADAttachment)
Dim extension = attachment.Extension.ToLower()
Dim navigationUrl As String = String.Empty
If CurrentTADClient.CCV Then
navigationUrl = String.Format("ts/view.aspx?id={0}&path={1}&aid={2}", attachment.Document.ID, attachment.FileName, attachment.ID)
ElseIf EnableCommentsWithAttachments Then
navigationUrl = String.Format("reviews/dispyReadOnlyOpt.aspx?id={0}&type=ATTACHMENT&path={1}&aid={2}", attachment.Document.ID, attachment.FileName, attachment.ID)
Else
If (extension = "docx" _
OrElse extension = "doc" _
OrElse extension = "dotx" _
OrElse extension = "dot" _
OrElse extension = "rtf" _
) Then
navigationUrl = String.Format(
"rev/dispyreadonly.aspx?id={0}&type=ATTACHMENT&path={1}",
attachment.Document.ID,
attachment.FileName
)
Else
navigationUrl = attachment.VirtualPath
End If
End If
acc2.Add(New With {
Key .Name = type.Name,
.ID = attachment.ID,
.Subject = attachment.Subject,
.FileName = attachment.FileName,
.CreatedDate = String.Format("{0} {1}", attachment.CreatedDate.ToString(CurrentCulture.DateTimeFormat.ShortDatePattern, CurrentCulture), attachment.CreatedDate.ToString(CurrentCulture.DateTimeFormat.ShortTimePattern, CurrentCulture)),
.CreatedBy = attachment.CreatedBy,
.AttachmentUrl = navigationUrl
})
Return acc2
End Function
)
Return acc
End Function
)
DirectCast(grdAttachments.Columns(1), GridHyperLinkColumn).DataNavigateUrlFormatString = String.Format("{0}hj/ts/displ.aspx?id={1}0{2}", Captions.VirtualRoot, Chr(123), Chr(125))
grdAttachments.DataSource = attachments.ToArray()
End Sub
.Thanks in Advance
Jose