首页 新闻 会员 周边 捐助

关于多个UpdatePanel,其中一个UpdatePanel里的Button更新另一个UpdatePanel里面的数据功能失效问题

0
悬赏园豆:10 [已关闭问题] 关闭于 2015-02-26 15:29

    <asp:ScriptManager ID="sm" runat="server">
    </asp:ScriptManager>

 

<asp:UpdatePanel ID="upLoadImgs" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <ul class="ul_LR">
                                <li class="li_l">商品图片:</li>
                                <li class="li_r">
                                    <div class="UpImg">
                                        <div class="Imglist">
                                            <ul>
                                                <li id="li" runat="server" class="ZT_set">
                                                    <div class="item">
                                                        <div class="zt_bz">
                                                        </div>
                                                        <div class="pic">
                                                            <img src="<%=this.MainImgUrl%>" alt="主图" /></div>
                                                    </div>
                                                </li>
                                                <asp:Repeater ID="rptProImgList" runat="server" OnItemDataBound="rptProImgList_ItemDataBound">
                                                    <ItemTemplate>
                                                        <li id="li" runat="server">
                                                            <div class="item">
                                                                <div class="zt_bz">
                                                                </div>
                                                                <div class="pic">
                                                                    <img id="imgProImg" src='<%#Eval("ProductImg") %>' alt='<%#Eval("ProductName") %>'
                                                                        runat="server" /></div>
                                                                <div class="set_pic">
                                                                    <a id="aSetMainImg" style="cursor: pointer;" title="将此图片放在第一个位置" runat="server">设置为主图</a></div>
                                                            </div>
                                                        </li>
                                                    </ItemTemplate>
                                                </asp:Repeater>
                                            </ul>
                                        </div>
                                        <div id="divUpload" class="UpPic_but">
                                            <span>选择本地图片:</span><a id="aUpload" href="#" style="cursor: pointer;">选择图片</a><input
                                                id="hidSaleUserID" type="hidden" />
                                        </div>
                                        <div class="UpPic_ts">
                                            <div class="left">
                                                提示:</div>
                                            <div class="right">
                                                <p>
                                                    1、本地上传图片大小不能超过 <font>500K</font>。</p>
                                                <p>
                                                    2、本类目下您最多可以上传 <font>5</font>张图片。</p>
                                            </div>
                                        </div>
                                    </div>
                                </li>
                            </ul>
                        </ContentTemplate>
                    </asp:UpdatePanel>

 

 <asp:UpdatePanel ID="upSetMainImg" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <asp:HiddenField ID="hidProImg" runat="server" />
                            <asp:Button ID="btnSetMainImg" runat="server" OnClick="btnSetMainImg_Click" Style="display: none;" />
                        </ContentTemplate>
                    </asp:UpdatePanel>

 

        /// <summary>
        /// 设置商品主图片
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSetMainImg_Click(object sender, EventArgs e)
        {
            using (TransactionScope ts = new TransactionScope())
            {
                try
                {
                    imgs.ImageID = int.Parse(HSSM_Public_DB.OneFileds("ImageID", "Images", string.Format("ImageUrl='{0}'",hidProImg.Value)).ToString());
                    imgs.IsMainImage = true;
                    int IsSuccess = HSSM_Public_DB.AlterTable<Model.Images>(imgs);

                    if (IsSuccess > 0)
                    {
                        bool b = HSSM_Public_DB.UpdateProImgMain(IndexTop.UserID, imgs.ImageID);
                        if (b)
                        {
                            BindProImgs();
                            upLoadImgs.Update();

                            ts.Complete();
                            return;
                        }
                    }
                }
                catch (Exception)
                {
                }

                ts.Dispose();
            }
        }

 

用过一次后按钮功能失效了。

以便以谢的主页 以便以谢 | 初学一级 | 园豆:119
提问于:2014-03-21 10:02
< >
分享
所有回答(1)
0

http://hi.baidu.com/zdqesc007/item/545d861db490949899ce33d9

http://bbs.csdn.net/topics/340222322

这两个页面的方法都试过了,都不行。。。

以便以谢 | 园豆:119 (初学一级) | 2014-03-21 10:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册