My Code, written by Pagebase. Or keep it, is the core of this set of CMS. Semantically, just like my cloud platform, except that the cloud platform is written in JS. This is WebForm. Next, write Mvc. The core is simple.

Source: Internet
Author: User

UsingSystem;UsingSystem.Collections.Generic;UsingSystem.IO;UsingSystem.Linq;UsingSystem.Web;UsingSystem.Web.UI;UsingSystem.Web.Ui.HtmlControls;UsingSystem.Web.Ui.WebControls;UsingJgdjweb.Helper;UsingJgdjweb.Model;NamespaceJgdjweb.Extensions {PublicAbstractClassPagebase:System.Web.Ui.Page {ProtectedPagebase () {}ProtectedvoidBindmodule (PagePageaction<Repeater,String>BINDSINGRPT) {Bindcontrols (Page"List_",BINDSINGRPT); }ProtectedvoidBindcontrols (PagePageStringPrefixaction<Repeater,String>Bindsingcontrol) {VarControllist =Page.Controls;foreach (ControlControlInchControllist) {if (Control.ID! =Null &&Control.FdaStartsWith (Prefix) &&ControlIsRepeater) {Varsuffix =Control.Id.Split (' _ ') [1];if (prefix = ="List_")Bindsingcontrol (ControlAsRepeater,suffix); }            }        }ProtectedvoidBind (StringClassName,HtmlAnchorAnchorRepeaterRepeaterIntCount) {try {using (VarContext =NewJgdjentities ()) {VarClassno =Context.Jy_news_classs.Where (n =N.Classcname = =ClassName).First ().Classno;VarNEWSS =Common.Getnewslistbycno (Encrypt.Md5encrypt (Classno));if (Anchor! =NULL) {Anchor.HRef ="/list.aspx?" Classno= "+Encrypt.Md5encrypt (CLASSNO); }Repeater.DataSource =Newss.Take (count);Repeater.DataBind (); }            }catch (Exceptione) {}}#region Website VisitsProtectedvoidPageviews () {IntCount = 0;Data accumulationIntStat = 0;StreamReaderSrdGet the actual path to the fileStringFile_path =Server.MapPath ("/xml/counter.txt");Open a file for readingSRD =File.OpenText (File_path);while (Srd.Peek ()! =-1) {Stringstr =Srd.ReadLine ();Count =Int.Parse (STR); }Srd.Close ();Code to run when a new session is startedApplication.Lock ();Gets the total number of site visits saved in the Application objectStat =CountStat + = 1;Objectobj =Stat;application["Counter"] =ObjWriting data records to a fileStreamWriterSRW =new streamwriter (file_path, false);             srw. WriteLine (srw. Close ();             application. unlock ();         }< Span style= "color: #1212f8;" >         #endregion     }}    

My Code, written by Pagebase. Or keep it, is the core of this set of CMS. Semantically, just like my cloud platform, except that the cloud platform is written in JS. This is WebForm. Next, write Mvc. The core is simple.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.