When binding to templates, many examples use the following syntax: ${startDate} and #= startDate #. There does not seem to be a difference and the use is inconsistent. The docs does not shed any light on this. Which one is recommended and is there a difference?
There is no difference between these two usage
${startDate} - this is jquery template style(this is also supported by kendo ) to render literal
#= startDate #- this is kendo template style to rendering literal values
example
The difference between ${startDate} and #= startDate # is that the first one will encode any HTML entities contained in startDate. The latter will embed the HTML tags in the page. It is recommended to use ${startDate}.
In short
${startDate} when startDate == "<strong>foo</strong>" will output "<strong>foo</strong>"
#= startDate # when startDate == "<strong>foo</strong>" will output "<strong>foo</strong>"
Related
Trying to show/hide a couple of rectangles in SSRS based on an expression which uses the value of a parameter in the report. See the screenshots for more details. When the '-Cover pages' label is picked I want it to display the rectangle but I consistently get the following errors. It can't seem to convert and read the parameter expression no matter what I do.
The expression I'm trying to use is:
=iif(Parameters!specparam.Value="-Cover Pages",true,false)
It looks like the label of your parameter is what you're looking for based on the image provided and your expression. Try to switch instead to:
=IIF(Parameters!specparam.Label="-Cover Pages",TRUE,FALSE)
(Note: I switched specparam.Value to specparam.Label.
Your comment is very close. Apply this expression to the Hidden property of the rectangle:
=IIF( Parameters!specparam.Label.Equals("-Cover Pages"), FALSE, TRUE )
You'll notice I have switched around the FALSE and TRUE as you don't want the rectangle to hide when the parameter matches.
Edit:
As you're dealing with a multivalue parameter, you can use a combination of Array.IndexOf and Split to check if your value is one of the selected parameters.
Apply this expression to the Hidden property of your rectangle:
=IIF( Array.IndexOf( Split( Parameters!specparam.Value, "," ), "-Cover Pages" ) > -1, FALSE, TRUE )
I'm using Kendo's templates and am trying to assign the literal contents of my object's "value" field to a javascript variable. Example of what I'm trying to do is given below:
# var a = (#= data.value #) #
I keep getting an invalid template error.. is this possible to do with Kendo's templates?
Thank you
Just use
# var a = data.value #
//and later you will have it available
#if(a=="foo"){#
//...
#}#
You should get the idea.
Please use like below. You should able to get JavaScript value in Kendo template.
#var a = data.value #
Do not forget to mark as answer !
I have a page that searches with filters. I have this code for example,
xmlTempResultSearch = xmlResidentListDisplay.selectNodes("//PeopleList/Row[#LastName != '"+txtSearch.value+"']");
xmlTempResultSearch.removeAll();
This selects the data that is not equal to the LastName inputted on the txtSearch textbox and then removes them from the result set so that its filtered to equal the last name on the txtSearch textbox.
My problem with this code is that it should be equal (=) to the txtSearch.value, what I want is that I want the result set LIKE the txtSearch.value. What happens on my page is that when I type 'santos' on the txtSearch textbox, its result set is all those last names with 'santos'. But when I type 'sant', nothing appears. I want the same result set with 'santos' because it all contains 'sant'
You can use all of the XPath (1.0) string functions. If you have XPath 2.0 available, then you can even use RegEx.
contains()
starts-with()
substring()
substring-before()
substring-after()
concat()
translate()
string-length()
There is no **ends-with() in XPath 1.0, but it can easily be expressed with this XPath 1.0 expression**:
substring($s, string-length($s) - string-length($t) +1) = $t
is true() exactly when the string $s ends with the string $t.
You can use start-with function and not function. Reference:
http://www.w3schools.com/xpath/xpath_functions.asp
xmlTempResultSearch = xmlResidentListDisplay.selectNodes("//PeopleList/Row[not(starts-with(#LastName,'"+ txtSearch.value +"'))]");
you can use contains() function of XPath:
xmlTempResultSearch = xmlResidentListDisplay.selectNodes("//PeopleList/Row[not(contains(#LastName,'"+txtSearch.value+"'))]");
I am trying to click an element that changes per each order like so
edit_div_123
edit_div_124
edit_div_xxx
xxx = any three numbers
I have tried using regex like so:
#driver.find_element(:css, "#edit_order_#{\d*} > div.submit > button[name=\"commit\"]").click
#driver.find_element(:xpath, "//*[(#id = "edit_order_#{\d*}")]//button").click
Is this possible? Any other ways of doing this?
You cannot use Regexp, like the other answers have indicated.
Instead, you can use a nifty CSS Selector trick:
#driver.find_element(:css, "[id^=\"edit_order_\"] > div.submit > button[name=\"commit\"]").click
Using:
^= indicates to find the element with the value beginning with your criteria.
*= says the criteria should be found anywhere within the element's value
$= indicates to find the element with with your criteria at the end of the value.
~= allows you to find the element based on a single criteria when the actual value has multiple space-seperated list of values.
Take a look at http://net.tutsplus.com/tutorials/html-css-techniques/the-30-css-selectors-you-must-memorize/ for some more info on other neat CSS tricks you should add to your utility belt!
You have no provided any html fragment that you are working on. Hence my answer is just based on the limited inputs provided your question.
I don't think WebDriver APIs support regex for locating elements. However, you can achieve what you want using just plain XPath as follows:
//*[starts-with(#id, 'edit_div_')]//button
Explanation: Above xpath will try to search all <button> nodes present under all elements whose id attribute starts with string edit_div_
In short, you can use starts-with() xpath function in order to match element with id format as edit_div_ followed by any number of characters
No, you can not.
But you should do something like this:
function hasClass(element, className) {
var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
return re.test(element.className);
}
This worked for me
#driver.find_element(:xpath, "//a[contains(#href, 'person')]").click
I am trying to get the following ternary conditional to work in Asp.Net MVC 3 Razor:
Next
All of the examples I am finding of using a ternary conditional in Razor have return values which are strings. But here I would like to use an expression (Model.PageNumber + 1) and return a number. Is this possible?
Drop the # sign before the value:
Next
Let me just add that in general, Razor doesn't need/want the # prefix unless it's absolutely necessary, for example:
<div>
#foreach(var value in Model.Values)
{
if(value.Flag)
{
<div>#value.Text</div>
}
}
<div>
Notice that you don't need a second # sign until you're actually inside the tag, where Razor wouldn't know whether you wanted to display the text "value.Text" or execute it as code. The if statement is assumed to be code. To escape this and write the line "if(value.Flag)" as text you'd need to explicitly say so with the #: prefix.