This is my Edit page of GuestBook. i want to know where the problem is?In video there is no feature Guid in this page so what to do with feature Guid?
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Globalization;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using mojoPortal.Web;
using mojoPortal.Web.Framework;
using mojoPortal.Web.UI;
//using log4net;
using acme.Business;
using mojoPortal.Business.WebHelpers;
using Resources;
namespace acme.Web.UI
{
public partial class GuestBookEditPage : mojoBasePage
{
private int pageId = -1;
private int moduleId = -1;
private Guid ItemGuid = Guid.Empty;
private GuestBookRespository respositry = new GuestBookRespository();
private GuestBook guestBook = null;
// replace this with your own feature guid or make a static property on one of your business objects
// like MyFeature.FeatureGuid, then you can use that instead of this variable
private Guid featureGuid = Guid.Empty;
protected void Page_Load(object sender, EventArgs e)
{
LoadParams();
if (!UserCanEditModule(moduleId, featureGuid))
{
SiteUtils.RedirectToAccessDeniedPage(this);
return;
}
LoadSettings();
if (guestBook == null)
{
SiteUtils.RedirectToAccessDeniedPage();
return;
}
PopulateLabels();
PopulateControls();
}
private void PopulateControls()
{
if (guestBook == null) { return; }
txtEmailAddress.Text =guestBook.EmailAddress;
txtLocation.Text = guestBook.Location;
txtName.Text = guestBook.Name;
txtWebsiteUrl.Text = guestBook.WebSiteUrl;
edComment.Text = guestBook.Comment;
}
void btnSave_Click(object sender, EventArgs e)
{
if (guestBook == null) { return; }
guestBook.Name = txtName.Text;
guestBook.EmailAddress = txtEmailAddress.Text;
guestBook.Location = txtLocation.Text;
guestBook.WebSiteUrl = txtWebsiteUrl.Text;
guestBook.Comment = edComment.Text;
respositry.Save(guestBook);
WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl());
}
void btnDelete_Click(object sender, EventArgs e)
{
if (guestBook == null) { return; }
WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl());
}
private void PopulateLabels()
{
btnSave.Text = GuestBookResources.SaveButton;
btnDelete.Text = GuestBookResources.DeleteButton;
UIHelper.AddConfirmationDialog(btnDelete, GuestBookResources.DeleteConfirmationWarning);
}
private void LoadSettings()
{
edComment.WebEditor.ToolBar = mojoPortal.Web.Editor.ToolBar.AnonymousUser;
edComment.WebEditor.Height = Unit.Pixel(250);
edComment.WebEditor.Width = Unit.Pixel(400);
guestBook = respositry.Fetch(ItemGuid);
if (guestBook != null)
{
if (guestBook.ModuleId != moduleId)
{
guestBook = null;
}
}
}
private void LoadParams()
{
pageId = WebUtils.ParseInt32FromQueryString("pageid", pageId);
moduleId = WebUtils.ParseInt32FromQueryString("mid", moduleId);
ItemGuid = WebUtils.ParseGuidFromQueryString("item", ItemGuid);
}
#region OnInit
override protected void OnInit(EventArgs e)
{
base.OnInit(e);
this.Load += new EventHandler(this.Page_Load);
}
#endregion
}
}