Variable declarations

T

TCB

I am now a little confused about variable declarations in ASP.NET. Please if
it is possible help me with this.

Lets say I have an application where any registered user can modify his user
profile using a WIZARD control. Suppose the UserModProfile.aspx receives a
parameter in the QueryString to know what UserId the user is editing,
something like this: UserModProfile.aspx?UID=1

The UserModProfile.aspx codebehind is something like this:

Private p_UserId as integer

Sub On_Load(...)

If not(me.IsPostBack) Then
p_UserId = Ctype(Request("UID"),Integer)
....so far so good p_UserId has the correct value
End If

End Sub


The problem is that when I get to the end of this Wizzard, the value of
p_UserId is back at 0 (zero) So I have the following questions.

- What is the bert way to store a value through the wizzard process, so I
can send this value whern the wizard is finished to my update record
procedure?
- I also had the problem that sometimes the record that got updated was
someone else´s, maby tha variable was being changed by another
session/instance of that UserModProfile.aspx class?

Please HELP!

Thanks
 
T

TCB

Protected p_UserId as Integer, this still resets to 0 when advancing the
wizard on the first postback

THANKS
 
M

Merennulli

Are you using any links in this process, after the initial one that put
?UID=1 as your querystring of course? If you're losing protected
values, you should also be losing all your fields on the form.

If all else fails, you could create a hidden field to store the value
in, or store it in session variables, but if you're using postback
consistently, this should work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top