コード例 #1
0
ファイル: ImagesList.aspx.cs プロジェクト: Milkyway94/vexe
 protected void gvData_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.DataItemIndex >= 0)
     {
         e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor = \'lightblue\';");
         e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor = \'#F7F7F7\';");
         //=======================================================
         DataRowView drv     = (DataRowView)e.Row.DataItem;
         int         p       = Convert.ToInt32(drv["Content_ID"]);
         HyperLink   hplName = (HyperLink)e.Row.FindControl("hplName");
         hplName.Text = ConvertUtil.CutString(drv["File_Name"].ToString(), 70) + "&nbsp;<font color='#777777' style='font-style:italic; font-size:10px;'>(" + DateTimeUtil.DateFormat("{0}/{1}/{2}", Convert.ToDateTime(drv["File_Date"])) + ")</font>";
         //==================================================
         Image  imgEdit = (Image)e.Row.FindControl("imgEdit");
         string url     = "PopupWin.aspx?page=File&act=edit&p=" + p + "&id=" + drv["File_ID"];
         imgEdit.Attributes.Add("onclick", "javascript:PopupWin('" + url + "',500,180)");
         //==================================================
         Image imgDisplay = (Image)e.Row.FindControl("imgDisplay");
         if (drv["File_Small"].ToString().Trim().Length > 0)
         {
             imgDisplay.ImageUrl = "~/" + drv["File_Small"].ToString();
         }
         //==================================================
         TextBox txtOrder = (TextBox)e.Row.FindControl("txtOrder01");
         txtOrder.Text = drv["File_Pos"].ToString();
         //============================================
         bool        isUse  = Convert.ToBoolean(drv["File_Status"]);
         ImageButton imgUse = (ImageButton)e.Row.FindControl("imgUse");
         imgUse.ImageUrl = (isUse == true) ? tp + "yes.gif" : tp + "no.gif";
         //============================================
         ImageButton imgDel = (ImageButton)e.Row.FindControl("imgDel");
         imgDel.Attributes.Add("onclick", "javascript:return confirm('Bạn có chắc chắn xoá tin này không ?');");
     }
 }
コード例 #2
0
    protected void gvData_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.DataItemIndex >= 0)
        {
            e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor = \'lightblue\';");
            e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor = \'#F7F7F7\';");
            //=======================================================
            DataRowView drv     = (DataRowView)e.Row.DataItem;
            int         p       = Convert.ToInt32(drv["Mod_ID"]);
            HyperLink   hplName = (HyperLink)e.Row.FindControl("hplName");
            hplName.Text = ConvertUtil.CutString(drv["Content_Name"].ToString(), 60);
            //==================================================
            HyperLink hplView = (HyperLink)e.Row.FindControl("hplView");
            hplView.Text = drv["Content_Count"].ToString();
            //==================================================
            Image  imgEdit = (Image)e.Row.FindControl("imgEdit");
            string url     = "PopupWin.aspx?page=" + FunctionDB.GetModType(p) + "&act=edit&TopicID=" + p + "&id=" + drv["Content_ID"];
            switch (FunctionDB.GetModType(p))
            {
            case "Enterprise":
            case "About":
            case "Service":
            case "Concept":
            case "News":
                imgEdit.Attributes.Add("onclick", "javascript:window.location.href='" + url + "'");
                break;

            case "Gallery":
                imgEdit.Attributes.Add("onclick", "javascript:PopupWin('" + url + "',600,250)");
                break;
            }
            //==================================================
            //Image imgDisplay = (Image)e.Row.FindControl("imgDisplay");
            //imgDisplay.ImageUrl = (drv["Content_Avata"].ToString().Trim().Length > 0) ? tp + "yes.gif" : tp + "null.gif";
            TextBox txtOrder = (TextBox)e.Row.FindControl("txtOrder01");
            txtOrder.Text = drv["Content_Pos"].ToString();
            //============================================
            bool        isUse  = Convert.ToBoolean(drv["Content_Status"]);
            ImageButton imgUse = (ImageButton)e.Row.FindControl("imgUse");
            imgUse.ImageUrl = (isUse == true) ? tp + "yes.gif" : tp + "no.gif";
            //============================================
            bool        isHot  = Convert.ToBoolean(drv["Content_Hot"]);
            ImageButton imgHot = (ImageButton)e.Row.FindControl("imgHot");
            imgHot.ImageUrl = (isHot == true) ? tp + "yes.gif" : tp + "no.gif";
            //==================================================
            Image             imgAddPic = (Image)e.Row.FindControl("imgAddPic");
            string            sql       = "SELECT Content_ID FROM tbl_File WHERE Content_ID=" + drv["Content_ID"];
            DataSet           ds        = UpdateData.UpdateBySql(sql);
            DataRowCollection rows      = ds.Tables[0].Rows;
            //imgAddPic.ImageUrl = (rows.Count > 0) ? tp + "chat.gif" : tp + "chatoff.gif";
            //imgAddPic.Attributes.Add("onclick", "javascript:LoadFile('" + drv["Content_ID"] + "')");
            //============================================
            ImageButton imgDel = (ImageButton)e.Row.FindControl("imgDel");
            imgDel.Attributes.Add("onclick", "javascript:return confirm('Bạn có chắc chắn xoá tin này không ?');");
        }
    }
コード例 #3
0
ファイル: ListModtype.ascx.cs プロジェクト: Milkyway94/vexe
 protected void dgrModtype_ItemDataBound(object sender, DataGridItemEventArgs e)
 {
     if (e.Item.ItemIndex >= 0)
     {
         e.Item.Attributes.Add("OnMouseOver", "this.style.backgroundColor = \'lightblue\';");
         e.Item.Attributes.Add("OnMouseOut", "this.style.backgroundColor = \'#F7F7F7\';");
         e.Item.Style.Add("Cursor", "Pointer");
         DataRowView drv = (DataRowView)e.Item.DataItem;
         string      url = "PopupWin.aspx?page=Modtype&act=edit&id=" + drv["Modtype_ID"] + "&TopicID=" + Modtype_Parent;
         //==================================================================
         HyperLink hplName = (HyperLink)e.Item.FindControl("hplName");
         hplName.Text = ConvertUtil.CutString(drv["Modtype_Name"].ToString(), 70);
         //==================================================================
         Image imgEdit = (Image)e.Item.FindControl("imgEdit");
         imgEdit.Attributes.Add("onclick", "javascript:PopupWin('" + url + "',360, 170)");
         //==================================================================
         bool        isUse    = Convert.ToBoolean(drv["Modtype_Status"]);
         ImageButton imgIsUse = (ImageButton)e.Item.FindControl("imgIsUse");
         imgIsUse.ImageUrl = (isUse == true) ? tp + "icons/button_yes.gif" : "../../../Images/notChecked.gif";
         LinkButton lbtDel = (LinkButton)e.Item.FindControl("lbtDel");
         lbtDel.Text = "<img src='../../Images/icon_delete.gif' border=0>";
         lbtDel.Attributes.Add("onclick", "javascript:return confirm('Bạn có chắc chắn xoá tin này không ?');");
     }
 }