Click here to Skip to main content
15,906,569 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: compare Date and Time Pin
Sarfaraj Ahmed9-Feb-09 19:08
Sarfaraj Ahmed9-Feb-09 19:08 
GeneralRe: compare Date and Time Pin
N a v a n e e t h9-Feb-09 20:53
N a v a n e e t h9-Feb-09 20:53 
QuestionSession array Pin
Sandraa9-Feb-09 9:59
Sandraa9-Feb-09 9:59 
AnswerRe: Session array Pin
Ranjit Viswakumar9-Feb-09 16:12
Ranjit Viswakumar9-Feb-09 16:12 
GeneralRe: Session array Pin
Sandraa11-Feb-09 8:40
Sandraa11-Feb-09 8:40 
GeneralRe: Session array Pin
Sandraa11-Feb-09 8:49
Sandraa11-Feb-09 8:49 
Questionsenerio Pin
suni_dotnet9-Feb-09 5:48
suni_dotnet9-Feb-09 5:48 
AnswerRe: senerio Pin
Ray Wampler9-Feb-09 6:34
Ray Wampler9-Feb-09 6:34 
If I understand your question correctly then I believe that a Session variable can help you.

You page should have at least two event handlers, one for Page_Load and one for your button OnClick event. Page_Load always executes first. When the page first loads it goes through Page_Load with IsPostBack == false and When you click the button it first calls Page_Load with IsPostBack == true, then it executes your Button_Click event where you should have the code snippet that you only want to execute one time.

Let's say here's your button click event handler:

public void MyButton_OnClick(object sender, EventArgs args)
{
if (Session("MyButton_Handled") == null)
{
// Your one-time code snippet goes here

// Set the session varaible
Session("MyButton_Handled") = true;
}
}

First time through the session variable will be undefined, which should return null. After you execute the code then the variable is defined and the one-time code gets skipped.

Ray Wampler
www.RayWampler.com
GeneralRe: senerio Pin
suni_dotnet9-Feb-09 6:57
suni_dotnet9-Feb-09 6:57 
GeneralRe: senerio Pin
Ray Wampler9-Feb-09 7:21
Ray Wampler9-Feb-09 7:21 
GeneralRe: senerio Pin
Ray Wampler9-Feb-09 7:24
Ray Wampler9-Feb-09 7:24 
GeneralRe: senerio Pin
suni_dotnet9-Feb-09 7:37
suni_dotnet9-Feb-09 7:37 
Question"A validation error has occurred".... script attacks... Pin
markymark829-Feb-09 4:19
markymark829-Feb-09 4:19 
AnswerRe: "A validation error has occurred".... script attacks... Pin
led mike9-Feb-09 4:51
led mike9-Feb-09 4:51 
GeneralRe: "A validation error has occurred".... script attacks... Pin
markymark829-Feb-09 5:01
markymark829-Feb-09 5:01 
GeneralRe: "A validation error has occurred".... script attacks... Pin
Paddy Boyd9-Feb-09 5:21
Paddy Boyd9-Feb-09 5:21 
GeneralRe: "A validation error has occurred".... script attacks... Pin
markymark829-Feb-09 5:24
markymark829-Feb-09 5:24 
GeneralRe: "A validation error has occurred".... script attacks... Pin
Paddy Boyd9-Feb-09 5:27
Paddy Boyd9-Feb-09 5:27 
GeneralRe: "A validation error has occurred".... script attacks... Pin
markymark829-Feb-09 5:31
markymark829-Feb-09 5:31 
GeneralRe: "A validation error has occurred".... script attacks... Pin
markymark829-Feb-09 5:48
markymark829-Feb-09 5:48 
AnswerRe: "A validation error has occurred".... script attacks... Pin
Ranjit Viswakumar9-Feb-09 16:16
Ranjit Viswakumar9-Feb-09 16:16 
GeneralRe: "A validation error has occurred".... script attacks... Pin
markymark829-Feb-09 22:33
markymark829-Feb-09 22:33 
QuestionUser control datalist populating?? Pin
tadhg889-Feb-09 2:59
tadhg889-Feb-09 2:59 
QuestionASP.NET MVC Framework Pin
Brendan Vogt9-Feb-09 2:47
Brendan Vogt9-Feb-09 2:47 
AnswerRe: ASP.NET MVC Framework Pin
ToddHileHoffer9-Feb-09 3:32
ToddHileHoffer9-Feb-09 3:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.