Logo 
Search:

Asp.net Forum

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

sharing data

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

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:
userObj.name...
userObj.clientID...
etc...
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?

Share: 

 

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 !
ok.
i add constructor to my class that give me all client  properties from sql
server
(my objects are vb and the pages  that uses them are in c#)


userObject.vb
---------------
public sub new()
me.generateUser()
end sub

public sub generateUser()
'find the uid client cookie and go to sql server and get me all user
properties
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
{
get
{

return userObj.webUrl;
}

}

now to my page  which host the control:

index.aspx.cs
--------------

protected netTools.header userObj;//header control with user object
properties
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.




Tagged: