当前位置:编程学习 > C#/ASP.NET >>

联动无刷(大数据,图片加载)

大神,高手在哪里?
//--------------------------------------------------------------------------------------//
//选项
<select name="ddlColor" id="ddlColor" class="shoeDetailTxt" runat="server" onchange="javascript:colorChange();"  onclick="return ddlColor_onclick()">
</select>

//---------------------------------------------------------------------------------------//
//js代码
<script>
function colorChange() {
 document.getElementById("txtQty").value = "";
        var sizeCombo = document.getElementById("ddlSize");
        var code = document.getElementById("hddCode").value;
        var colorId = document.proDetail.ddlColor.value;
        var sizeId = sizeCombo.options[sizeCombo.selectedIndex].value;
        product_detail.selectSizeChange(code, colorId, sizeId, selectSizeChange_callback);
}
function selectColorChange_callback(prdDetail) {
        var product = prdDetail.value;
        var sizeCombo = document.getElementById("ddlSize");

        if (product != null) {

            var barcode = product.barCode;
            window.location = "product_detail.aspx?barcode=" + barcode + "&code=" + product.Code;
            return; //hacked to have unique URL

            //display
            document.getElementById("pShoeTitle").innerHTML = product.Title;
            document.getElementById("pShoeDesc").innerHTML = product.Description + staticDes;
            //document.getElementById("pshoeType").innerHTML = product.Type;
            document.getElementById("divImg").innerHTML = "<img src='" + product.imageURL + "' width='440' height='480' border='0' />";
            document.getElementById("divPrice").innerHTML = "SGD$" + product.Price + "<br>";
            document.getElementById("ddlColor").value = product.colorID;
            //hidden values
            document.getElementById("hddBarcode").value = product.barCode;
            document.getElementById("hddCode").value = product.Code;
            document.getElementById("hddName").value = product.Name;
            document.getElementById("hddImg").value = product.Image;
            document.getElementById("hddPrice").value = product.Price;
            document.getElementById("hddColor").value = product.colorID;
            document.getElementById("hddSize").value = sizeCombo.options[sizeCombo.selectedIndex].value;
            document.getElementById("Label_Avaiable_Qty").value = product.Stock;


            if (product.Stock <= 0) {
                document.getElementById("divAddToBag").innerHTML = "<span class='soldOutTxt'>Sold Out</span>";
            }
            else {
                document.getElementById("divAddToBag").innerHTML = "<a href='#' onclick='javascripts:addToBag();'><img src='images/AddToBag.jpg' border='0' /></a>";
            }

            var barCode = "";
            var itemcode = "";
            var twitterStr = "";
            var facebookStr = "";

            //twitter facebook
            twitterStr = "<script src='http://platform.twitter.com/widgets.js' type='text/javascript' />";
            twitterStr += "<div>";
            twitterStr += "<a href='http://twitter.com/share' class='twitter-share-button' ";
            twitterStr += " data-url='http://www.heatwaveshoes.com/product_detail.aspx?barcode=" + barCode + "&code=" + itemcode + "'";
            twitterStr += " data-via='Heatwave' ";
            twitterStr += "  data-text='Checking out this gorgeous shoe on Heatwave' ";
            twitterStr += " data-count='horizontal'>Tweet</a> ";
            twitterStr += " </div>";
            document.getElementById("twitter").InnerHtml = twitterStr;

            facebookStr = " <iframe src='http://www.facebook.com/plugins/like.php?app_id=258268004201018&href=http%3A%2F%2Fwww.heatwaveshoes.com%2Fproduct_detail.aspx%3Fbarcode%3D" + barCode + "%26code%3D" + itemcode + "&send=false&layout=standard&width=150&show_faces=true&action=like&colorscheme=light&font&height=80'";
            facebookStr += " scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:150px; height:30px;'";
            facebookStr += " allowTransparency='true'></iframe>";
            document.getElementById("facebook").InnerHtml = facebookStr;

            //call to load related Product
            loadRelatedProduct(product.Type, product.Height, product.Feature, product.Code);
}
</scritp>

//-------------------------------------------------------------------------------//
//后台c#
[AjaxPro.AjaxMethod]
public ProductDetail selectColorChange(String code, int colorId){
             //从数据库取数据
           (实体)ProductDetail prd = new ProductDetail();
                prd.Name = name;
                prd.Title = shoetitle;
                prd.barCode = barCode;
                prd.Code = itemcode;
                prd.Price = price.ToString("F");
                prd.Type = type;
                prd.Height = height;
                prd.Feature = feature;
                //prd.Description = description + staticDesc;
                prd.Description = description;
                prd.Image = prodimgname;
                prd.imageURL = imgurl;
                prd.Stock = stock;
                prd.colorID = Convert.ToInt32(colorID);
                prd.Color = color;
                prd.Size = size;

                return prd;
} --------------------编程问答-------------------- 用AJAX挺好的,要不就用updatepanel。可以实现在后台直接调用方法,实现局部刷新,可一直刷新一个控件。用updatepanel之前还需要一个scriptmanager。上网搜一搜 --------------------编程问答--------------------
<asp:ScriptManager runat="server" id="spm" />
<asp:Updatepanel runat="server" />
--------------------编程问答-------------------- 放一堆代码,不描述下问题?
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,