<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();
}
}
用过一次后按钮功能失效了。
http://hi.baidu.com/zdqesc007/item/545d861db490949899ce33d9
http://bbs.csdn.net/topics/340222322
这两个页面的方法都试过了,都不行。。。