Asp.net源码专业站
预留广告位
首页->新知实践->Ajax实现拖动购物车源码>>DropShoping.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Ajax实现拖动购物车源码
当前文件:文件类型 AjaxDropShoping/DropShoping.aspx.cs[2K,2009-6-12 11:31:36]打开代码结构图
高亮显示
		            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 System.Configuration;
using System.Data.SqlClient;
//该源码下载自www.51aspx.com(51aspx.com)

public partial class DropShoping : System.Web.UI.Page,ICallbackEventHandler
{
    string result;
    protected void Page_Load(object sender, EventArgs e)
    {
        
        if (!Page.IsPostBack)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ToString());
            SqlDataAdapter sda = new SqlDataAdapter("select ProductName,ProductId,ProductPrice,ProductPicture from ProductMsg", con);
            DataSet ds = new DataSet();
            sda.Fill(ds, "Product");
            this.GridView1.DataSource = ds.Tables["Product"];
            this.GridView1.DataBind();
                 
        }
    }



    public string GetCallbackResult()
    {
        string res = null;
        System.Threading.Thread.Sleep(1000);
        int id = int.Parse(result);
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ToString());
        con.Open();
        SqlCommand cmd = new SqlCommand();
        cmd.Connection = con;
        //cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "select ProductName,ProductPrice,ProductDesgin,ProductPicture from ProductMsg where ProductId=@id";
        cmd.Parameters.Add("@id", SqlDbType.Int);
        cmd.Parameters["@id"].Value =id;
        SqlDataReader sdr = cmd.ExecuteReader();
        try
        {
            while (sdr.Read())
            {
                if (sdr.GetString(2).Length <= 80)
                {
                    res += sdr.GetString(0) + "|" + sdr.GetDecimal(1).ToString() + "|" + sdr.GetString(2) + "|" + "picture/" + sdr.GetString(3).Trim();
                }
                else
                {
                    string desgin =null;
                    desgin = sdr.GetString(2).Substring(0, 80) + "....";
                    res += sdr.GetString(0) + "|" + sdr.GetDecimal(1).ToString() + "|" + desgin + "|" + "picture/" + sdr.GetString(3).Trim();
                }
            }
            sdr.Dispose();
            con.Close();
            return res;
        }
        catch (Exception e)
        {
            Response.Write(e.Message);
            con.Close();
            return "0";
        }
        

    }

    public void RaiseCallbackEvent(string eventArgument)
    {
        result = eventArgument;
    }


}


        
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:Ajax实现拖动购物车源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146