I am using kendo grid in asp.net mvc4. A column of a grid is Email, so I make a link to the column like that:
col.Bound(con => con.EmailName).Title("Email").Width(120).ClientTemplate(" #=EmailName == null ? '': EmailName#").Filterable(true);
It's Working well. But, I also have to field DoNotEmail and DoNotEmailMarketingCampaigns Whose are Boolean. I want to make the link if both field are false, otherwise I will not make a link. I tried following way:
col.Bound(con => con.EmailName).Title("Email").Width(120).ClientTemplate("#if(!DoNotEmailMarketingCampaigns && !DoNotEmail) { # #=EmailName == null ? '': EmailName# #} else { #=EmailName == null ? '': EmailName# } #").Filterable(true);
but it's not serving my purpose. Any suggestions?
Finally Done with following Code:
col.Bound(con => con.EmailName).Title("Email").Width(120).ClientTemplate("#if(!DoNotEmailMarketingCampaigns && !DoNotEmail) { # #=EmailName == null ? '': EmailName# #} else {# #=EmailName == null ? '': EmailName# #} #").Filterable(true);
Related
I am new to Vue and I have to fix the following issue for work. I have a Bootstrap Vue b-form-checkbox-group similar to the one bellow. The listofOption comes from backend and from legacy databses. Sometime the ColumnName is empty or null. Right now it shows null or a blank space, but I want it to print the text "_blank" if that is the case.
<b-form-checkbox-group id="flavors"
v-model="status"
:options="listofOption"
:text-field="ColumnName"
:value-field="ColumnName"
name="flavors" class="ml-4" aria-label="Individual flavours" stacked>
</b-form-checkbox-group>
I have replaced the :text-field with the following line but can't make it work:
:text-field="[(ColumnName && ColumnName != null && ColumnName != '') ? ColumnName : '_blank']"
You could pass that value binding via function.
getColumnName(ColumnName) {
return (ColumnName && ColumnName != '') ? ColumnName : '_blank'
}
Then:
:text-field="getColumnName(ColumnName)
Here what I've done in vision
*[_type == "post" && categories == SOCIAL ]{
_id, title
}
It returned
No documents found in dataset production that match query:
*[_type == "post" && categories == SOCIAL ]{
_id, title
}
You have to format it like so:
*[_type == "post" && categories == "SOCIAL" in categories[]->title]{
title,
slug,
body
}
If nothing shows up then there are no posts associated with that category. Categories are also case sensitive, so make sure your capitalization is right.
*[_type == "post" && "social" in categories[]->title]{
title
}
*[_type == 'post' && category->name == 'Technology']
Can also try this in cases where your categories are not saved as arrays.
What worked for me is instead of searching by the name of the category i searched using the ._ref property of the category.
It would look something like this
*[_type == "post" && categories == categories._ref]
I'm trying to add condition to trigger mouseover, only if minState == true .
So far here's what I have tried already yet it didn't worked:
v-on:mouseover="minState == true ? collapsableSideBar : null"
.
v-on="minState == true ? { mouseover: collapsableSideBar } : {}"
.
v-on="{ mouseover: minState == true ? collapsableSideBar : null }"
I have the following:
.ensure('baseContent.ValidFromDate', (config) => { config.computedFrom(['baseContent.ValidFromDate', 'baseContent.ValidFromTime', 'baseContent.ValidToDate', 'baseContent.ValidToTime']) })
.if(() => {
return this.baseContent.ValidFromDate !== null && this.baseContent.ValidFromTime !== null && this.baseContent.ValidToDate !== null && this.baseContent.ValidToTime !== null })
.passes( () => { return this.datetimeformat.format(this.baseContent.ValidFromDate, this.baseContent.ValidFromTime) < this.datetimeformat.format(this.baseContent.ValidToDate, this.baseContent.ValidToTime) })
.withMessage('< Valid To')
.endIf()
I believed that config.computedFrom(['baseContent.ValidFromDate', 'baseContent.ValidFromTime', 'baseContent.ValidToDate', 'baseContent.ValidToTime']) - meant that if one of these values changed it would re-run the validation? However it only does this on 'baseContent.ValidFromDate', what am I missing / not understanding?
UPDATE
Seems the issue is to do with computedFrom doesn't support paths, don't really know another way round this barring adding this validation to the four items
This feature was added last week (aurelia-binding 1.0.0-beta.1.3.0). See https://github.com/aurelia/binding/issues/149
Syntax when used as a decorator is:
#computedFrom('obj.firstName', 'obj.lastName')
I'm trying to add a new column to a .Net MVC WebGrid that includes a checkbox that is there if a specific condition is met and not there if the condition is false.
The below code works to correctly display X or Y (placeholder):
grid.Column("ID", header: "",
style: "labelcolumn",
format: (item) => item.ID != null ? "X" : "Y"),
I can't seem to get the syntax right to include the checkbox instead of X.
grid.Column("ID", header: "",
style: "labelcolumn",
format: (item) => item.ID != null ? #<text><input class="check-box" id="cbSelectedBranch" name="cbSelectedBranch" type="checkbox" value="#item.ID" /></text> : "Y"),
On this second snippet, the "(item)" variable causes this error:
CS0136: A local variable named 'item' cannot be declared in this scope
because it would give a different meaning to 'item', which is already
used in a 'parent or current' scope to denote something else
Adding the # when using the if null condition seems to cause item to throw this error. The below code, without the conditional, works correctly:
grid.Column(header: "",
style: "labelcolumn",
format: #<text><input class="check-box" id="cbSelectedBranch" name="cbSelectedBranch" type="checkbox" value="#item.ID" /></text>),
Any idea how I can make this work with a conditional and checkbox input?
try like this:
format: (item) => item.ID != null ? Html.Raw("<input class='check-box' id='cbSelectedBranch' name='cbSelectedBranch' type='checkbox' value='#item.ID' />") : "Y")