Quantcast
Channel: ASPRunner forums
Viewing all articles
Browse latest Browse all 2586

Welcome page event code

$
0
0
Here is some code I am using on the Before display event on the Welcome page to show or hide tiles on the welcome page according to the access level I grant to users.

Quote

string strSQLExists = "select * from dbo.tblUser where AccessID IN (1,2) AND UserName = '" + XSession.Session["UserID"].ToString() + "'";
XVar rsExists = CommonFunctions.db_query(strSQLExists, null);
XVar data = CommonFunctions.db_fetch_array(rsExists);

if(data)
{
//List all welcome_group objects here
pageObject.showItem("welcome_group_quality");
pageObject.showItem("welcome_group_IPC");

//List all welcome_item objects here
pageObject.showItem("welcome_item_NEWS2");
pageObject.showItem("welcome_item_ANTT");
}
else
{
//List all welcome_group objects here
pageObject.hideItem("welcome_group_quality");
pageObject.hideItem("welcome_group_IPC");

//List all welcome_item objects here
pageObject.hideItem("welcome_item_NEWS2");
pageObject.hideItem("welcome_item_ANTT");
}


The problem with this solution is that when I add more list pages to the project, I will need to add more rows to the event code for each one.

Does anyone know if there are any easier solutions that will show/hide all items within a welcome_group object, or perhaps enable me to loop through all item objects within a group object?

Viewing all articles
Browse latest Browse all 2586

Trending Articles