我有一个显示产品列表的Products
页面。当我点击Details
按钮时,我想在bootstrap模式弹出窗口中显示产品详细信息。
我想获得其中一个产品详细信息,但此代码可获取所有产品详细信息。
我该如何修复此查询:
.aspx代码:
<asp:Repeater ID="rpProducts" runat="server">
<ItemTemplate>
<td> <div class="btn-ud" ><a href="<%#Eval("ProductID") %>" data-toggle="modal" data-target="#myModal2" class="btn btn-custom-3 btn-sm"/ >Details</a> </div> </td>
</ItemTemplate>
</asp:Repeater>
模态弹出式代码:
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
<asp:Repeater ID="rpProductDetails" runat="server">
<ItemTemplate>
<tbody>
<td height="100px"> <%#Eval("ProductDetails")%> </td>
<td height="100px"> <%#Eval("ProductDetails")%> </td>
</tbody>
</ItemTemplate>
</asp:Repeater>
</div>
c#code:
DataTable dtProductsDetails = system.GetDataTable("Select ProductDetails,TechDetails,Standards, ApplicationArea from TBLPRODUCTS where ProductID = ProductID");
if (dtProductsDetails.Rows.Count > 0)
{
rpProductDetails.DataSource = dtProductsDetails;
rpProductDetails.DataBind();
}
答案 0 :(得分:0)
你必须使用jQuery:
$("a").click(function(){
$("#myModal2").modal("show");
});
答案 1 :(得分:0)
<script type="text/javascript">
function openModal() {
$('#myModal').modal('show');
}
</script>
在您的c#代码中添加链接按钮的事件,如
protected void lbEdit_Click(object sender, EventArgs e) {
ScriptManager.RegisterStartupScript(this,this.GetType(),"Pop","openModal();", true);
}