Exemple #1
0
    protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
    {
        Label lb_newsid  = e.Item.FindControl("lb_newid") as Label;
        Label lb_tutorid = e.Item.FindControl("lb_tutorid") as Label;

        Boolean b;

        switch (e.CommandName)
        {
        case "pass":
            //sponse.Redirect(url);
            b = PassNews(lb_newsid.Text);
            if (!b)
            {
                Response.Write(Util.ShowMessage("修改失败!"));
            }
            break;

        case "send":
            b = SendMessege(lb_tutorid.Text, uid);
            if (!b)
            {
                Response.Write(Util.ShowMessage("发送消息失败!"));
            }
            else
            {
                Response.Write(Util.ShowMessage("发送消息成功!"));
            }
            break;

        case "top":
            b = ne.ChangeTopStateNews(lb_newsid.Text, 1);
            if (!b)
            {
                Response.Write(Util.ShowMessage("修改失败!"));
            }
            break;

        case "delete":
            b = ne.ChangeTopStateNews(lb_newsid.Text, 0);
            if (!b)
            {
                Response.Write(Util.ShowMessage("修改失败!"));
            }
            break;
        }
        try
        {
            BindPGSourse(type);

            //int now = int.Parse(nowpagenum.InnerText);
            BindDataList(int.Parse(nowpagenum.InnerText) - 1);
            BindPageIndex(type);
        }
        catch
        {
            BindDataList(0);
        }
    }