使用Jquery在表中上载图像功能
嗨,我有一张像网格一样的桌子。每行包含productID,后面是4列,分别为图像1、图像2、图像3和图像4。我对显示的数据非常满意,但现在对我的要求是,在每个图像上我有两个链接,一个是编辑,另一个是删除。如果图像已上载,则编辑现有图像,否则上载新图像。第二个选项是删除图像。现在,我将如何找到用户单击哪个行和哪个列来上载或删除图像?请帮我解决这个问题,我知道这可以用Jquery完成,但我找不到任何帮助来完成这件事 我的看法是:使用Jquery在表中上载图像功能,jquery,asp.net,asp.net-mvc,asp.net-mvc-3,c#-4.0,Jquery,Asp.net,Asp.net Mvc,Asp.net Mvc 3,C# 4.0,嗨,我有一张像网格一样的桌子。每行包含productID,后面是4列,分别为图像1、图像2、图像3和图像4。我对显示的数据非常满意,但现在对我的要求是,在每个图像上我有两个链接,一个是编辑,另一个是删除。如果图像已上载,则编辑现有图像,否则上载新图像。第二个选项是删除图像。现在,我将如何找到用户单击哪个行和哪个列来上载或删除图像?请帮我解决这个问题,我知道这可以用Jquery完成,但我找不到任何帮助来完成这件事 我的看法是: <table id="listProduct">
<table id="listProduct">
<tr>
<th>
@*@Html.DisplayNameFor(model => model.)*@
Product ID
</th>
<th>Category / Sub Category
</th>
<th>Image 1
</th>
<th>Image 2
</th>
<th>Image 3
</th>
<th>Image 4
</th>
<th>Product Status
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@*@Html.ActionLink(@item.ProductId, "FreezeProdView", "SellerLogin")*@
@Html.DisplayFor(modelItem => item.ProductId)
</td>
<td>
@Html.DisplayFor(modelItem => item.Category) / @Html.DisplayFor(modelItem => item.Subcategory)
</td>
<td width="20%" valign="top">
<img src ="@System.Configuration.ConfigurationManager.AppSettings["ShoppingBag"].ToString()@item.Image1" id = "Img1_"@item.ProductId alt="" style="width:90px;height:115px;" />
</td>
<td width="20%" valign="top">
<img src ="@System.Configuration.ConfigurationManager.AppSettings["ShoppingBag"].ToString()@item.Image2" id ="Img2_"@item.ProductIdalt="" style="width:90px;height:115px;" />
</td>
<td width="20%" valign="top">
<img src ="@System.Configuration.ConfigurationManager.AppSettings["ShoppingBag"].ToString()@item.Image3" id ="Img3_"@item.ProductId alt="" style="width:90px;height:115px;" />
</td>
<td width="20%" valign="top">
<img src ="@System.Configuration.ConfigurationManager.AppSettings["ShoppingBag"].ToString()@item.Image4" id ="Img4_"@item.ProductId alt="" style="width:90px;height:115px;" />
</td>
<td>
@Html.DisplayFor(modelItem => item.ProductStatusCd)
</td>
@* <td>
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
</td>*@
</tr>
}
</table>
<table id="listProduct">
<tr>
<th>
@*@Html.DisplayNameFor(model => model.)*@
Product ID
</th>
<th>Category / Sub Category
</th>
<th>Image 1
</th>
<th>Image 2
</th>
<th>Image 3
</th>
<th>Image 4
</th>
<th>Product Status
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@*@Html.ActionLink(@item.ProductId, "FreezeProdView", "SellerLogin")*@
@Html.DisplayFor(modelItem => item.ProductId)
</td>
<td>
@Html.DisplayFor(modelItem => item.Category) / @Html.DisplayFor(modelItem => item.Subcategory)
</td>
<td width="20%" valign="top">
<img src ="@System.Configuration.ConfigurationManager.AppSettings["ShoppingBag"].ToString()@item.Image1" id = "Img1_"@item.ProductId alt="" style="width:90px;height:115px;" />
</td>
<td width="20%" valign="top">
<img src ="@System.Configuration.ConfigurationManager.AppSettings["ShoppingBag"].ToString()@item.Image2" id ="Img2_"@item.ProductIdalt="" style="width:90px;height:115px;" />
</td>
<td width="20%" valign="top">
<img src ="@System.Configuration.ConfigurationManager.AppSettings["ShoppingBag"].ToString()@item.Image3" id ="Img3_"@item.ProductId alt="" style="width:90px;height:115px;" />
</td>
<td width="20%" valign="top">
<img src ="@System.Configuration.ConfigurationManager.AppSettings["ShoppingBag"].ToString()@item.Image4" id ="Img4_"@item.ProductId alt="" style="width:90px;height:115px;" />
</td>
<td>
@Html.DisplayFor(modelItem => item.ProductStatusCd)
</td>
@* <td>
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
</td>*@
</tr>
}
</table>
请向我确认:您想知道用户是否单击了按钮?因此,您可以使用事件OnButtonClick@RageCompex我有2个超链接下面的每个图像一个是上传,另一个是删除。现在我想在我的控制器中单击行的产品Id、ImageId和文件,我该怎么做
public string uploadProductImage(HttpPostedFileBase file, int productId,int imageId)
{
}