Last post Jan 26, 2010 07:42 PM by dzieba
Jan 26, 2010 06:19 PM|mterui|LINK
This may be elementary user control stuff, but I can't get it to work.
How can I pass the Membership.GetUser.UserName variable (or any variable) through a user control parameter at load time?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
ucMyAccount.User = Membership.GetUser.UserName
The only thing that I was able to do was to create the User Control object in the code behind and then add it to the page. Although that works, it doesn't seem like the correct way to program.
Any ideas would be much appreciated!
Jan 26, 2010 07:42 PM|dzieba|LINK
I had a similar problem and found that the control's load event happend before the page that it's on.
The only way that I was able to make it work was to set it at some later time and to force it to redraw. In my case it was a dataList so I just had to rebind with the data. have you tried the PageLoaded event?