Add dynamic button and checkbox to tooltip

4 posts, 0 answers
  1. Web Services
    Web Services avatar
    243 posts
    Member since:
    Apr 2008

    Posted 22 Apr 2011 Link to this post

    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()
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 27 Apr 2011 Link to this post

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Web Services
    Web Services avatar
    243 posts
    Member since:
    Apr 2008

    Posted 27 Apr 2011 Link to this post

    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?
  5. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 03 May 2011 Link to this post

    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.

Back to Top