This is a migrated thread and some comments may be shown as answers.

ItemTemplate Help

7 Answers 63 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Chad
Top achievements
Rank 1
Chad asked on 25 Aug 2009, 06:56 PM
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

7 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 26 Aug 2009, 01:14 PM
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.
0
Chad
Top achievements
Rank 1
answered on 26 Aug 2009, 04:28 PM
Hi Yana,

Thanks, that got me on the right track.
0
Chad
Top achievements
Rank 1
answered on 26 Aug 2009, 04:34 PM
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,
0
Yana
Telerik team
answered on 28 Aug 2009, 11:34 AM
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.
0
jlj30
Top achievements
Rank 2
answered on 28 Jan 2014, 07:08 PM
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

0
Shinu
Top achievements
Rank 1
answered on 29 Jan 2014, 11:33 AM
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.
0
jlj30
Top achievements
Rank 2
answered on 29 Jan 2014, 12:41 PM
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
Tags
ToolBar
Asked by
Chad
Top achievements
Rank 1
Answers by
Yana
Telerik team
Chad
Top achievements
Rank 1
jlj30
Top achievements
Rank 2
Shinu
Top achievements
Rank 1
Share this question
or