Click here to Skip to main content
13,047,567 members (60,487 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 8:45am
Updated 22-Jun-11 8:52am
Rate this: bad
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.
SAKryukov 22-Jun-11 15:16pm
I fell next time you're going to write an assay in the Google use... :-) My 5.
SAKryukov 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.
OriginalGriff 22-Jun-11 15:21pm
Yes - under about three names, I think. The OP does indeed seem to be learning resistant. :)
SAKryukov 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?..
OriginalGriff 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
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 script manager so the constructed javascript stored in strDisAbleBackButton is rendered to the HTML output.



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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 22 Jun 2011
Copyright © CodeProject, 1999-2017
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