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: ,


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

45855326-fbc1-4316-9bd7-81e241b8efc8

4a0e2634-78da-4297-9eaf-343adcf666a1


Two ways to write User stories

fd91be25-c978-4460-af62-d4d21de974db

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)

58722be5-9391-486a-bc7e-134f57b1d37c

Or

Take a user story and break it down

faa5d4c5-ed39-40b1-b292-c182e5c71ce3

Or use both

5966666f-f1d4-4249-8582-36a92c8581b6

Small user stories are on the top,medium below and large ones at the bottom

752a2e57-10a7-4663-8abf-672dd1a3680f

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

1e342730-2794-40d8-8e53-697839eeedb4

Take the bigger story and break it down

0d1f6c96-0950-4491-9e5d-998f9a2e9b94

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.

629b63a9-0b17-4fd2-a790-9bb99e19f35b

Examples


baee565c-feeb-4dfa-8203-af52035df541

f4a311ed-b41d-4ab0-82df-eacdfa53f246

2cfe9ba2-4908-4a8b-845e-a2e8e6d2121d

User stories are used to pull real information from the product owner.

Labels: , , ,


This page is powered by Blogger. Isn't yours?