Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

sharing data

  Asked By: Hayrah    Date: Jun 29    Category: Asp.net    Views: 5260

i have index.aspx page which contain header control.
this control is the header for all pages.
in the header.ascx file im creating an object wich expose me very important
parameters about the client who log in:
i need this information for all my pages.
my q is , how can those properties can be recognized in the index.aspx which
host the header control.
One important thing is that im dont want to use sessions.
i thought to expose the userObj.properties as the header control properties but
it's not working.
is it better to leave the control idea and just include the header section
instead of control?



1 Answer Found

Answer #1    Answered By: Danny Perkins     Answered On: Jun 29

i got many questions but none of them wasn't the "real" solution.
but...i found the solution my self !
i add constructor to my class that give me all client  properties from sql
(my objects are vb and the pages  that uses them are in c#)

public sub new()
end sub

public sub generateUser()
'find the uid client cookie and go to sql server and get me all user
end sub

now to the header  control:

userObject userObj = new userObject();
//at this point since i had constructor it gets me all the user properties
private void page_load
//bla bla

//expose control  property
public string webUrl

return userObj.webUrl;


now to my page  which host the control:


protected netTools.header userObj;//header control with user object
private void Page_Load(object sender, System.EventArgs e)
//print header property
Response.Write (userObj.webUrl);

hopes your case is similar.
for me it's works great since it's exactly what i wanted to do

Didn't find what you were looking for? Find more on sharing data Or get search suggestion and latest updates.