Is there an element like asp:literal in Ext.NET to push string elements inside the tag? I am trying to implement a treeview and I get some data in JS. I want to pass this string into ext:TreePanel tag by an element like literal. Is there any tag using in ext.net like this?
The <ext:Label> might be your best best. You can set the .Html property.
Example
<ext:Label runat="server" Html="<h2>Hello World</h2>" />
Hope this helps.
Related
I cannot identify the object of the icon showed in the attached screen shot. I have shown the HTML code as well.
The ID's are getting changed dynamically.
Can anyone guide on how to identity this kind of objects in Selenium?
If the ID is always changed, I recommend using CssSelector instead.
For instance,
<div id="running_number_12345" class="icon something">...</div>
You can use locator
driver.FindElement(By.CssSelector("div[class*='icon something']"));
If your icon doesn't have any specific css pattern, I recommend adding something in class attribute. If not, you have to use complex CssSelector to find it.
Try this
driver.findElement(By.cssSelector(".icon something"));
All elements in my web application are like that: <div id="12ZD34" test-attr="elt1_stop2_3"> .
The id is automatically generated and change for each execution but not the test-attr attribute.
Is it possible to find testing elements by a custom attribute or an xpath from a custom attribute?
Thanks for any help.
Use jQuery:
$('div[test-attr="elt1_stop2_3"]')
XPath would be:
//div[#test-attr='elt1_stop2_3']
You could use LeadFoot's findByXpath:
this.remote.findByXpath("div[#test-attr='elt1_stop2_3']")
I would like to be able to specify exactly where a ContentPart is rendered in a view.
For example, in my Content.Summary.cshtml I want to wrap my title and first image from the gallery (I'm using ZenGallery) in an anchor tag. I thought I would be able to do it like this but the gallery template is not rendered.
<a href="#Url.ItemDisplayUrl((IContent)Model)">
<h2>#Model.ContentItem.TitlePart.Title</h2>
#Display(Model.ContentItem.ZenGalleryPart)
</a>
But if I do the following then the gallery template (ZenGallery.Summary.cshtml) is shown along with all other parts.
#Display(Model.Content)
I understand that the recommended way to do this is probably using Placement.info, is that right? But this way makes more sense to me and would allow for more fine grain control of the end markup. How could I achieve the markup I'm looking for?
This should give you a pretty good start on doing precisely what you want: http://weblogs.asp.net/bleroy/archive/2011/07/31/so-you-don-t-want-to-use-placement-info.aspx
I'm trying to create a menu template in JSF where the link for the current directory has a different "current" or "active" class. The code currently looks like:
<ul>
<li><h:outputLink value="#{request.contextPath}/a/">A</h:outputLink></li>
<li><h:outputLink value="#{request.contextPath}/b/">B</h:outputLink></li>
<li><h:outputLink value="#{request.contextPath}/c/">C</h:outputLink></li>
</ul>
I'm thinking of using something like styleClass="#{(thisDir == currentDir) ? currentLinkClass : normalLinkClass}". But how do I get the current path? Is this even correct, or is there a better way to do this?
Also, I want the links to base on the current path, not just the page. For example, myapp/a/1.jsf and myapp/a/2.jsf (that is, myapp/a/*.jsf) should trigger the active class for the A link. (I hope my explanation is clear.) Is this possible? How should this be done?
Thank you very much!
You can use #{request.requestURI} to get the current request URI. You can if necessary use several EL functions from JSTL fn taglib to do some string comparisons/manipulations in EL.
Your proposed EL styleClass suggestion is perfectly fine. There is no other easy way anyway. Best optimization which you could do so far is to render those links in a loop by an <ui:repeat> so that code duplication is at least eliminated.
You can also try this approach which uses #{view.viewId}:
<h:outputLink
styleClass="#{(view.viewId.equals('/admin/authors.xhtml')) ? 'active' : 'inactive'}"
value="authors.xhtml">Text</h:outputLink>
I haven't been able to figure out how to use strings from resource files (resx) in SharePoint master pages.
I know how to use it with server controls, but can I somehow extract a value and use it in generalt html. I.e. in an alt attribute on a img tag?
<img src="photo.jpg" alt="my_resource_entry_here" />
Here are 2 very good blog posts that describe how to use resources:
http://tomblog.insomniacminds.com/2008/02/25/sharepoint-internals-resources/
http://www.mikhaildikov.com/2007/03/sharepoint-resources-types-use-and_2163.html
The easiest way would be to add a runat="server" attribute to your alt tag. That will solve your problem and you can use the "normal" way of getting resources.
Othwerwise use this syntax to get value from the resx files places in App_Global resources:
<img src="photo.jpg"
alt='<%=this.GetGlobalResourceObject("Global", "Mystring").ToString()%>'
I assume you have a class with a method that lets you get the resource string by the key, e.g. MyResources.GetString(key). In that case you can use something like this:
<img src="photo.jpg" alt='<%=MyResources.GetString("my_resource_key_here")%>' />