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

Button Click In Tooltip User Control

2 Answers 24 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 14 Oct 2015, 01:33 PM

I am trying to do something similar to the RadToolTip for RadCalendar demo shown here: http://demos.telerik.com/aspnet-ajax/tooltip/examples/tooltipcalendar/defaultvb.aspx.  I want to add an export button inside the UserControl for the tooltip, but can't seem to get that event to fire.  My code for the user control is below.  Any ideas?

 

Partial Class CalendarEventDetails
    Inherits System.Web.UI.UserControl
 
    Private dtSelectedDate As DateTime
    Public Property SelectedDate() As DateTime
        Get
            Return dtSelectedDate
        End Get
        Set(ByVal value As DateTime)
            dtSelectedDate = value
        End Set
    End Property
 
    Protected Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init
        AddHandler lvEvents.ItemCommand, AddressOf lvEvents_ItemCommand
    End Sub
 
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        odsEvents.SelectParameters("StartDate").DefaultValue = SelectedDate
        odsEvents.SelectParameters("EndDate").DefaultValue = SelectedDate
        lvEvents.DataBind()
    End Sub
 
    Protected Sub lvEvents_ItemCommand(sender As Object, e As ListViewCommandEventArgs)
        If e.CommandName = "Export" Then
            'Do Something
        End If
    End Sub
End Class

 

<%@ Control Language="VB" AutoEventWireup="true" CodeFile="EventDetails.ascx.vb" Inherits="CalendarEventDetails" %>
<asp:ListView runat="server" ID="lvEvents" DataSourceID="odsEvents">
    <LayoutTemplate>
        <div style="max-height: 250px; overflow-y: auto">
            <asp:PlaceHolder runat="server" ID="itemPlaceHolder"></asp:PlaceHolder>
        </div>
    </LayoutTemplate>
    <ItemTemplate>
        <asp:Label runat="server" ID="lblStartDate" Text='<%#Eval("StartDate")%>' Visible="false"></asp:Label>
        <asp:Label runat="server" ID="lblEndDate" Text='<%#Eval("EndDate")%>' Visible="false"></asp:Label>
        <div style="margin-bottom: 5px">
            <b>Category</b><br />
            <%#Eval("Category")%>
        </div>
        <div style="margin-bottom: 5px">
            <b>Title</b><br />
            <asp:Label runat="server" ID="lblTitle" Text='<%#Eval("Title")%>'></asp:Label>
        </div>
        <div style="margin-bottom: 5px">
            <b>Time</b><br />
            <%#Eval("StartDate", "{0:hh:mm tt}")%> to <%#Eval("EndDate", "{0:hh:mm tt}")%>
        </div>
        <div style="margin-bottom: 5px">
            <b>Location</b><br />
            <asp:Label runat="server" ID="lblLocation" Text='<%#Eval("Location")%>'></asp:Label>
        </div>
        <div style="margin-bottom: 5px">
            <b>Description</b><br />
            <asp:Label runat="server" ID="lblDescription" Text='<%#Eval("Description")%>'></asp:Label>
        </div>
        <div>
            <des:LinkButton runat="server" ID="btnExport" Text="Export" CommandName="Export"></des:LinkButton>
        </div>
    </ItemTemplate>
    <ItemSeparatorTemplate>
        <hr />
    </ItemSeparatorTemplate>
</asp:ListView>
<asp:ObjectDataSource ID="odsEvents" runat="server" DataObjectTypeName="CalendarEvent"
    TypeName="CalendarManager" SelectMethod="GetEventList">
    <SelectParameters>
        <asp:Parameter Name="CalendarId" Type="Int32" DefaultValue="101" />
        <asp:Parameter Name="StartDate" Type="DateTime" />
        <asp:Parameter Name="EndDate" Type="DateTime" />
        <asp:Parameter Name="CategoryId" Type="Int32" />
    </SelectParameters>
</asp:ObjectDataSource>

2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 15 Oct 2015, 10:01 AM

Hi Michael,

I am attaching a small sample I built on top of your code that seems to work fine for me so you can compare it with your setup to try and find the difference that causes the issue. Here are some suggestions, notes and ideas:

  • see if using standard controls works fine (as my sample uses asp:LinkButton)
  • see if binding the listview in the PreRender event helps (read more about this in the Common Issues article of RadToolTip)
  • ensure there are no server errors during the processing of the request (e.g, when the data source attempts to retrieve data)
  • see whether the event is actually hit (e.g.m by adding a breakpoint) but the problem is with the operation that is executed. Here are several potential problems:
    • an error is thrown so the expected result is never achieved. To confirm this you should step through the code
    • you are attempting to change the Response object (e.g., by sending a file to the user) which is impossible in this scenario - the tooltip manager loads its content via AJAX, so the entire user control is already in an UpdatePanel and MS AJAX does not allow you to change the response.
      If this is what you need, I would advise that you consider using a RadWindow for these details, much like in the Edit Dialog for RadGrid demo. Having an entire page for the details instead of an AJAX-enabled user control will let you export and send files.

Regards,

Marin Bratanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Michael
Top achievements
Rank 1
answered on 15 Oct 2015, 11:22 AM
Wow, yeah, it was the LinkButton causing the problem.  Switched to an asp:LinkButton and everything works fine.  Thanks!
Tags
ToolTip
Asked by
Michael
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Michael
Top achievements
Rank 1
Share this question
or