Radlistview with image button

6 posts, 0 answers
  1. ahmed
    ahmed avatar
    10 posts
    Member since:
    Mar 2009

    Posted 08 Jan 2014 Link to this post

    Hello
    i added asp image and image buttons in rad list view read from DB source
    my problem i cant get selected picture form rad button to so image
      <asp:Image ID="Image1" runat="server" Width="300px" />
                        <br />
                        <telerik:RadListView ID="RadListView3" runat="server" AllowPaging="True"
                        onselectedindexchanged="RadListView3_SelectedIndexChanged"
                          OnItemDataBound="RadListView3_ItemDataBound" PageSize="4"
                          AllowCustomPaging="True" Skin="Vista">
                            <LayoutTemplate>
                                <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
                            </LayoutTemplate>
                            <ItemTemplate>
                                <asp:ImageButton ID="ImageButton2" runat="server" Height="80px"
                                    ImageUrl='<%# Eval("Pic_Path") %>' onclick="ImageButton2_Click" Width="60px" />
                            </ItemTemplate>
                        </telerik:RadListView>

    can you help me ??
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 13 Jan 2014 Link to this post

    Hi Ahmed,

    Based on the provided description I'm not completely sure what exactly is the issue you are facing. Are you truing to get the RadListView selected item on a external button click?
    If this your case you could use the approach below:
    protected void Button1_Click(object sender, EventArgs e)
        {
            foreach (RadListViewItem item in RadListView3.SelectedItems)
            {
                ImageButton btn= (ImageButton ) item.FindControl("ImageButton2");
               
            }
        }

    I hope this helps.

    Regards,
    Maria Ilieva
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. ahmed
    ahmed avatar
    10 posts
    Member since:
    Mar 2009

    Posted 14 Jan 2014 Link to this post

    when try RadListView3.SelectedItems.Count; always = 0
    cause that i cant enter loop

    ImageButton btn = (ImageButton)item.FindControl("ImageButton2");

                    Image1.ImageUrl = btn.ImageUrl;


    how can set selecteditem is clicked image ??

  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 14 Jan 2014 Link to this post

    Hi Ahmed,

    You could set a CommandName for the specific ImageButton and in the RadListView ItemCommand event manually select the item. For example:
    protected void RadListView3_ItemCommand(object sender, Telerik.Web.UI.RadListViewCommandEventArgs e)
    {
      if (e.CommandName == "CommandName")
      {
         RadListViewDataItem item = e.ListViewItem as RadListViewDataItem;
         item.Selected = true;
      }
     }

    I hope this helps.

    Regards,
    Maria Ilieva
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  6. ahmed
    ahmed avatar
    10 posts
    Member since:
    Mar 2009

    Posted 14 Jan 2014 Link to this post

    hello Maria

    can you help me in that issue

    i have radlistview contains image button & normal image
    i need when press on image button that image shown in image

    thank you for your support
  7. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 15 Jan 2014 Link to this post

    Hi Ahmed,

    You could review the Image Gallery approach for showing images in RadListView control presented in the online demo below:
    http://demos.telerik.com/aspnet-ajax/controls/examples/integration/listviewsliderwindowrotator/defaultcs.aspx?product=listview

    Regards,
    Maria Ilieva
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017