VB.Net + ASP.Net --- New problem

Get help on programming - C++, Java, Delphi, etc.
Post Reply
Mechano
Registered User
Posts: 291
Joined: 26 Feb 2004, 02:00
Location: Cape Town
Contact:

VB.Net + ASP.Net --- New problem

Post by Mechano »

Ok, 99% sure that I'm doing something stupid here, but if someone can just point me in the right direction, it'll be much appreciated...I used to work with C# but now I have to do a project in VB, so I'm on a bit of a learning curve as far as syntax goes...

Here's my problem:
I have an aspx page, with 1 dropdown and 9 textboxes on it. These controls get populated with default values from a database. Then, when the user changes any of these values, and hits a save button, an UPDATE statement must change the values in the dbase. (SQL Server 2000)

No matter what I try, the orginal values gets persisted and not the new ones. I checked the SQL statement that gets generated and it does only contain the original values, not the new ones.

I think this has something to do with the PostBack or something like that...but I'm to rusty to be sure..

Any help would be appreciated....thanx
Last edited by Mechano on 28 Nov 2006, 18:05, edited 1 time in total.
SBSP
Registered User
Posts: 3124
Joined: 09 May 2006, 02:00
Location: Centurion

Post by SBSP »

I used to program in VB i might be wrong.

Is the no way to loop a "Validate" on each textbox and dropdown box.
right after the user hits the save button.
then upload to the database?
Kronos
Moderator Emeritus
Posts: 4280
Joined: 28 May 2003, 02:00
Location: Azeroth
Contact:

Post by Kronos »

I got this same problem once.

I can't remember how to fix it though. :?

I think it had something to do with the page being cached in IE.

Try to add this to the ASPX file header:

Code: Select all

<% Response.Expires = -1 %>
Image
Mechano
Registered User
Posts: 291
Joined: 26 Feb 2004, 02:00
Location: Cape Town
Contact:

Post by Mechano »

Thanx guys, but I figured it out...

In the Page_Load section, I did the following:

Code: Select all

If Not Page.IsPostBack Then
'populate fields
Else
'do nothing
End If
This ensures that the controls only gets populated when you load the page for the first time, and not every time a post back takes place...

It worked for me... :D
Kronos
Moderator Emeritus
Posts: 4280
Joined: 28 May 2003, 02:00
Location: Azeroth
Contact:

Post by Kronos »

Oh yes, that too.
Image
Mechano
Registered User
Posts: 291
Joined: 26 Feb 2004, 02:00
Location: Cape Town
Contact:

Ok, I have a new problem

Post by Mechano »

Here goes :

I use PNG's fot buttons on my page, because of they're exceptional transparency abilities. Everything seems to be working fine, but only in Mozilla and IE7. IE6 refuses to show transparency for the PNG's....

I found the following fix:
http://homepage.ntlworld.com/bobosola/pnghowto.htm

There is a problem though. The above fix applies to all the <IMG> tags in my document, and not the <asp:ImageButton> tags....Reason being that the <asp:ImageButton> tags do not support the 'style' attribute...

If anyone can help me solve this problem, I won't only be thankful, but MEGA impressed... :( :( :(
Kronos
Moderator Emeritus
Posts: 4280
Joined: 28 May 2003, 02:00
Location: Azeroth
Contact:

Post by Kronos »

Well, you can try to incorporate the style attributes set in the js example on that site into a CSS Class, and then assign that class to the "CssClass" attribute of the <asp:ImageButton>
Image
Post Reply