Hi , I am using ListView Control to show multiple images and my requirement is when i click on any image then it should go to the correcspoding page. For this purpose i am using onItemCommand event But i am unable to create the corresponding page link so that i can use them for redirection.
kindly help me out.
aspx page
<asp:ListView ID="listViewParentService" runat="server" OnItemCommand="listViewParentService_ItemCommand">
<ItemTemplate>
<!-- PRODUCT ITEM START -->
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="product-item">
<div class="pi-img-wrapper">
<img src="images/electrician.gif" class="img-responsive" alt="man cartoon with bulb in hand and running" />
<div>
<a href="images/electrician.gif" class="btn btn-default fancybox-button">Zoom</a>
<a href="#product-pop-up" class="btn btn-default fancybox-fast-view">View</a>
</div>
</div>
<h3><a href="#"><%#Eval("CategoryName") %></a></h3>
<div class="margin-bottom-20">
<%--<a href="EhsElectricianDetails.aspx" class="btn btn-default view">View Now</a>--%>
<a>
<asp:LinkButton ID="lnkView" runat="server" Text="View Now" CommandName="LnkViewService" CommandArgument='<%#Eval("CategoryName") %>' class="btn btn-default view"></asp:LinkButton></a>
<%-- <a href="EhsUserDetails.aspx" class="btn btn-default book">Book Now</a>--%>
<a>
<asp:LinkButton ID="lnkBook" runat="server" Text="Book Now" CommandName="LnkBookService" CommandArgument='<%#Eval("CategoryName") %>' class="btn btn-default book"></asp:LinkButton></a>
</div>
</div>
</div>
<!-- PRODUCT ITEM END -->
</ItemTemplate>
</asp:ListView>
aspx.cs page
protected void listViewParentService_ItemCommand(object sender, ListViewCommandEventArgs e)
{
int id = Convert.ToInt32(e.CommandArgument);
if (e.CommandName == "LnkViewService")
{
// i dont know how to create
}
}
i have following corresponding pages on that i have to redirect on the click of image
EhsLocksmithDetails.aspx
EhsPainterDetails.aspx
EhsComputerRepairDetails.aspx
EhsPestControlDetails.aspx
kindly help me how should i create these page links in ItemCommand event so that i can use them to redirect to correspoding page of images.
If any other way instead of ListView please do tell me.
thank you