ItemTemplate Help

8 posts, 1 answers
  1. Chad
    Chad avatar
    7 posts
    Member since:
    Jun 2009

    Posted 25 Aug 2009 Link to this post

    Hello All,

    I am building a splitbutton with many children buttons that will all be templates the template will consist of the normal link for the button and two images on the far right, both buttons to execute different code. It would look something like this:

    <telerik:RadToolBarSplitButton> 
      <Buttons> 
        <telerik:RadToolBarButton> 
          <ItemTemplate> 
             <table> 
               <tr><td> Normal Link Button</td><td>Image button</td></td><td>Image button</td></tr
             </table> 
          </ItemTemplate> 
        </telerik:RadToolBarButton> 
       </Buttons> 
    </telerik:RadToolBarSplitButton> 

    How can I adopt the styles from the toolbar so that the drop down buttons look as they would without the template only with a couple extra buttons on the right hand side?

    Thank You as always for you help
  2. Answer
    Yana
    Admin
    Yana avatar
    4554 posts

    Posted 26 Aug 2009 Link to this post

    Hello Chad,

    Please try it like this:

    <telerik:RadToolBarSplitButton>  
          <Buttons>  
            <telerik:RadToolBarButton>  
              <ItemTemplate>  
                 <table class="rtbWrap">  
                   <tr><td> Normal Link Button</td><td>Image button</td></td><td>Image button</td></tr>  
                 </table>  
              </ItemTemplate>  
            </telerik:RadToolBarButton> 
            <telerik:RadToolBarButton Text="button 2" />  
           </Buttons>  
        </telerik:RadToolBarSplitButton> 


    Greetings,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chad
    Chad avatar
    7 posts
    Member since:
    Jun 2009

    Posted 26 Aug 2009 Link to this post

    Hi Yana,

    Thanks, that got me on the right track.
  5. Chad
    Chad avatar
    7 posts
    Member since:
    Jun 2009

    Posted 26 Aug 2009 Link to this post

    Hi Yana,

    Now that the rending is good, I cannot seem to get the click event of the buttons to fire. I have the following:

    <telerik:RadToolBarButton Text="All Projects">     
                                <ItemTemplate> 
                                    <table class="rtbWrap"
                                        <tr><td width="250px"><asp:LinkButton ID="LinkButtonProjects" runat="server" Text="All Projects" CssClass="TemplateText"/></td> 
                                            <td align="right"><asp:ImageButton ID="ImageButtonProjectsGarbage" ImageUrl="~/Images/Icons/GarbageBin16.png" runat="server" OnClick="DeleteView" /></td></tr> 
                                    </table> 
                                </ItemTemplate>                        
                            </telerik:RadToolBarButton> 

    in the codebehind:

     protected void DeleteView(object sender, ImageClickEventArgs e) 
     { 
        // Do something here 
     }        
     
    The page postbacks with the click of the imagebutton but the event is not firing.

    Any suggestions?

    Thanks,
  6. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 28 Aug 2009 Link to this post

    Hello Chad,

    Could you please try it like this:

    <telerik:RadToolBarButton>  
      <ItemTemplate>  
        <a  class="rtbWrap" href="#"
         <table>  
           <tr><td> Normal Link Button</td><td>Image button</td></td><td>Image button</td></tr>  
         </table>  
         </a> 
      </ItemTemplate>  
    </telerik:RadToolBarButton> 

    and let us know how it goes?

    Regards,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. jlj30
    jlj30 avatar
    101 posts
    Member since:
    Jan 2011

    Posted 28 Jan 2014 in reply to Chad Link to this post

    Hi Chad,

    I realize this is an old post, but did you ever get this to work?
    I have pretty much the same challenge.
    The onClientClick event is not firing for my ImageButton.
    It almost looks like a postback is occurring as I see a screen refresh, but my client side code is not firing.

    Any feedback would be much appreciated.

    Thanks

    Jim

  8. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 29 Jan 2014 in reply to jlj30 Link to this post

    Hi,

    Please have a look into the sample code snippet which works fine at my end.

    ASPX:
    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/plus.gif"  OnClientClick="Click();" />

    JavaScript:
    <script type="text/javascript">
        function Click(sender, args) {
            alert("Fired");
        }
    </script>

    Please provide your code if it doesn't help.
    Thanks,
    Shinu.
  9. jlj30
    jlj30 avatar
    101 posts
    Member since:
    Jan 2011

    Posted 29 Jan 2014 in reply to Shinu Link to this post

    Hi,

    I found the problem.
    It seems that I need to include "return" in my OnClientClick declaration, and within my function I return false;
    Here's the working statement:

    <asp:ImageButton runat="server" AutoPostBack="false" OnClientClick="return taskPaletteItemClicked(this, 'standard')" ImageUrl="~/Images/Navvia/Navigator_Standard_Task_24H.png" ToolTip="Standard Task" />

    Jim
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017