Repeater里button事件获取图片Id请来看下
<div id='<%# Eval("Pro_Id") %>' class="divDetails" ondblclick="this.style.display='none'" >
<div class="dl_left">
<img src='<%# Eval("Pro_Image") %>' alt="" />
</div>
<div class="dl_right" >
<div class="dl_title">
菜品:<%# Eval("Pro_Name") %></div>
<div class="dl_author">
菜系:<%# Eval("Pro_Type")%></div>
<div class="dl_editorcomment">
介绍:<%# Eval("Pro_Detail")%></div>
<div class="dl_unitprice">
价格:<%# Eval("Pro_Price","{0:f2}")%></div>
<div>
<asp:Button ID="btnCai" runat="server" Text="点菜" CommandName="OK"></asp:Button>
</div>
<div>
<asp:Button ID="Button2" runat="server" Text="取消" CommandName="NO"></asp:Button>
</div>
-----------------------
这个按钮的事情要怎么写呢????
------解决方案--------------------这种也行,其实是一样
DataBinder.Eval(e.Item.DataItem, "columnName");
返回的是个Object,但是你可以转换成你字段相对应的类型就行了了!
------解决方案--------------------C# code
protected void rp_list_ItemDataBound(Object sender, RepeaterItemEventArgs e)
{
Button btn = e.Item.FindControl("btnid") as Button;
btn.Click+=new EventHandler(btn_Click);
}