I have tried this also.
 
But clearing controls after Inserting values is not resolving the problem.
 
Because On Page refresh (F5), Values are again picked up from ViewState... And Record will again inserted.
 
Pankaj
 
 
----- Original Message -----
From: realhossam
Sent: Tuesday, July 05, 2005 3:03 PM
Subject: RE: [Microsofts_C_Sharp] Page Refresh Problem.....

I think the solution is to simply clear the controls using code in the event of the button save.
void btnSave_Click(object sender,EventArgs e)
{
InsertValues();
ClearControls();
}
I think this is like a work around for this problem.

Rob <[EMAIL PROTECTED]> wrote:

Simple, try this

 

If (!IsPostback)

{

            DoMethodsForFirstTime();

            SecondMethod();

            IntilizeComponent();

 

}

 

This is postback(Boolean) will be set to true when a page has executed for the first time and false if its been run for the first time. Hope this helps J

 


From: [email protected] [mailto:[email protected]] On Behalf Of Pankaj Tyagi
Sent: 04 July 2005 14:30
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [email protected]
Subject: [Microsofts_C_Sharp] Page Refresh Problem.....
Importance: High

 

Hi Everyone,

i have a very simple question regarding ASP .net (Using C#)

 

i have a data entry form, on save click record gets inserted in databse.

 

Now if i refresh this page usign F5 or by any other way...new record gets inserted in databse with same values,  i want to stop this

 

i also want to clear values of all controls on click of save, and if user refresh the page nothing should happen.... 

 

For this, i do not want to put validation on database end...  How can i do this....

 

Thanks in advance...

 

With Regards,
Pankaj Tyagi

VCLABS,

New Delhi, India

 

 

 

 

 

 


Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football

SPONSORED LINKS
Programming languages C programming language Computer programming languages
Java programming language C programming language History of computer programming language


YAHOO! GROUPS LINKS




Reply via email to