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

Add dynamic button and checkbox to tooltip

3 Answers 55 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Web Services
Top achievements
Rank 2
Web Services asked on 22 Apr 2011, 09:41 PM
I'm trying to generate content on a tooltip dynamically from a database. The problem is, I need to add dynamic check boxes. I looked through the demos but didn't see anything like this. I get an error when I try to add the checkbox, but I put it in to show what I need to do. I couldn't get the button to add either. Do you have any ideas? Here's the vb. The aspx for the tooltip is just standard stuff.

callBack.Text = "<div style=""margin-left: 10px; margin-top: 10px;""><b>Call Backs</b><br /><table cellpadding=""5"">"
callBack.Text &= "<tr><td>Customer:</td><td>Phone:</td><td>Call Back Date:</tr>"
 
Dim check As CheckBox
 
 
While reader.Read()
 
    check = New CheckBox
    check.ID = reader(4)
    check.Text = "Called Back"
 
    If (reader(3).ToString <> "") Then
        callBack.Text &= "<tr><td style=""width: 170px"">" & reader(2) & " - " & reader(3) & "</td><td>" & reader(1) & "</td><td>" & reader(0) & "</td><td>" & callBack.Controls.Add(check) & "</tr>"
    Else
        callBack.Text &= "<tr><td style=""width: 170px"">" & reader(2) & "</td><td>" & reader(1) & "</td><td>" & reader(0) & "</tr>"
    End If 'if reader(3)
     
 
 
End While
 
Dim btn As Button = New Button
btn.ID = "updateCall"
btn.Text = "Update"
callBack.Controls.Add(btn)
AddHandler btn.Click, AddressOf buttonClick
 
 
callBack.Text &= "</table><br /></div>"

 
callBack.Show()

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 27 Apr 2011, 03:17 PM

Hello,

You are setting the Text property of the ToolTip and it takes precedence over the controls added to its collection. You can confirm this in my test page that you can find attached. Note that I have simplified your scenario - the exact method that gets the text from the database is irrelevant in this case (and I don't have it).

If you are still getting an error please modify my test page to the point it displays the issue and send it back to me along with detailed information what the error is and reproduction steps.



Greetings,
Marin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Web Services
Top achievements
Rank 2
answered on 27 Apr 2011, 03:27 PM
I got your example working. I guess my question would be, how do I add text and these check boxes then? Do I need to create a label and add it or something? If you look at my example, I was trying to add a table created off dynamic data from the DB and I want it to show something like this
customer name       Phone number       Date        Called Back (this is the checkbox)
repeat this for all records...
then have submit button

when the user clicks submit I pull the checkboxes that are checked and update my DB if they are. I then close the window. Any suggestions on how to do that?
0
Svetlina Anati
Telerik team
answered on 03 May 2011, 09:43 AM

Hi,

In that case I would recommend creating a user control that has the required information in it and loading that user control in the tooltip.

Control ctrl = Page.LoadControl("Edit.ascx");
RadToolTip2.Controls.Add(ctrl);



Regards,
Svetlina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
ToolTip
Asked by
Web Services
Top achievements
Rank 2
Answers by
Marin Bratanov
Telerik team
Web Services
Top achievements
Rank 2
Svetlina Anati
Telerik team
Share this question
or