Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
protected override void OnPreRender(EventArgs e)
  {
      base.OnPreRender(e); //what does this line do?
      string strDisAbleBackButton;
      strDisAbleBackButton = "<SCRIPT language="javascript">\n";
      strDisAbleBackButton += "window.history.forward(1);\n"; what this line do?
      strDisAbleBackButton += "\n</SCRIPT>";
      ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "clientScript", strDisAbleBackButton); // what does this line do?
  }
 
what this code do?
Posted 22-Jun-11 9:45am
Edited 22-Jun-11 9:52am
v4
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

In the dim, dark past all documentation was printed on paper, and very heavy it was too. The first version of Visual Studio for example, (called Visual C++ in those days) had a single CD and pile of books you could stun an ox with. Still got them, somewhere. Oh, yes, I remember, they are in the Games Room. Never mind that.
 
The thing is, in those days, we had to find the right book, read the right section, and work out what functions did for ourselves. And very hard work it was too.
 
Nowadays, there is a tool called Google that does most of the work, and a set of books called MSDN which does the rest - and all searchable too. Amazing really.
 
Then you come along. "Can I be bothered to try to learn?" you think. "Nah. I'l just post stupid little questions asking what each individual line of code fragments I've raked up from the internet do instead." So you do. But I ain't answering.
  Permalink  
Comments
SAKryukov at 22-Jun-11 15:16pm
   
I fell next time you're going to write an assay in the Google use... :-) My 5.
--SA
SAKryukov at 22-Jun-11 15:19pm
   
By the way, did you check previous "questions" from OP? I thinks there are many reports of abuse. Why should anyone answer the question about code OP did not write? It cannot teach anything anyway.
--SA
OriginalGriff at 22-Jun-11 15:21pm
   
Yes - under about three names, I think. The OP does indeed seem to be learning resistant. :)
SAKryukov at 22-Jun-11 18:30pm
   
Three names?! In attempt to keep this activity even if one or two are suspended for this spam (because this is a kind of spam) I would guess. What's the use?..
--SA
OriginalGriff at 23-Jun-11 4:04am
   
Hope springs eternal in the human breast;
Man never Is, but always To be blest:
The soul, uneasy and confin'd from home,
Rests and expatiates in a life to come.
 
-Alexander Pope, An Essay on Man
 
Or something like that, anyway. :laugh:
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

This seems to be code from an ASP.NET custom control. The first line you queried about calls the base class' OnPreRender event. This is usually done to do stuff that the base class would already handle. The other line you asked about registers the script with the ASP.net script manager so the constructed javascript stored in strDisAbleBackButton is rendered to the HTML output.
 
Cheers!
 
--MRB
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 290
1 Jochen Arndt 165
2 DamithSL 125
3 PIEBALDconsult 110
4 Garth J Lancaster 90
0 OriginalGriff 5,790
1 DamithSL 4,601
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,195


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 22 Jun 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100