watchdetail.aspx.cs

来自「简单手表销售管理(三层开发)源码」· CS 代码 · 共 61 行

CS
61
字号
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;
//该源码下载自www.51aspx.com(51aspx.com)

public partial class Default3 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
 
    protected void dvWatch_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        string smallpicture = Guid.NewGuid().ToString();

        odsWatch.InsertParameters.Add("smallpicture", smallpicture);

        FileUpload fullWatch = dvWatch.FindControl("fullWatch") as FileUpload;


        if (fullWatch.HasFile)
        {

            string filePath = Server.MapPath(Request.ApplicationPath) + @"\Images\Watch\" + smallpicture + ".gif";

            fullWatch.SaveAs(filePath);
        }
    }
    protected void dvWatch_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
    {
        
        FileUpload fullWatch = dvWatch.FindControl("fullWatch") as FileUpload;

        if (fullWatch.HasFile)
        {
            Image ImgWatch = dvWatch.FindControl("ImgWatch") as Image;
            string filePath = Server.MapPath(ImgWatch.ImageUrl);

            fullWatch.SaveAs(filePath);
            
        }

        //TextBox texbox = dvWatch.FindControl("txtOldPrice") as TextBox;
        //TextBox texbox = dvWatch.FindControl("txtNewPrice") as TextBox;
        //TextBox texbox = dvWatch.FindControl("txtProductName") as TextBox;
        //FileUpload fullWatch = dvWatch.FindControl("fullWatch") as FileUpload;


      

    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?