FogBugz UI Elements > Create a FogBugz case link
Functionality
FogBugz.UI.BugDisplay.Link takes either a CBug object or an ixBug (integer) and outputs the html to produce a case link like the ones you see throughout FogBugz, complete with the summary information box that appears when the link is hovered:
In order to easily enforce FogBugz permissions, we recommend using a CBug object and checking the current user's permissions before displaying information about it. The following code demonstrates several possible formats as shown here:
C# Code
int ixBug = 4;
CBug bug = api.Bug.GetBug(ixBug);
if (bug.IsReadableByPerson(api.Person.GetCurrentPerson().ixPerson))
{
return string.Format(@"<p>BugDisplay.Link() can produce case links
with various formats:</p>
<p><strong>Standard:</strong> {0}</p>
<p><strong>Just the ixBug:</strong> {1}</p>
<p><strong>ixBug and Title:</strong> {2}</p>",
BugDisplay.Link(bug),
BugDisplay.Link(bug,bug.ixBug.ToString()),
BugDisplay.Link(bug,string.Format("{0} ({1})",
bug.ixBug.ToString(),
HttpUtility.HtmlEncode(bug.sTitle)))
);
}
else
return string.Format("Current user does not have permission to see case {0}",
ixBug.ToString());