473,378 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

How to Handle Refresh Problem (Viewstate)

I have a problem with Refresh button when user add a new record.

Sample Code:

Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
lblMesaage.Text = "First Name : " + txtFName.Text + " ,Lat Name : "
+ txtLName.Text
txtFName.Text = Nothing
txtLName.Text = Nothing
End Sub

Explanation:

I am using the same form (Multiple Submission) to add values into the
database. The above code which I had paste is similar to my Problem.

When user Enter his/her first name and Last Name in the specified fileds and
Clicks the add button. This values are added to database(here i am showing on
Label Text ). This text filed values are stored in viewstate too(I need to
maintain viewstate for validations).After adding the values to Database, I am
Clearing the values from the text boxes and postback to the same page.

When user Clicks on Add button agian, its working normal. But when user
Press on Refresh button, the same record which was inserted last time is
inserting again even i cleared the textboxes values.

I want to Clear the values in the view state once I inserted into database
or is there any methods to handle the Refresh Button?

Please Help me...... I hope I am Clear to You.....
Jul 21 '05 #1
0 1785

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: R.Wieser | last post by:
Hello All, I'm trying to get a "Virtual Listbox" to work. I've currently got a form, and used CreateWindowExA to create a ListBox with the LBS_OWNERDRAWFIXED and LBS_NODATA flags on it. I've...
0
by: VIJAY KUMAR | last post by:
I have a problem with Refresh button when user add a new record. Sample Code: Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click...
10
by: tasmisr | last post by:
This is an old problem,, but I never had it so bad like this before,, the events are refiring when clicking the Browser refresh button. In the Submit button in my webform, I capture the server side...
4
by: john | last post by:
From my code behind file, I can put a line like this in order to make the page automatically refresh every minute: Response.AppendHeader("Refresh", 60); But the viewstate of the controls is...
5
by: Jim Bayers | last post by:
I have a simple page, all that's on it is a datagrid. The datagrid is populated on page_load when it is bound to a datareader. The problem is: when a user refreshes the page, new records are...
2
by: Prodip Saha | last post by:
I am sure there is an easy fix for this problem. I am reloading the same page at an interval using the meta refresh tag in aspx page. This page has one textbox and one button. The problem is -when...
9
by: PK9 | last post by:
I'm having an issue with the "Refresh" of an asp.net page. The refresh is actually calling my last onClick event. I thought that asp.net was supposed to be stateless in that it shouldn't...
1
by: batista | last post by:
Hello, I have a web page, which is being refresh after every 30 secs.Now, there is also a datagrid in it, which i bind in the pageload event. Now the problem is when the page is refresh after...
2
by: qwedster | last post by:
Folks! The following is a "Hello World" kind of code for ViewState. I just want to know how to retain the ViewState 1) while Page Refresh when using UpdatePanel and also 2) While I reverting back...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.