Asp.net 2.0 modify master page, Thema

Source: Internet
Author: User
Don't talk about it. paste the Code directly. After studying it for a long time, I finally got it through. Some small channels will be cheated if I don't pay attention to it.
Haha. Using system;
Using system. Data;
Using system. configuration;
Using system. collections;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. webcontrols. webparts;
Using system. Web. UI. htmlcontrols;

/** // <Summary>
/// Summary description for blogpage
/// </Summary>
Public partial class blogpage: system. Web. UI. Page
{
Private string m_strmasterpagefile;
Protected void page_preinit (Object sender, eventargs E)
{
If (! Ispostback)
{
Setpage ();
}
}
Set the display content # Set the display content of Region
/** // <Summary>
/// Set the display content
/// </Summary>
Private void setpage ()
{
Try
{
This. masterpagefile = m_strmasterpagefile;
}
Catch
{
}
}

Public override string stylesheettheme
{
Get
{
Try
{
If (page. theme = NULL)
{
String blogname = request. querystring ["blogname"];
If (blogname! = NULL & blogname! = "")
{
Dataset DS = userinfo. queryblog (blogname );
Page. theme = Ds. Tables [0]. Rows [0] ["themaname"]. tostring ();
Session ["blogid"] = Ds. Tables [0]. Rows [0] ["userid"]. tostring ();
M_strmasterpagefile = This. masterpagefile = "~ /Blog/"+ Ds. Tables [0]. Rows [0] [" layoutname "]. tostring () +" masterpage. Master ";
Arraylist ary;
If (session ["visitlist"] = NULL)
{
Ary = new arraylist ();
}
Else
Ary = (arraylist) session ["visitlist"];
If (! Ary. Contains (INT) ds. Tables [0]. Rows [0] ["userid"])
{// If you have not accessed
Ary. Add (INT) ds. Tables [0]. Rows [0] ["userid"]);
Session ["visitlist"] = ary;
Userinfo. addblogvisit (INT) ds. Tables [0]. Rows [0] ["userid"]);
}
DS. Dispose ();
DS = NULL;
}
}
}
Catch
{
Page. theme = "default ";
This. Page. masterpagefile = "~ /Blog/defamastermasterpage. Master ";
}
Return page. theme;
}
}
# Endregion
}

Www.gofordesign.com

Related Article

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.