This topic is locked
[SOLVED]

 Menu Items Modify Event

2/11/2018 5:28:42 AM
ASPRunner.NET General questions
jadach authorDevClub member

I want to dynamically change the title of a menu item and change the link.
When a member is logged in, they will see a menu item on the welcome page called registration. That link goes to the add page.
When the member registers, I want the welcome page menu item to read Registration COMPLETE and link to the list page.
I can only manage to get one of the changes working (only the first one listed). Here is my Menu items Modify event. Thanks for any help.

if (menuItem.getTitle() == "Registration")

{

string sql = "select AddedBy from dbo.Registration where AddedBy='" + XSession.Session["UserID"].ToString() + "'";

XVar rs = tDAL.CustomQuery(sql);

XVar data = CommonFunctions.db_fetch_array(rs);

if (data)

menuItem.setPageType("list"); //works

menuItem.setTitle("Registration COMPLETE"); //ignored

}

return true;
Pete K 2/11/2018

Jerry,
I think the problem is your statements following the if clause are not enclosed in braces. Did you forget to do that?

admin 2/12/2018

Pete is correct, here is an update code:

if (menuItem.getTitle() == "Registration")

{

string sql = "select AddedBy from dbo.Registration where AddedBy='" + XSession.Session["UserID"].ToString() + "'";

XVar rs = tDAL.CustomQuery(sql);

XVar data = CommonFunctions.db_fetch_array(rs);

if (data) {

menuItem.setPageType("list"); //works

menuItem.setTitle("Registration COMPLETE"); //ignored

}

}

return true;
jadach authorDevClub member 2/12/2018

Ugh. Thanks guys. Funny how you miss little things like this.