Link to home
Start Free TrialLog in
Avatar of jimbona27
jimbona27Flag for United Kingdom of Great Britain and Northern Ireland

asked on

access master page data

hi EE,
I have the following line of code in a master file but when trying to access it within code I get null.

When debugging through the master file it has a value but when my new code gets executed the value is null.

can someone please advise me what im doing wrong?

many thanks,

// in master file
MyMasterPageModel.ViewDataKey = "MasterPageModel";
MyMasterPageModel model = ViewData[MyMasterPageModel.ViewDataKey] as MyMasterPageModel;  // model has a value


// in child file

if ((MyMasterPageModel )ViewData["MasterPageModel"])  // returns null ??

Open in new window

Avatar of existenz2
Flag of Netherlands image

Have a look at

It's not exactly what you are looking for, but it should give you some tips.
Avatar of sweetsathish

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial