private string GetUserPhotoUrl(UserInfo user)
if (user.Profile.Photo == null || user.Profile.Photo == "-1")
return VirtualPathUtility.ToAbsolute("~/LinkClick.aspx") + "?fileticket=" + user.Profile.Photo;
An anonymous user or a user without a profile photo will always get the default no_avatar.gif image.
In DotNetNuke MVP Module Development: Tip #1 The AutoDataBind Property I suggested to use AutoDatBind to automatically bind up the user control. However, there are times when no binding should occur. For example, when a Cancel button is clicked the view should not be bound. AutoDataBind should be disabled when no model is need.
protected void cmdCancel_Click(object sender, EventArgs e)
AutoDataBind = false;
catch (Exception exc)
The DotNetNuke.Web.Mvp.ModuleViewBase sets a property called AutoDataBind = true. As a result the DataBind() method for the page is always called in the Page_PreRenderComplete event.
If you use the following familiar snippet of code you find that your controls will be data bound twice. Once when your code calls DataBind() and a second time when it is called during the Page_PreRenderComplete event.
ddlStatus.DataSource = Model.StatusList;
Here is an example of how to properly bind a DropDownList for an MVP based module.
<asp:DropDownList ID="ddlStatus" runat="server"
It is important to point out again that you should not call ddlStatus.DataBind() from the code behind. Calling this is a waste because the AutoDataBind property is going to force everything to rebind again during Page_PreRenderComplete.
I couldnâ€™t get the Engage: F3 module to work with DotNetnuke 5.5 due to a known issue. This issue will be fixed when Engage: F3 3.4 is released. However, if you need a quick fix until then you can use this script based on the F3 module.
WARNING: Backup your database before executing this script. The script may affect every item published by the Text/HTML module and you will want to have a backup in case you make a mistake.
DECLARE @portalId INT
DECLARE @searchValue NVARCHAR(100)
DECLARE @replaceValue NVARCHAR(100)
SET @portalId = 0
SET @searchValue = '/website/'
SET @replaceValue = '/'
DECLARE @PublishedContent TABLE (ItemId int)
INSERT INTO @PublishedContent (ItemId)
FROM [HtmlText] ht
WHERE ht.IsPublished = 1
AND ht.LastModifiedOnDate = (SELECT MAX(LastModifiedOnDate) FROM [HtmlText] WHERE ModuleID = ht.ModuleID AND IsPublished = 1)
SET Content = REPLACE(CAST(ht.Content AS NVARCHAR(MAX)), @searchValue, @replaceValue)
FROM [HtmlText] ht
JOIN @PublishedContent pc ON (ht.ItemID = pc.ItemId)
JOIN [vw_Modules] m ON (m.ModuleID = ht.ModuleID)
JOIN [vw_Tabs] t ON (t.TabID = m.TabID)
JOIN [vw_Portals] p ON (p.PortalID = t.PortalID)
WHERE ht.Content COLLATE SQL_Latin1_General_CP1_CS_AS LIKE '%' + REPLACE(REPLACE(@searchValue, '\', '\\'), '%', '\%') + '%' ESCAPE '\'
AND (@portalId IS NULL OR m.PortalID = @portalId)