Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am have a photo album(not gallery) which previews the photos withing it. The albums are dynamically generated depending on number of albums associated with the user. I want to add on click event to it so that when a person clicks an album it takes him to the photos within that album. I am beginner so I do not exactly know how it can be done. But I think adding command arguments should do the trick.

ASPX CODE:

ASP.NET
for (int i = 0; i < dt5.Rows.Count; i++)
{
    string q = "select  imageurl from photos where albumid='" 
                                        + dt5.Rows[i]["albumid"].ToString() + "'";
    dt6 = dbo.Getdt(q);
    a = dt6.Rows[0]["imageurl"].ToString();
    b = dt6.Rows[1]["imageurl"].ToString();
    c = dt6.Rows[2]["imageurl"].ToString();
    a= a.Substring(1, a.Length - 1);
    b = b.Substring(1, b.Length - 1);
    c = c.Substring(1, c.Length - 1);
  %> 
   <div id="Div1"  class="image_stack" style="margin-removed300px ; removed 418px;"   
         runat="server">
       <img id="Img1"  class="stackphotos photo1" src="<%: a %>"   />
       <img id="Img2"  class="stackphotos photo2" src="<%: b %>"  />
       <img id="Img3"   class="stackphotos photo3" src="<%: c %>" />
   </div>
     <br /><br /><br /><br />
<% } %>


In above code image_stack is the div which is used to show album using Jquery plugin.
Posted

1 solution

You can not add CommandArgument/Comamnd Event to Div/Panel control
Instead of it you can add on LinkButton / ImageButton or Button to fulfil your requirement and Add that button to Div

C#
<div id="Div1" class="image_stack">
         runat="server">
        <asp:linkbutton id="linkButton" text="text" commandargument="1" commandname="GetAlbum" runat="server" xmlns:asp="#unknown">
       <img id="Img1" class="stackphotos photo1">
       <img id="Img2" class="stackphotos photo2">
       <img id="Img3" class="stackphotos photo3">
   </div>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900