MarkItUp.SingleUserBlog.Web/Administration/ManageCategories.aspx.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

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;
using MarkItUp.SingleUserBlog.Services;
using MarkItUp.SingleUserBlog.Web;
using MarkItUp.SingleUserBlog.UI;

public partial class ManageCategories : System.Web.UI.Page {

    protected override void OnInit(EventArgs e) {
        base.OnInit(e);

        if (!IsPostBack) {
            BindLists();
            BindData();
        }
    }

    void BindLists() {
        LoadDropdown(this.ddCategoryType, new CategoryType());

        this.ddCategoryParent.DataTextField = "Name";
        this.ddCategoryParent.DataValueField = "RawId";
        this.ddCategoryParent.DataSource = CategoryHelper.CategoryData;
        this.ddCategoryParent.DataBind();

        this.ddCategoryParent.Items.Insert(0, new ListItem("Select a parent category", "0"));
    }

    private void BindData() {
        grdCategories.DataSource = CategoryHelper.HierarchicalData;
        grdCategories.DataBind();
    }

    protected void grdCategories_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            LinkButton deleteButton = e.Row.Cells[1].Controls[0] as LinkButton;
            if (deleteButton != null)
            {
                deleteButton.Attributes["onclick"] = "javascript:return(confirm('Are you sure that you want to delete this category?'));";
                deleteButton.CommandName = "Delete";
                deleteButton.CommandArgument = e.Row.RowIndex.ToString();
            }

            LinkButton editButton = e.Row.Cells[2].Controls[0] as LinkButton;
            if (editButton != null)
            {
                editButton.CommandName = "Edit";
                editButton.CommandArgument = e.Row.RowIndex.ToString();
            }
        }
后面还有 112 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。