2012/04/19

2012/04/17

Gridview 跨欄置中


GridViewRow head = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);

TableCell header = new TableCell();
header.Text = "最新10筆";
header.HorizontalAlign = HorizontalAlign.Center;
header.ColumnSpan = 3;
header.BorderWidth = 0;
header.Font.Bold = true;
header.BackColor = System.Drawing.Color.Aqua;
head.Cells.Add(header);
GridViewTop10.Controls[0].Controls.AddAt(0, head);

必須要使用程式控制才行 = = 控件用選的沒得選


2012/04/10

2012/04/05

Visual Studio .config 加解密


http://msdn.microsoft.com/zh-tw/library/ms254494.aspx
http://www.dotblogs.com.tw/yc421206/archive/2009/04/15/8010.aspx

WinForm:

    // Takes the executable file name without the
    // .config extension.
    try
    {
        // Open the configuration file and retrieve
        // the connectionStrings section.
        Configuration config = ConfigurationManager.
            OpenExeConfiguration(ConfigurationUserLevel.None);

        ConnectionStringsSection section =
            config.GetSection("connectionStrings")
            as ConnectionStringsSection;

        if (section.SectionInformation.IsProtected)
        {
            // Remove encryption.
            section.SectionInformation.UnprotectSection();
        }
        else
        {
            // Encrypt the section.
            section.SectionInformation.ProtectSection(
                "DataProtectionConfigurationProvider");
        }
        // Save the current configuration.
        config.Save();
        MessageBox.Show(String.Format("Protected={0}",
section.SectionInformation.IsProtected));
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }



WebConfig:

    // Open the Web.config file.
    Configuration config = WebConfigurationManager.
        OpenWebConfiguration("~");

    // Get the connectionStrings section.
    ConnectionStringsSection section =
        config.GetSection("connectionStrings")
        as ConnectionStringsSection;

    // Toggle encryption.
    if (section.SectionInformation.IsProtected)
    {
        section.SectionInformation.UnprotectSection();
    }
    else
    {
        section.SectionInformation.ProtectSection(
            "DataProtectionConfigurationProvider");
    }

    // Save changes to the Web.config file.
    config.Save();    // Open the Web.config file.
    Configuration config = WebConfigurationManager.
        OpenWebConfiguration("~");

    // Get the connectionStrings section.
    ConnectionStringsSection section =
        config.GetSection("connectionStrings")
        as ConnectionStringsSection;

    // Toggle encryption.
    if (section.SectionInformation.IsProtected)
    {
        section.SectionInformation.UnprotectSection();
    }
    else
    {
        section.SectionInformation.ProtectSection(
            "DataProtectionConfigurationProvider");
    }

    // Save changes to the Web.config file.
    config.Save();

--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 111.248.107.123

2012/04/03

Web.Config vs Bin

要放在同一層才有用 0rz

把web.config 放在wwwroot/web下面  可是bin放在wwwroot下面這樣會讀不到....

搞半天讀不到FCKeditor的問題竟然是這種蠢包

--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 61.224.48.4