protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
int id = int.Parse(Request["id"]);//在前面页中传过来的id
if (id>0)
{
ViewState.Add("id", id);
MediaCategories category = new MediaCategories(id);//根据传过来的值实例化
HyperLinkAdd.NavigateUrl += "&cid" + id;
if (category.Level == 1)
{
HyperLinkAddSubCategory.Attributes.Add("onclick", "OpenWindows(0," + id + ")");//?
HyperLinkAddCategory.Attributes.Add("onclick", "OpenWindows(0,0)");
HyperLinkAdd.Enabled = false;
LinkButtonDelete.Enabled = false;
DataGridList.DataBind();
}
else
{
HyperLinkAddCategory.Attributes.Add("onclick", "OpenWindows(0," + category.ParentID + ")");
HyperLinkAddSubCategory.Attributes.Add("onclick", "OpenWindows(0," + id + ")");
LinkButtonDelete.Attributes["onclick"] = "var checked=(H_Index.value!='');if (checked) {return confirm('你确定要删除所选择的文件吗?');}else {event.returnValue=false;alert('请先选择要删除的文件。');} ";
HyperLinkAdd.Visible = true;
LinkButtonDelete.Visible = true;
DataGridList.DataBind();
}
if (category.Level == 3)
{
HyperLinkAddSubCategory.Visible = false;
DataGridList.DataBind();
}
LinkButtonDeleteCategory.Attributes["onclick"] = "{return confirm('你确定要删除当前类别[" + category.Name + "]吗?');} ";
HyperLinkName.Text = category.Name;
HyperLinkName.Attributes.Add("onclick", "OpenWindows(" + id + ")");
}
}
那您帮忙看看吧!