Conditional template in a table in dart web ui - dart

I recently update Dart to Dart SDK version 0.7.1.0_r27025 and have not been able to get conditional templates inside tables to work. The code I have at the moment is:
<td template if="loaded">
<p>Loading</p>
</td>
<td template if="!loaded">
<div>...</div>
</td>
However, if I run that in dartium and inspect the DOM all I see is
<td></td>
<td></td>
and I get a RangeError in the code that was generated by build.dart.
Has something changed in how dart handles conditional templates in tables in the latest release?

I was able to fix this by doing
<td>
<template if="!loaded">
<p>Loading...</p>
</template>
<div id="my_id"></div>
</td>
It seems it is no longer necessary to use the template as an attribute in tables.

Related

Showing the user a custom page after list add in Sharepoint 2007

After my user adds a new list item with my custom list page, Sharepoint 2007 redirects them to AllItems.aspx. I want them to go the the custom page ThankYou.aspx instead.
My buttos are the standard buttons generated by SharePoint Designer
<table>
<tr>
<td width="99%" class="ms-toolbar" nowrap=""><IMG SRC="/_layouts/images/blank.gif" width="1" height="18"/></td>
<td class="ms-toolbar" nowrap="">
<SharePoint:SaveButton runat="server" ControlMode="New" id="savebutton2"/>
</td>
<td class="ms-separator"> </td>
<td class="ms-toolbar" nowrap="" align="right">
<SharePoint:GoBackButton runat="server" ControlMode="New" id="gobackbutton2"/>
</td>
</tr>
</table>
I have seen several solutions that require adding 150 lines of JavaScript or changing the underlying SharePoint code, and I just can't believe that is the solution - I think either it is so simple that no one has written about it, or I am using the wrong search term to look for it.
I was just overlooking something simple.
The Source parameter on the form link will change the redirect for you. So if your custom form is at
https://myserver/lists/customadd.aspx
Then you can just add the source parameter and Sharepoint will redirect there on submit:
https://myserver/lists/customadd.aspx?Source=ThankYou.aspx

iTextsharp with MVC giving error

I am using iTextSharp with Asp.Net MVC and when i am adding a anchor tag in html table,I am getting this error.
Error :-
Unable to cast object of type 'iTextSharp.text.html.simpleparser.CellWrapper' to type 'iTextSharp.text.Paragraph'.
If I remove this anchor tag then i am not getting this error.
This is my html table.
<table>
<tr>
<td>
home
</td>
</tr>
</table>
Please Help..Thanks..!!!
Better to use "MvcRazorToPdf"
Please download complete code from,
https://github.com/andyhutch77/MvcRazorToPdf

Clicking on image using RSpec & Capybara

I'm using Rspec and Capybara.
I am attempting to click an image, but cannot find a way to get Capybara to click the image. I'm not sure what to do, as I have in fact same class, alt and src.
Thanks
Example of html
<tr class="even">
<td class="gridData" style="text-align:center;">
<td class="gridData"> 221 </td>
<td class="gridData" route="default" reset="0" urlparams="users index edit {userID}" label="Username">
<td class="gridData">
<img class="user-info-grid" alt="info" src="/themes/system/images/icon/16/information.png">
</td>
</tr>
<tr class="odd">
<td class="gridData" style="text-align:center;">
<td class="gridData"> 222 </td>
<td class="gridData" route="default" reset="0" urlparams="users index edit {userID}" label="Username">
<td class="gridData">
<img class="user-info-grid" alt="info" src="/themes/system/images/icon/16/information.png">
In fact here is the source, which I want to test:
<img class="user-info-grid" alt="info" src="/themes/system/images/icon/16/information.png">
But as I said, I cannot find a way to get Capybara to click the image.
Any ideas?
You can use this:
page.first(".user-info-grid").click
This is use to find user-info-grid class and apply click function.
If multiple classes are comes with this name then the click will execute in first found class.
You can use that when looking for an id:
find("#the_id").click
Or for a class
find(".the_class").click
I put this and works:
find("img[src*='myphoto.jpg']").click
That's because your image is an image, not a link. Wrap it inside a link first, then click the link, like so:
<img ... />
Do I understand correctly that there's no <a> element because you're using a JavaScript onclick handler? If so, then you need to be aware that plain Capybara doesn't do JavaScript. You need to use capybara-webkit, Selenium, or something else similar.
But I'd advise you to put in the <a> element, and apply the JS handler to that. That will make it easier for user agents without JavaScript to handle (yes, there still are some!).
And Matthias is right: make your HTML valid.
Try using XPath, if not that then you can use either visit_to the source of the link, or you can use try help on http://railscasts.com/episodes/257-request-specs-and-capybara

Grails - Custom tag inside a standard Grails tag

It is possible to call a Grails' tag inside another one using the following synthax.
<g:aContainingGrailsTag value="${aContainedGrailsTag(attr:'whatever')}"
Is it possible to include a custom tag into a Grails tag using the exact same syntax.
I am trying it this way:
<td class="${redOrGreen(number:'i')}"> </td>
but it does not work.
Any insight on this greatly appreciated.
In this specific case, you can do it like this:
<td class="<yourNameSpace:redOrGreen number='i' />"> </td>
or in general:
<td class="${yourNameSpace.redOrGreen(number:'i')}"> </td>
Only for tags within g: can be called without namespace prefix.

ASP.NET MVC Html.TextBox won't compile at runtime - same files work in other projects

We have two separate front end projects for the same company which are basically the same except for all the html and css. (Different divisions within the same company) I'm trying to add a page that was built in one over to the other. (Yes, yes, I know we probably should've built a single app that display different presentations based on which division's instance was running so that we wouldn't have to maintain two separate but the same codebases, but we just can't go there with this client.)
Anyway, I copied over the controller, the model, and the aspx and ascx pages. All I needed to change was the name on the root namespace. For some reason, a particular ascx page that compiles successfully in the first project, fails in the second project.
Here's the error message:
e:\pathtocode\Web\Views\EmailToFriend\Email.ascx(24): error CS1061:
'System.Web.Mvc.HtmlHelper<MainWeb.Models.EmailToFriend>' does not contain a definition for
'TextBox' and no extension method 'TextBox' accepting a first argument of type
'System.Web.Mvc.HtmlHelper<MainWeb.Models.EmailToFriend>'
could be found (are you missing a using directive or an assembly reference?)
Here's the code for the ascx:
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="Form.ascx.cs"
Inherits="MainWeb.Views.EmailToFriend.Form" %>
<%# Import Namespace="System.Web.Mvc" %>
<table>
<span class="error" style="color: red;">
<%= Model.ErrorString %>
</span>
<tr>
<td>Friend's Name: </td>
<td><%= Html.TextBox("RecipientName", Model.RecipientName)%></td>
</tr>
<tr>
<td>Friend's Email Address: </td>
<td><%= Html.TextBox("RecipientAddress", Model.RecipientEmail)%></td>
</tr>
<tr>
<td>Your Name: </td>
<td><%= Html.TextBox("SenderName", Model.SenderName ?? UserName)%></td>
</tr>
<tr>
<td>Your Email Address: </td>
<td><%= Html.TextBox("SenderAddress", Model.SenderEmail ?? UserEmail)%></td>
</tr>
<tr>
<td>Message</td>
<td><%= Html.TextArea("Message", Model.Message) %></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Send" style="float: right;"/></td>
</tr>
</table>
I've been futzing around with everything I could think of. Html.TextBox works fine in other files in the same project, so I can't figure out why this is blowing chunks.
UPDATE
I've just discovered that in the project where this code works, VS recognizes the project as an MVC web application, but in the second one where it doesn't work, VS does not recognize that it's MVC. At least if I right click on a Views subfolder the former has a context menu item for 'New View', where the latter project doesn't have this.
Now all I have to do is figure out how to turn it into an MVC project, and maybe that will fix it.
UPDATE #2
Drat, that didn't work. I modified the Import directive to use System.Web.Mvc.Html, and now at least intellisense shows the definition for the .TextBox extension - will try restarting the box to see what happens. :(
final update
As I posted in the comments, I found the error and it had to do with a completely different file, so it was basically my mistake and not a code problem. :(
Are you sure Form (as in Inherits="MainWeb.Views.EmailToFriend.Form") inherits from MVC's ViewPage base class?
My guess is you either want to have
Inherits="System.Web.Mvc.ViewPage"
or
namespace MainWeb.Views.EmailToFriend
{
public class Form : System.Web.Mvc.ViewPage
{
}
}
Most likely you also don't need CodeBehind="Form.ascx.cs". Did you add a regular web form instead of MVC view to your project?
Have you made sure that the compiler is set to 3.5 in the codedom section of the web.config? I battled for hours trying to figure out why I could not use html helpers, most posts are advising to add the System.Web.Mvc.Html namespace which is neccessary for the intellisense, yet since the pages aren't compiled until they are rendered you don't realise that this is false security. Here is a post to fix the compiler version issue: Problem creating my own extension to HtmlHelper

Resources