Display data member in group header template in Kendo UI Grid ASP.NET MVC - kendo-grid

I have a member that I want to display other member from data in group header. Look at below code:
#Html.Kendo().Grid<MailModel>()
...
.Columns(c=>
{
...
c.Bound(b=> b.ReceivedDate).ClientGroupHeaderTemplate("#:data.ReceivedDateStandard#");
...
})
.DataSource(ds=> ds
.Ajax()
.Group(g=>g.Add(i=>i.ReceivedDate))
);
Everything work great, but the group header text is "undefined"!!!
How can I show another member data in group header text?
Thanks for fallowing.....

Unfortunately, I don't think what you are trying to achieve is possible.
Logically, when you are grouping, the only members that you have available are the members that you are grouping by and the aggregates of that group.
Unless you can group by both ReceivedDate and ReceivedDateStandard or calculate ReceivedDateStandard from ReceivedDate then you wont be able to show ReceivedDateStandard in the group header.

for anyone with problem binding to the current value but with custom template, use this binding:
#:value#
instead of
#:data.FieldName#

Related

SSRS hiding a row group if there are no detail rows

Can someone please help me write a custom code that will check if the details of the row group = nothing? I'd like to use this as a show/hide expression such that table 0 will not display if there are no records within the group.
I can't seem to use aggregations for the row group details at the row group level.
Edit:
example 1 with a detail row
example 2 with without a detail row but the group header still displays. I'd like to hide this group completely:
OK, so it looks like you want to hide a table, not just a group within a table.
If this is not correct , please post your full report design.
You should be able to just count the rows in the dataset that the table is bound to.
So if your table is bound to `DataSet`` the 'Hidden' property would just be
=COUNTROWS("DataSet1") = 0
"DataSet1" is the name of the dataset, it is case sensitive and must be enclosed in double quotes.
The table will be hidden but the space it consumes will not be used, in other words, you will have a blank space where the table should be.
Alternatively, you can set the NoRowsMessage property to simple text message or an expression which will be displayed instead of just hiding the table.
I ended up using an IIF(IsNothing(Fields!MyField.Value), Parameters!ShowMissingGroup.Value,False) for the row group expression visibility then using a parameter to hide/show it.

How to Hide selected group Column in Kendo Angular 6 Grid,

I have a requirement in which some selected group columns should be hidden, and rest group columns should display.
How can we achieve it using Kendo ui + Angular 6.
You can bind the ColumnComponent's hidden input to an expression that returns the respective boolean value after performing the required custom logic that will determine whether a column should be hidden or not.
The grouping configuration is available in the object the Grid group input is bound to.
Here is an example that demonstrates hiding all columns the data is grouped by, but ProductName:
EXAMPLE

Need Validation on html dropdownlist with data from Viewbag

I know I'm not supposed to use the Viewbag and that I should build a menu using Html.DropDowlListFor() so that i can add attribute bound to the members of the model, BUT, that would involve a pretty extensive code rewrite....
I have a custom controller with a menu:
*.ASCX
<%: Html.DropDownList("CityIDs", new SelectList(ViewBag.cities, "Id", "Name"), "--Select--", new { style = "width:200px" })%>
<%= Html.ValidationMessage("CityIDs") %>
The List populates just fine and I can default to the top item to "--Select--"
The prbolem is that I want the validation error to occur on anything that is not from the viewbag.... how can I achieve this?
Validation for dropdown lists only ensures that something was posted. If you want to ensure that the value that was posted is actually one of a set of "allowed" values, then you'll have to manually do that in your post action:
var cityIds = db.Cities.Select(m => m.Id);
if (!cityIds.Contains(model.CityIDs))
{
ModelState.AddModelError("CityIDs", "You must select one of the available choices.");
}
if (ModelState.IsValid)
{
...
Two things:
Notice that I'm pulling the city ids straight from the database (the actual code you'd need here, of course, depends on your specific implementation). The important thing, though, is that ViewBag only survives a single request, so you can't look for them in ViewBag after posting.
Despite the pluralized name of CityIDs, using the DropDownList helper ensures that only a single selected value will exist. If this is actually supposed to be a multiselect, then you need to use ListBox instead, and update this conditional here to account for check for multiple values.
Populates the top item with Text = "--Select--" and Value = ""
which will post a blank value for CityIDs and cause an error in ModelState.

show/hide columns in SSRS report 2012 based on Multiselect parameter

i have been trying to hide/show columns within my tablix based on multi value parameter , but whenever i am plugging in the expression in the column visibility properties it is not showing what i select from the parameter and hide what is not select.
Here is the expression:
=IIF(InStr(JOIN(Parameters!parameter.Value,", "),"value"),false,true)
any help???
If I understand correctly, you want to show the column if you select a value which contains "value". Right?
So the expression should be like below:
=IIF(InStr(JOIN(Parameters!parameter.Value,","),"value")>0,false,true)
I always get this wrong too. I think backwards. It is actually asking for the expression that will hide the column. SO Black_T is correct with his answer.
=IIF(InStr(JOIN(Parameters!Parameter.Value,","),"value")>0,false, true)
so whenever the expression picks up that value in the statement, it will return false, meaning that it should not hide it, and whenever it doesn't find it, well the returned product will also hide it! pretty ingenious!
Thanks and enjoy!
=IIF(InStr(JOIN(Parameters!parameter.Value,","),"value")>0,true,false)

SSRS - Replace the Chart

I have a question, want some assistance.
Q) My question is that i have a chart in which analyst assigned for many incidents and some analyst have 1 or two incident assigned. just because of this the bar chart looks ugly some time. So thats why i used a new chart to represent Min incident count. But i want there some creativeness, for which i want there a radio button or OnClick event ( I do not know how to use both these. When report runs by default it`ll show Max incidents count chart and when we used radio button it will show Min incidents count chart, on the same chart area no need of new area or on new page.
Kindly help me or refer me some links and with ideas. As i have searched many blogs but i didn`t get any big achievement.
Below is my Simplified query;
SELECT
Count(IncidentDimvw.Id)
,UserDimvw.FirstName AS Analyst
FROM
IncidentDimvw
FULL JOIN WorkItemDimvw
ON IncidentDimvw.EntityDimKey = WorkItemDimvw.EntityDimKey
JOIN WorkItemAssignedToUserFactvw
ON WorkItemDimvw.WorkItemDimKey = WorkItemAssignedToUserFactvw.WorkItemDimKey
JOIN UserDimvw
ON WorkItemAssignedToUserFactvw.WorkItemAssignedToUser_UserDimKey = UserDimvw.UserDimKey
WHERE
WorkItemAssignedToUserFactvw.DeletedDate IS NULL
GROUP BY
UserDimvw.FirstName
Having (Count(IncidentDimvw.Id) = (#Count))
Having Clause is right or wrong, i donot know.
I used the following expresion in series as you suggested.
=iif(Parameters!Count.Value, Max(Sum(Fields!ID.Value)), Min(Sum(Fields!ID.Value)))
Sample data is as folows;
Regards
Muhammad Ahsan
I can think of a couple of ways to approach this:
Dynamic expressions based on parameter
Say you have a simple DataSet like:
And also a boolean parameter called showMax.
We can create a simple bar graph based on this:
The most important thing to note is that Series value is expression-based:
In the above example the expression is:
=IIf(Parameters!showMax.Value
, Max(Fields!value.Value)
, Min(Fields!value.Value))
i.e. when showMax is true, report the Max values, otherwise report the min values.
In this case I've also updated the Axis title, Chart title, and Custom legend text to be expression-based:
Axis Title: =IIf(Parameters!showMax.Value, "Max", "Min")
Chart Title: =IIf(Parameters!showMax.Value, "Max per group", "Min per group")
Custom legend text: =IIf(Parameters!showMax.Value, "Max value", "Min value")
The chart behaviour changes based on what parameter is selected as required:
Set Visibility based on parameter
Another option is simply to have to charts and hide one depending on parameter selection.
For example, for the Max chart the Hidden property can be set to:
=Not(Parameters!showMax.Value)
Setting this property correctly for each report will mean only one is ever displayed to the user, i.e. it will look dynamic.
Either of these options should work; the first keeps the layout simple in the designer makes the chart more complex, the second makes the layout more complex but keeps the charts simple.
Hopefully one option will work for you.