2/24/2011 10:40:54 AM
31
Reputation
4
Total posts
Hi Denis,
Thanks for your reply. That's helpful and confirms what I had thought. Your API is extensive and fairly comprehensive - I would expect to be doing custom coding using the API to do things that are not built in stright out of the box. At the moment I am just 'feeling my way' through and trying to guage how steep the learning curve will be.
Before you came back with your post, I managed to write a Web Part which did what I wanted. Starting with a new web part, inheriting from your base part, I worked out that I had to include extra references in my VS2010 project not included by your sample project by default. I also had to find and learn how to use LLBLGen ORM Support Classes (something I am unfamiliar with, although I take your point that using this is optional).
After some hours or reading and a bit of trial and error I was able to write the following very basic bit of code which worked, all-be-it without any of the templating features of a common Web Part.
namespace
ProjectName.Web.MonoX.ModuleGallery.SocialNetworking.Groups
{
public
partial
class
PopularGroupList : MonoSoftware.MonoX.BasePart
{
private
int
_listSize = 5;
private
string
_header =
string
.Empty;
public
int
ListSize
{
get
{
return
_listSize; }
set
{ _listSize = value; }
}
public
string
Header
{
get
{
return
_header; }
set
{ _header = value; }
}
protected
void
Page_Load(
object
sender, EventArgs e)
{
string
output = String.Empty;
using
(GroupRepository repo = GroupRepository.GetInstance())
{
int
recordCount;
ISortExpression sorter =
new
SortExpression(SnGroupFields.MemberCount | SortOperator.Descending);
EntityCollection<SnGroupEntity> groups = repo.GetGroupCollection(
null
, sorter,
null
, 1, _listSize,
out
recordCount);
if
(!String.IsNullOrEmpty(_header))
{
output +=
"<h3>"
+ _header +
"</h3>"
;
}
foreach
(SnGroupEntity group
in
groups)
{
output += String.Format(
"<li>{0} ({1})</li>"
, group.Name, group.MemberCount.ToString());
}
}
litPopularGroups.Text = output;
}
}
}
Now the next step would be to add in to my Web Part all the aspects of Templating and Paging. But this is already done in your NewGroupsList. Would you be able to help walk me through how to write my WebPart inheriting from this NewGroupsList, just overriding the DataBind() method?
Or have I got the wrong idea?
Thanks once again,
Oli.
Rating history (Content is rated 0.00 of 0 vote(s).)
Shows who have rated the content, and the rating score.