I have a method in Session which populates text fields on a webpage with data from a database. This method is called from the webpage’s Open event (or Shown event). It works fine.
But, now I have created a mobile optimised webpage which will be displayed if Session.Platform is indicating a mobile device. I want to call this same method, but from this alternative webpage.
Trouble is the method explicitly populates the controls of the original webpage. I therefore want to create a variable which will point to the calling page.
So in my method, instead of a line like:-
Session.MyPage1.fldCustomerName.Text = datafield1.stringvalue
I want to state something like this…
varPage.fldCustomerName.Text = datafield1.stringvalue
Where varPage is a valid reference to the calling page. Goes without saying that all calling pages must contain a control called fldCustomerName, of course.
I have tried setting the calling page event to something like
Dim varPage as new MyPage1
Session.MethodGetData(varPage)
But the method fails to compile as varPage “does not exist”
Any ideas? Am I approaching this the wrong way?