help: how to prevent controls from duplicating

  • Thread starter Thread starter John Smith
  • Start date Start date
J

John Smith

Hello,

I'm a junior in using VB.NET.
I encountered the following problem:

I have a form with some buttons (change password, change username, logout
etc.) and below those buttons I have a label that I want to display some
text, depending what button was pressed (i.e. Changing Password, etc.). I
also want at the same time the click event to handle a redirection to the
aspx page I want to load accordingly (i.e. changing password.aspx).
My problem is when I click any of this buttons a new row of buttons is
generated, but they are lower from the original one, with the new text in
the label but behind the loaded aspx (i.e. changing password.aspx), so they
are never actually visible.

I don't know where to check, what to check in the code. I don't know why a
new set of buttons (and the label in question) are generated.
Why the changing of text property for the label doesn't occur in the first
set of buttons? (this is not even a good question)

Thank you for any advice.
Vasilica
 
Can you post the code behind one of the button_click events that's causing
this?
 
Hi!

Is it all right if I do it tomorrow? I have the application at work. I
didn't actually expect an answer so soon. However, the click event contains
only two lines: one for changing the label's text and another one to
redirect to another aspx. (I was hired three days ago, the only info I got
regarding this application was its location, and how to upload new
releases).

Thank you,

Vasilica
 
No problem
John Smith said:
Hi!

Is it all right if I do it tomorrow? I have the application at work. I
didn't actually expect an answer so soon. However, the click event contains
only two lines: one for changing the label's text and another one to
redirect to another aspx. (I was hired three days ago, the only info I got
regarding this application was its location, and how to upload new
releases).

Thank you,

Vasilica

etc.).
 
Hi John,

You are sending code, but maybe this helps you in between, an aspx page is
stateless, and therefore it starts everytime again.

If the load from a page comes it is executede everytime and therefore is the
property "IsPostBack"

You see it almost always in the load event as
\\\
If Not IsPostBack then
..........
else
.........
end

Have a look at this page, it gives a real clear view on it

http://msdn.microsoft.com/library/d...on/html/vbconwebformspageprocessingstages.asp

I hope this helps?

Cor
 
Hi Cor,
Thank you very much for the hint and for the link. I'll go through it and
try to fix the problem.
Thank you again.
 
Hi ,
This is the piece of code behind click event:

----------------------------------------------------------------------------
-----
Private Sub B_user_changepass_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles B_user_changepass.Click

'L_msg.Text = "change password"

Response.Redirect("ChangePassword.aspx")

End Sub

----------------------------------------------------------------------------
-------------------------------------------------

Nothing spectacular, I would say.

I'll read some more documentation these days (another person replied and
gave me a link), hopefully I'm getting a good solution.

Thanks a lot.
 
Back
Top