I want to show the page number of a PDF. The current page is saved in Int currentpage;. I created a Label like Label pagenumber = new Label();. I tried with pagenumber.textProperty().bind(currentpage); but then Eclipse ask me to change currentPage in ObservableValue <? extends String >. I think it's really easy to do what I want, but I'm very new about JavaFX. Sorry, for the easy question.
Thanks
It was really easy.
I write the solution, maybe it could be helpful to someone very new, like me , in JavaFX.
pagenumber.setText("" +currentPage);
or in general
Label.setText("" +intValue);
try this
pagenumber.setText(Integer.toString(currentPage));
Related
I'd like to "hide" one column in my RadGrid and only have it show when I'm in edit mode. I tried just moving it into the edit item template, but that didn't work at all.
Any suggestions would be deeply appreciated!
Thank you!
Oy...
"Paul's Third Law of Asking For Help
You will discover the obscure answer 5 minutes after giving up and asking for advice."
Turns out you set the column to "Display=False" but only if you are in popup or edit form mode, not inline.
Hope it helps someone else.
Even though you did answer this yourself I thought I'd write an answer to clarify some things.
You can set the default value of the EditColumn to be false, even in InPlace edit. However it makes it a lot more difficult to save edited data as the InPlace edit (for simplicity) requires the EditColumn to display the save or cancel items.
That being said, you can do it - however you need to use explicit CommandNames on the items:
Say you want to Update a row with the new values you have inserted in the InPlace edit. Then the confirm button's CommandName would HAVE to be "Update" to be picked up correctly.
All of this being said, it would be a lot simpler for you to keep the EditColumn intact even when in InPlace (editmode).
Or you could specify the EditTemplate for one column to widen the column, add the two buttons necessary to perform Update and Cancel as well as hiding the EditColumn so that multiple InPlaceEdits can't be performed at the same time. :)
I hope this helps someone, as I was stuck in a similar situation myself when I had to incorporate both InPlace and EditForms EditModes on a single RadGrid and knowing the above information made a WORLD of difference.
You can try this:
var agtype = $telerik.$(atCell).text().trim();
if(agtype == ""Guaranty""){{
var masterTableView = sender.get_masterTableView();
var columnIndex = masterTableView.getColumnByUniqueName(""Amount"").get_element().cellIndex;
masterTableView.showColumn(columnIndex);
}}
I am trying to add the media:thumnail element to the atom feed using SyndicationFeed .net class.
my code looks like the below
item.ElementExtensions.Add(new XElement("thumbnail",
new XAttribute("xmlns", "http://search.yahoo.com/mrss/"),
new XAttribute("url", "http://test.com/test.jpg/"),
new XAttribute("width", 200),
new XAttribute("height", 200)
).CreateReader()
);
which outputs as
<thumbnail url="http://test.com/test.jpg/" width="200" height="200" xmlns="http://search.yahoo.com/mrss/">
</thumbnail>
which is still seems to be valid atom feed. But as per client requirement, I want the format to be
"<media:thumbnail>". Could anyone please help me on this?
I even tried like this
item.ElementExtensions.Add("thumbnail", "http://search.yahoo.com/mrss/", 10);
which outputs as
<media:thumbnail>10</media:thumbnail>
but how do I add attributes instead of value?
finally I resolved the xml namespace issue after looking at this...
[SyndicationFeed change namespace prefix from a10 to atom
for some odd reason I never found that question before I post mine in stackoverflow :(
I'm doing a bit tidy of the Content Manager and have a component that won't delete (not the same as my other question).
When I try to delete the component in question I get the following error
(8004032D) This item is in use.
Unable to delete Component (tcm:4-65020).
UtilitiesBL.AssertItemCanBeDeleted
UtilitiesBL.AssertItemCanBeDeleted
ComponentBL.Delete
Component.Delete
Request.Delete
When I use the Where Used tool on the component I get no results in the "Used In" tab, one result in the "Uses" tab, the "Blueprint Hierachy" shows it is not localized in any of my three child publications and no results in the "Published To" tab.
I have had a look in the Content Manager database to see if I can spot what is going wrong but not really found anything.
Any ideas?
Thanks in advance.
It looks like the Where Used tool in R5.3 isn't working correctly. The component in question is used in 15000 other components. I found this by using the TOM API directly.
var componentID = "tcm:4-65020";
TDS.TDSE tdse = new TDS.TDSE();
var component = (TDS.Component)tdse.GetObject(componentID, TDSDefines.EnumOpenMode.OpenModeView);
var whereUsedString = component .Info.GetListUsingItems();
Now comes the task of deleting all these links...
Are there any open source/free frameworks available that take some of the pain out of building HTML e-mails in C#?
I maintain a number of standalone ASP.NET web forms whose main function is to send an e-mail. Most of these are in plain text format right now, because doing a nice HTML presentation is just too tedious.
I'd also be interested in other approaches to tackling this same problem.
EDIT: To be clear, I'm interested in taking plain text form input (name, address, phone number) and dropping it into an HTML e-mail template. That way the receipient would see a nicely formatted message instead of the primitive text output we're currently giving them.
EDIT 2: As I'm thinking more about this and about the answers the question has generated so far, I'm getting a clearer picture of what I'm looking for. Ideally I'd like a new class that would allow me to go:
HtmlMessage body = new HtmlMessage();
body.Header(imageLink);
body.Title("Some Text That Will Display as a Header");
body.Rows.Add("First Name", FirstName.Text);
The HtmlMessage class builds out a table, drops the images in place and adds new rows for each field that I add. It doesn't seem like it would be that hard to write, so if there's nothing out there, maybe I'll go that route
Andrew Davey created Postal which lets you do templated emails using any of the ASP.NET MVC view engines. Here's a video where he talks about how to use it.
His examples:
public class HomeController : Controller {
public ActionResult Index() {
dynamic email = new Email("Example");
email.To = "webninja#example.com";
email.FunnyLink = DB.GetRandomLolcatLink();
email.Send();
return View();
}
}
And the template using Razor:
To: #ViewBag.To From: lolcats#website.com Subject: Important Message
Hello, You wanted important web links right? Check out this:
#ViewBag.FunnyLink
<3
The C# port of StringTemplate worked well for me. I highly recommend it. The template file can have a number of named tokens like this:
...
<b>
Your information to login is as follows:<br />
Username: $username$<br />
Password: $password$<br />
</b>
...
...and you can load this template and populate it like this:
notificationTemplate.SetAttribute("username", Username);
notificationTemplate.SetAttribute("password", Password);
At the end, you get the ToString() of the template and assign it to the MailMessage.Body property.
I recently implemented what you're describing using MarkDownSharp. It was pretty much painless.
It's the same framework (minus a few tweaks) that StackOverflow uses to take plain-text-formatted posts and make them look like nice HTML.
Another option would be to use something like TinyMCE to give your users a WYWIWYG HTML editor. This would give them more power over the look and feel of their emails, but it might just overcomplicate things.
Bear in mind that there are also some security issues with user-generated HTML. Regardless of which strategy you use, you need to make sure you sanitize the user's input so they can't include scary things like script tags in their input.
Edit
Sorry, I didn't realize you were looking for an email templating solution. The simplest solution I've come up with is to enable text "macros" in user-generated content emails. So, for example, the user could input:
Dear {RecipientFirstName},
Thank you for your interest in {ClientCompanyName}. The position you applied for has the following minimum requirements:
- B.S. or greater in Computer Science or related field
- ...
And then we'd do some simple parsing to break this down to:
Dear {0},
Thank you for your interest in {1}. The position you applied for has the following minimum requirements:
- B.S. or greater in Computer Science or related field
- ...
... and ...
0 = "RecipientFirstName"
1 = "ClientCompanyName"
...
We store these two components in our database, and whenever we're ready to create a new instance from this template, we evaluate the values of the given property names, and use a standard format string call to generate the actual content.
string.Format(s, macroCodes.Select(c => EvaluateMacroCode(c, obj)).ToArray());
Then I use MarkdownSharp, along with some HTML sanitizing methods, to produce a nicely-formatted HTML email message:
Dear John,
Thank you for your interest in Microsoft. The position you applied for has the following minimum requirements:
B.S. or greater in Computer Science or related field
...
I'd be curious to know if there's something better out there, but I haven't found anything yet.
I'm currently working on some DateTime properties in a PropertyGrid in c#.Net. Im using the default drop-down datetime picker.
My question: Is there any way to show the full date with the time? By default the date is shown if no time is set, but I want zero-values aswell. I.e: I want "09.11.2009 00:00" to be shown instead of "09.11.2009".
Do I have to use some custom TypeConverter or Editor for this?
I feel so lost in this propertygrid and it makes me sad...
Any help would be appreciated! Thanks :)
Yes, you need your own TypeConverter. Derive it from DateTimeConverter and override the ConvertTo method. If you look this method in Reflector you will see this piece of code inside:
if (time.TimeOfDay.TotalSeconds == 0.0)
return time.ToString("yyyy-MM-dd", culture);
Just remove that for example.
Nicolas