Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
a solution without using datalists, imagebuttons inside the panel do not scroll; and the remaining imagebuttons are not visible

public void CreateImage()
    {
        ImageButton[] myImage = new ImageButton[11];
        Panel myPanel = (Panel)Page.FindControl("pnlDia1");

        for (int i = 0; i < 10; i++)
        {
            myImage[i] = new ImageButton();
            myImage[i].Height = 130;            
            myImage[i].Style.Add("Cursor", "pointer");
            myImage[i].ImageUrl = "~/Images/File_-109.jpg";
            pnlDia1.Controls.Add(myImage[i]);
        }


What I have tried:

<div style="overflow-x:auto; height:150px; overflow-y:hidden">
           <asp:UpdatePanel ID="UpdatePanel2" runat="server" Visible="true">
           <ContentTemplate>
            <asp:Panel ID="pnlDia1" runat="server" ScrollBar="Horizontal">

           </asp:Panel>
           </ContentTemplate>
           </asp:UpdatePanel>
       </div>
Posted
Updated 14-Feb-18 21:28pm
Comments
#realJSOP 14-Feb-18 13:55pm    
Do you really want your buttons to be 130px tall?
Member 13174280 15-Feb-18 5:49am    
yes, see what I have to do with "Button".
www.efalco.it/temp/test.jpg

1 solution

Solved

adding a Table structure

<asp:UpdatePanel ID="UpdatePanel2" runat="server" Visible="true"> 
    <ContentTemplate> 
      <asp:Panel ID="pnlDia1" runat="server">
         <asp:Table ID="Table1" runat="server">
           <asp:TableRow>
               <asp:TableCell>
                     .............
               </asp:TableCell>
           </asp:TableRow>             
         </asp:Table>
      </asp:Panel>
    </ContentTemplate>
</asp:UpdatePanel>
 
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