Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X
This is the forum to discuss the Wrox book Professional Web Parts and Custom Controls with ASP.NET 2.0 by Peter Vogel; ISBN: 9780764578601
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 14th, 2010, 09:40 AM
Registered User
 
Join Date: Apr 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question WebParts PersonalizationProvider object issue

I've created my custom class VittiCatalystUIServices inheriting from PersonalizationProvider. In this custom class, Iíve written custom methods for these methods Initialize,LoadPersonalizationBlobs,SavePersonaliz ationBlob and ResetPersonalizationBlob.
o I've 2 types of roles: Admin and User and there is a dropdown (rdRole) in my master page which contains these roles.
o Whenever i create an object of my VittiCatalystUIServices class, it calls the LoadPersonalizationBlobs before Pageload () of my master page.
o In my custom LoadPersonalizationBlobs event, Iím loading data based on role (admin or user).
o Default selection for dropdown (rdRole) is ĎAdminí. On rdRole_SelectedIndexChanged, if I changed rdRole to user, then the LoadPersonalizationBlobs is executed before rdRole_SelectedIndexChanged event.
o So this is creating a problem for me as in the LoadPersonalizationBlobs, the newly selected User data is not being loaded but its loading admin data since rdRole_SelectedIndexChanged event is not yet executed.
o Same goes with SavePersonalizationBlob event.
How can I overcome this issue? My only need is I want to get the latest selected dropdown value in LoadPersonalizationBlobs event or is it possible to skip LoadPersonalizationBlobs event whenever I create an object of my class..?
Below is my class code:

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.Configuration;
using System.Configuration.Provider;
using System.Globalization;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Collections.Specialized;
using System.Collections;
using Telerik.Web.UI;
using Telerik.Web.Design;

/// <summary>
/// Summary description for VittiCatalystUIServices
/// </summary>
///

namespace PharmARC.VittiCatalyst.UIServices
{
public class VittiCatalystUIServices : PersonalizationProvider
{

#region Variables Declaration

public static readonly string CNS = ConfigurationManager.AppSettings["CNS"].ToString();
private static int RoleID = 3;
private string connectionString;
private string m_ApplicationName;
private string m_ConnectionStringName;
public string _CurrentUser = "";
public string _CurrentPagePath = "";
public int _CurrentUserRole;
public bool IsAdminStatus;
public static string _RoleToBePersonalised = "Admin";
public bool IsResetByAdmin = false;
public static int status = 0;
public static bool _IsLoadPersonalizationBlobsExecutedByObject = false;
public static int IsDefaultSelectedRoleAdmin = 0;

#endregion

#region Constructor

#endregion

#region Methods

#region Customise Initialize Method of PersonalizationProvider

public override void Initialize(string name, NameValueCollection config)
{
// Verify that config isn't null
if (config == null)
throw new ArgumentNullException("config");

// Assign the provider a default name if it doesn't have one
if (String.IsNullOrEmpty(name))
name = "VittiCatalystUIServices";

// Add a default "description" attribute to config if the
// attribute doesn't exist or is empty
if (string.IsNullOrEmpty(config["description"]))
{
config.Remove("description");
config.Add("description",
"Simple personalization provider");
}

// Call the base class's Initialize method
base.Initialize(name, config);

if (string.IsNullOrEmpty(config["connectionStringName"]))
{
throw new ProviderException
("ConnectionStringName property has not been specified");
}
else
{
m_ConnectionStringName = config["connectionStringName"];
config.Remove("connectionStringName");
}

// Initialize SQLiteConnection.
//

ConnectionStringSettings ConnectionStringSettings =
ConfigurationManager.ConnectionStrings[m_ConnectionStringName];

if (ConnectionStringSettings == null || ConnectionStringSettings.ConnectionString.Trim() == "")
{
throw new ProviderException("Connection string cannot be blank.");
}

connectionString = ConnectionStringSettings.ConnectionString;


// Throw an exception if unrecognized attributes remain
if (config.Count > 0)
{
string attr = config.GetKey(0);
if (!String.IsNullOrEmpty(attr))
throw new ProviderException
("Unrecognized attribute: " + attr);
}

}

#endregion

#region Check Current User is Admin or User
protected bool IsAdmin(string User)
{


SqlConnection conn = new SqlConnection(CNS);
int status = 0;
try
{

conn.Open();
SqlCommand cmdUser = new SqlCommand("[dbo].[personalization_IsAdmin]", conn);
cmdUser.CommandType = CommandType.StoredProcedure;
cmdUser.Parameters.AddWithValue("@username", User);

status = Convert.ToInt32(cmdUser.ExecuteScalar());

}
catch (Exception)
{
throw;
}
finally
{
conn.Close();
}
if (status == 1)
return true;
else
return false;
}
#endregion

#region Set WebPartManager Display Mode on Display mode Dropdown Selected Index Changed

public void SetDispayModeForWebPartManager(string selectedIndexValue)
{
Object obj;
obj = HttpContext.Current.Session["webPartManager"];
WebPartManager WBPM = (WebPartManager)obj;
switch (selectedIndexValue)
{
case "Browse":
WBPM.DisplayMode = WebPartManager.BrowseDisplayMode;
break;
case "Design":
WBPM.DisplayMode = WebPartManager.DesignDisplayMode;
break;
}
}
#endregion


#region getRoleDropdown

public RadComboBox GetRoleDropdownControlInMasterPage(Page pg)
{
RadComboBox rdRole = null;
int index = 0;
string controlid = "";
try
{

foreach (Control cc in pg.Master.Controls)
{
if (cc.GetType().ToString() == "System.Web.UI.HtmlControls.HtmlForm")
{
controlid = cc.ID.ToString();

break;
}
index++;
}

if (controlid != null)
{
HtmlForm MasterForm = (HtmlForm)pg.Master.Controls[index];

index = 0;
controlid = "";
foreach (Control cc in MasterForm.Controls)
{
if (cc.GetType().ToString() == "Telerik.Web.UI.RadComboBox")
{
controlid = cc.UniqueID.ToString();
break;

}
index++;
}

if (controlid != null)
{
rdRole = (RadComboBox)MasterForm.Controls[index];
}
}
}
catch (Exception ex)
{
throw (ex);
}
return rdRole;
}

#endregion

#region Get WebPartManager control for current page

public WebPartManager GetWebPartManagerControlInCurrentPage(Page pg)
{
WebPartManager WBP = null;
int index = 0;
string controlid = "";
try
{
foreach (Control cc in pg.Master.Controls)
{
if (cc.GetType().ToString() == "System.Web.UI.HtmlControls.HtmlForm")
{
controlid = cc.ID.ToString();

break;
}
index++;
}

if (controlid != null)
{
HtmlForm MasterForm = (HtmlForm)pg.Master.Controls[index];
index = 0;
controlid = "";
foreach (Control cc in MasterForm.Controls)
{
if (cc.GetType().ToString() == "System.Web.UI.WebControls.ContentPlaceHolder" )
{
controlid = cc.UniqueID.ToString();
break;

}
index++;
}

if (controlid != null)
{
ContentPlaceHolder cph = (ContentPlaceHolder)MasterForm.Controls[index];
if (cph != null)
{
index = 0;
controlid = "";
foreach (Control cc in cph.Controls)
{
if (cc.GetType().ToString() == "System.Web.UI.WebControls.WebParts.WebPartManager ")
{
controlid = cc.ID.ToString();
break;
}
index++;
}
}

WBP = (WebPartManager)cph.Controls[index];

}

}
HttpContext.Current.Session["CPage"] = pg;
}


catch (Exception ex)
{
throw (ex);
}
return WBP;
}

#endregion

#region Disable/Hide WebParts Close Verbs and Reset Link By Role

public void DisableVerbsForWebPartsByRole(WebPartManager WBP)
{

//IsAdminStatus = IsAdmin("Admin");
IsAdminStatus = IsAdmin(CurrentUser);


if (WBP != null)
{
if (IsAdminStatus == false)
{

foreach (WebPart wbp in WBP.WebParts)
{
wbp.Zone.CloseVerb.Visible = false;

}

}
}
}

public void HideResetLinkByRole(LinkButton lnkReset)
{

IsAdminStatus = IsAdmin(CurrentUser);
try
{

if (IsAdminStatus == false)
{
lnkReset.Visible = false;
}
else
{
lnkReset.Visible = true;
}
}
catch (Exception ex)
{
throw (ex);
}

}

#endregion


#region Bind Role Selection dropdown
public void BindRoleDD(RadComboBox rcmb)
{
SqlConnection conn = new SqlConnection(CNS);
try
{
conn.Open();
SqlCommand cmdRole = new SqlCommand("[dbo].[Vitti_GetRoles]", conn);
cmdRole.CommandType = CommandType.StoredProcedure;
cmdRole.ExecuteNonQuery();
SqlDataAdapter Adp = new SqlDataAdapter(cmdRole);
DataSet Ds = new DataSet();
Adp.Fill(Ds);
rcmb.DataSource = Ds.Tables[0];
rcmb.DataTextField = "Role";
rcmb.DataValueField = "RoleID";
rcmb.DataBind();

}
catch (Exception)
{
throw;
}
finally
{
conn.Close();
}
}

#endregion

#region Bind Display Mode Selection dropdown
public void BindDisplayModeDD(RadComboBox rcmbDisplayMode)
{
SqlConnection conn = new SqlConnection(CNS);
try
{
conn.Open();
SqlCommand cmdDisplayMode = new SqlCommand("[dbo].[Vitti_GetDisplayModes]", conn);
cmdDisplayMode.CommandType = CommandType.StoredProcedure;
cmdDisplayMode.ExecuteNonQuery();
SqlDataAdapter Adp = new SqlDataAdapter(cmdDisplayMode);
DataSet Ds = new DataSet();
Adp.Fill(Ds);
rcmbDisplayMode.DataSource = Ds.Tables[0];
rcmbDisplayMode.DataTextField = "Display_Mode";
rcmbDisplayMode.DataValueField = "Display_Mode_ID";
rcmbDisplayMode.DataBind();

}
catch (Exception)
{
throw;
}
finally
{
conn.Close();
}

}
#endregion


#endregion

#region Properties
//public virtual WebPartVerb RestoreVerb { get; }


#region GetSetPersonalizationProviderApplicationName

//Application Name is a member of PersonalizationProvider Class
public override string ApplicationName
{
get { return m_ApplicationName; }
set { m_ApplicationName = value; }
}
#endregion

#region Get/Set Role(End User/Admin) to be personalised by Admin

public static string RoleToBePersonalised
{
get { return _RoleToBePersonalised; }
set { _RoleToBePersonalised = value; }
}

#endregion

#region Get/Set IsLoadPersonalizationBlobsExecutedByObject

//public static bool IsLoadPersonalizationBlobsExecutedByObject
//{
// get { return _IsLoadPersonalizationBlobsExecutedByObject; }
// set { _IsLoadPersonalizationBlobsExecutedByObject = value; }
//}
#endregion



#region GetSetConnectionString

public string ConnectionStringName
{
get { return m_ConnectionStringName; }
set { m_ConnectionStringName = value; }
}

#endregion


#region Set Current User and Page Path

public string CurrentUser
{
get { return _CurrentUser; }
set { _CurrentUser = value; }
}

public string CurrentPagePath
{
get { return _CurrentPagePath; }
set { _CurrentPagePath = value; }
}

public int CurrentUserRole
{
get { return _CurrentUserRole; }
set { _CurrentUserRole = value; }
}

#endregion

#endregion

#region LoadPERSONALISATIONsTATE
//public virtual PersonalizationState LoadPersonalizationState
// (WebPartManager webPartManager, bool ignoreCurrentUser)
//{
// //throw new NotSupportedException();
// //this.LoadPersonalizationBlobs (
//}

#endregion

#region Customise LoadPersonalizationBlobs Method of PersonalizationProvider

protected override void LoadPersonalizationBlobs(WebPartManager webPartManager, string path, string userName, ref byte[] sharedDataBlob, ref byte[] userDataBlob)
{


HttpContext.Current.Session["webPartManager"] = webPartManager;
// Load shared state
sharedDataBlob = null;
userDataBlob = null;
//object sharedBlobDataObject = null;
object userBlobDataObject = null;
//HttpContext.Current.Session["RoleToBePersonalised"] = RoleToBePersonalised;
SqlConnection conn = new SqlConnection(CNS);
try
{
conn.Open();


Object obj;
obj = HttpContext.Current.Session["CPage"];
if (obj != null)
{
Page pg = (Page)obj;
RadComboBox rdRole = GetRoleDropdownControlInMasterPage(pg);

}

if (status == 0)
{

if (RoleToBePersonalised == "Admin" || RoleToBePersonalised == "admin")
{
userName = RoleToBePersonalised;
SqlCommand cmdUser = new SqlCommand("[personalization_SelectUserPersonalization]", conn);
cmdUser.CommandType = CommandType.StoredProcedure;
cmdUser.Parameters.AddWithValue("@username", userName);
cmdUser.Parameters.AddWithValue("@path", path);
userBlobDataObject = cmdUser.ExecuteScalar();

if (userBlobDataObject != null)
userDataBlob = (byte[])userBlobDataObject;

}


}
else if (status == 1)
{
if (RoleToBePersonalised == "User")
{
userName = "";
SqlCommand cmdUser = new SqlCommand("[personalization_SelectUserPersonalization]", conn);
cmdUser.CommandType = CommandType.StoredProcedure;
cmdUser.Parameters.AddWithValue("@username", userName);
cmdUser.Parameters.AddWithValue("@path", path);
userBlobDataObject = cmdUser.ExecuteScalar();

if (userBlobDataObject != null)
userDataBlob = (byte[])userBlobDataObject;

if (IsResetByAdmin == true)
{
foreach (WebPart wbp in webPartManager.WebParts)
{

wbp.ChromeState = PartChromeState.Normal;
}
}
}
}
else
{
if (String.IsNullOrEmpty(RoleToBePersonalised))
{
SqlCommand cmdUser = new SqlCommand("[personalization_SelectUserPersonalization]", conn);
cmdUser.CommandType = CommandType.StoredProcedure;
cmdUser.Parameters.AddWithValue("@username", userName);
cmdUser.Parameters.AddWithValue("@path", path);
userBlobDataObject = cmdUser.ExecuteScalar();

if (userBlobDataObject != null)
userDataBlob = (byte[])userBlobDataObject;
}
}
//}
}
catch (Exception ex)
{
throw ex;
}
finally
{
conn.Close();
}
}

#endregion

#region Customise ResetPersonalizationBlob Method of PersonalizationProvider

protected override void ResetPersonalizationBlob(WebPartManager webPartManager, string path, string userName)
{
// Delete the specified personalization file


NameValueCollection config = new NameValueCollection();
config.Add("connectionStringName", CNS);

connectionString = CNS;//HttpContext.Current.Session["connectionString"].ToString(); ;

SqlConnection conn = new SqlConnection(connectionString);
try
{

conn.Open();
if (IsResetByAdmin == false)
{
SqlCommand cmd = new SqlCommand("[personalization_DeletePersonalization]", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@username", userName);
cmd.Parameters.AddWithValue("@path", path);
cmd.Parameters.AddWithValue("@Role", RoleToBePersonalised);
cmd.ExecuteNonQuery();
HttpContext.Current.Response.Redirect(_CurrentPage Path);
}


}
catch (Exception ex) { throw ex; }
finally
{
conn.Close();
}
}

#endregion

#region Customise SavePersonalizationBlob Method of PersonalizationProvider

protected override void SavePersonalizationBlob(WebPartManager webPartManager, string path, string userName, byte[] dataBlob)
{


SqlConnection conn = new SqlConnection(connectionString);
try
{
conn.Open();

if (RoleToBePersonalised == "Admin" || RoleToBePersonalised == "admin")
{
userName = RoleToBePersonalised;
SqlCommand cmd = new SqlCommand("[personalization_AlreadyInPersonalization]", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@username", userName);
cmd.Parameters.AddWithValue("@path", path);
cmd.Parameters.AddWithValue("@Role", RoleToBePersonalised);

if (int.Parse(cmd.ExecuteScalar().ToString()) > 0)
{

cmd = new SqlCommand("[personalization_Updatepersonalization]", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@username", userName);
cmd.Parameters.AddWithValue("@path", path);
cmd.Parameters.AddWithValue("@Role", RoleToBePersonalised);
cmd.Parameters.AddWithValue("@personalizationblob" , dataBlob);
}
else
{
cmd = new SqlCommand("personalization_Insertpersonalization" , conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@username", userName);
cmd.Parameters.AddWithValue("@path", path);
cmd.Parameters.AddWithValue("@Role", RoleToBePersonalised);
cmd.Parameters.AddWithValue("@personalizationblob" , dataBlob);
}
cmd.ExecuteNonQuery();
}
else if (RoleToBePersonalised == "User")
{
userName = "";
SqlCommand cmd = new SqlCommand("[personalization_AlreadyInPersonalization]", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@username", userName);
cmd.Parameters.AddWithValue("@path", path);
cmd.Parameters.AddWithValue("@Role", RoleToBePersonalised);

if (int.Parse(cmd.ExecuteScalar().ToString()) > 0)
{

cmd = new SqlCommand("[personalization_Updatepersonalization]", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@username", userName);
cmd.Parameters.AddWithValue("@path", path);
cmd.Parameters.AddWithValue("@Role", RoleToBePersonalised);
cmd.Parameters.AddWithValue("@personalizationblob" , dataBlob);
}
else
{
cmd = new SqlCommand("personalization_Insertpersonalization" , conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@username", userName);
cmd.Parameters.AddWithValue("@path", path);
cmd.Parameters.AddWithValue("@Role", RoleToBePersonalised);
cmd.Parameters.AddWithValue("@personalizationblob" , dataBlob);
}
cmd.ExecuteNonQuery();
}

else if (String.IsNullOrEmpty(RoleToBePersonalised))
{

SqlCommand cmd = new SqlCommand("[personalization_AlreadyInPersonalization]", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@username", userName);
cmd.Parameters.AddWithValue("@path", path);
cmd.Parameters.AddWithValue("@Role", RoleToBePersonalised);

if (int.Parse(cmd.ExecuteScalar().ToString()) > 0)
{

cmd = new SqlCommand("[personalization_Updatepersonalization]", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@username", userName);
cmd.Parameters.AddWithValue("@path", path);
cmd.Parameters.AddWithValue("@Role", RoleToBePersonalised);
cmd.Parameters.AddWithValue("@personalizationblob" , dataBlob);
}
else
{
cmd = new SqlCommand("personalization_Insertpersonalization" , conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@username", userName);
cmd.Parameters.AddWithValue("@path", path);
cmd.Parameters.AddWithValue("@Role", RoleToBePersonalised);
cmd.Parameters.AddWithValue("@personalizationblob" , dataBlob);
}
cmd.ExecuteNonQuery();

}
//}
}
finally
{
conn.Close();
}
}

#endregion

#region Customise ResetPersonalizationState Method of PersonalizationProvider

public override void ResetPersonalizationState(WebPartManager webPartManager)
{
if (IsResetByAdmin == false)
{
this.ResetPersonalizationBlob(webPartManager, CurrentPagePath, CurrentUser);
}

}

#endregion

#region Declare FindState,GetCountOfState,ResetState and ResetUserState Methods of PersonalizationProvider

public override PersonalizationStateInfoCollection FindState
(PersonalizationScope scope, PersonalizationStateQuery query,
int pageIndex, int pageSize, out int totalRecords)
{
throw new NotSupportedException();
}

public override int GetCountOfState(PersonalizationScope scope,
PersonalizationStateQuery query)
{
throw new NotSupportedException();
}

public override int ResetState(PersonalizationScope scope,
string[] paths, string[] usernames)
{
throw new NotSupportedException();
}


public override int ResetUserState(string path,
DateTime userInactiveSinceDate)
{
throw new NotSupportedException();
}

#endregion

}
}

Below is master page.cs code

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections;
using PharmARC.VittiCatalyst.UIServices;
using Telerik.Web.UI;
using Telerik.Web.Design;
public partial class VittiCatalystUIServicesMasterPage : System.Web.UI.MasterPage
{


VittiCatalystUIServices objVCUIServices = null;
protected void Page_Init(object sender, EventArgs e)
{

if (Request.Form["rdRole"] != null)
{

string value = Request.Form["rdRole"];
if (value.Contains("Admin"))
{

}

}
objVCUIServices = new VittiCatalystUIServices();
}


protected void Page_Load(object sender, EventArgs e)
{

string sPath = System.Web.HttpContext.Current.Request.Url.Absolut ePath;
System.IO.FileInfo oInfo = new System.IO.FileInfo(sPath);
objVCUIServices._CurrentPagePath = "~/" + oInfo.Name;
objVCUIServices._CurrentUser = Page.User.Identity.Name;
objVCUIServices._CurrentUserRole = 1;
objVCUIServices.HideResetLinkByRole(LinkButton1);


if (!IsPostBack)
{
WebPartManager wbp = objVCUIServices.GetWebPartManagerControlInCurrentP age(Page);
LoadMenuFromtbMenu(1, 1);
//objVCUIServices._RoleToBePersonalised = "Admin";
//Session["RoleToBePersonalised"] = "Admin";
objVCUIServices.BindRoleDD(rdRole);
objVCUIServices.BindDisplayModeDD(rdDisplayMode);
objVCUIServices.DisableVerbsForWebPartsByRole(wbp) ;
//VittiCatalystUIServices.IsLoadPersonalizationBlobs ExecutedByObject = false;
//objVCUIServices.LoadPersonalizationState(wbp, true);
}
else
{
//VittiCatalystUIServices.IsLoadPersonalizationBlobs ExecutedByObject = false;
}

}

protected void LinkButton1_Click(object sender, EventArgs e)
{
//ResetPersonalizationState
WebPartManager wbp = new WebPartManager();
objVCUIServices.ResetPersonalizationState(wbp);
}

protected void rdRole_DataBound(object sender, EventArgs e)
{

}
protected void rdDisplayMode_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEven tArgs e)
{
objVCUIServices.SetDispayModeForWebPartManager(rdD isplayMode.SelectedItem.Text.ToString());
}
protected void rdDisplayMode_DataBound(object sender, EventArgs e)
{

}
protected void rdRole_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEven tArgs e)
{
WebPartManager wbp = objVCUIServices.GetWebPartManagerControlInCurrentP age(Page);
//new WebPartManager ();


VittiCatalystUIServices.RoleToBePersonalised = rdRole.SelectedItem.Text.ToString();

objVCUIServices.IsResetByAdmin = true;
if (rdRole.SelectedItem.Text.ToString() != "Admin" || rdRole.SelectedItem.Text.ToString() != "admin")
{
//VittiCatalystUIServices.IsLoadPersonalizationBlobs ExecutedByObject = false;
//objVCUIServices.LoadPersonalizationState(wbp, true);
VittiCatalystUIServices.status = 1;
}
else
{
VittiCatalystUIServices.status = 0;
//VittiCatalystUIServices.IsLoadPersonalizationBlobs ExecutedByObject = false;
//objVCUIServices.LoadPersonalizationState(wbp, true);
}

}


protected void LoadMenuFromtbMenu(int id, int selected)
{
System.Drawing.Color bgColor = System.Drawing.ColorTranslator.FromHtml("#e7edf6") ;


RadMenuItem item;
for (var i = 0; i < 5; i++)
{
item = new RadMenuItem();
item.GroupSettings.Flow = Telerik.Web.UI.ItemFlow.Horizontal;
item.ForeColor = System.Drawing.Color.Navy;
item.BackColor = bgColor;
item.Text = "item " + i.ToString();

RadMenuItem subMenuItem = new RadMenuItem("subitem");

subMenuItem.GroupSettings.Flow = Telerik.Web.UI.ItemFlow.Vertical;
item.Items.Add(subMenuItem);

RadMenuItem subMenuItem2 = new RadMenuItem("subitem");
subMenuItem2.GroupSettings.Flow = Telerik.Web.UI.ItemFlow.Vertical;
item.Items.Add(subMenuItem2);

this.RadMenu1.Items.Add(item);

item = new RadMenuItem();
item.IsSeparator = true;

this.RadMenu1.Items.Add(item);


}

}
}
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Are Webparts running only with IE ? mrf ASP.NET 2.0 Basics 1 July 24th, 2010 09:45 AM
WebParts not working at all... Jurjen BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 3 April 10th, 2008 04:51 PM
webparts authentication ayyub123 ASP.NET 2.0 Basics 0 May 28th, 2007 01:53 AM
Object Bound DataGrid Update Issue rodmcleay C# 2005 6 February 24th, 2007 10:44 PM
Windows service creating ActiveX object issue ceegh VB.NET 0 August 5th, 2004 05:02 PM



All times are GMT -4. The time now is 05:24 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.