Tuesday, September 28, 2010
Binding a Custom Meta field to a Template in Sitefinity with a ASP.NET Usercontrol
To get the background about this issue please read this article in Sitefinity knowledge base.
The last section of the article suggests that you can use the following syntax to set the NavigateUrl property of the ASP.NET Hyperlink control with its Text property
<asp:HyperLink ID="PDFAttachment" runat="server" NavigateUrl='<%=this.Text %>'></asp:HyperLink>
However the above doesn’t work and <%= %> is rendered as plain text
After trying to figure this out for a while I found the following way to do this, the trick is to create a custom user control that implements ITextControl interface, like this
public partial class UserControls_PDFAttachmentDownload : System.Web.UI.UserControl, ITextControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
private string text;
public string Text
{
get
{
return this.text;
}
set
{
if (!string.IsNullOrEmpty(value))
{
this.showdownload.NavigateUrl = ResolveUrl(value);
}
}
}
}
The highlighted line above sets the NavigateUrl property from the Text value that is bound to the control.
The ASCX part of the user control simply has a ASP.NET Hyperlink control in it
<asp:HyperLink ID="showdownload" runat="server" Text="Download" />
To use this control just add a reference in the Template usercontrol that Sitefinity uses and your on your way.
<%@ Register TagName="Attachment" TagPrefix="PDF" Src="~/UserControls/PDFAttachmentDownload.ascx" %>
<div class="sf_singleNews">
....
<p>
<PDF:Attachment ID="PDFAttachment" runat="server" />
</p>
....
</div>
Hope this little trick helped you, let me know.
Labels: ASP.NET, Sitefinity
Monday, September 20, 2010
Notes: How to gather Agile Requirements with User Stories? Why Use them? How to write them?
Following are just some rough notes taken while watching Mike Cohn’s ‘User Stories for Agile Requirements’ talk at NDC2010 conference, I am posting them here hoping that it will help you, for a more in-depth look at user stories I recommend watching Mike’s presentation.
What is a User story?
Short simple statement told from the perspective of the user.
Why use them?
User stories are a way to capture user requirement
How does it look like?
User Story Template
As-a (some user)
I want/I need (something)
So that (some reason)
Samples
As a user, I want to reserve a hotel room
As a user, I want to cancel a reservation
As a vacation traveler, I want to see photos of the hotels
As a frequent flyer, I want to rebook a past trip so that I save time booking trips I take often
Balance between developer division and business is important
Two ways to write User stories
Right user stories on a card, right story details behind the card
these become tests, high level tests (don't use 'tests' with product owner)
Or
Take a user story and break it down
Or use both
-
Rip up the big story and write some smaller stories
-
Write condition of satisfaction on the back of the index card
-
Those user stories go to the product backlog, it should look like an Iceberg
Small user stories are on the top,medium below and large ones at the bottom
Take the medium user stories, break them up and bring them to the Sprint/Iteration, backlog gets empty every few weeks, break epic stories and make smaller ones
Epic is a large user story
Theme is a collection of related user stories
Take the bigger story and break it down
Replace document with discussion, if requirements are only documented and not discussed most likely user is going to get what is written, not what they wanted.
Examples
User stories are used to pull real information from the product owner.
Labels: Agile, Scrum, User stories, XP