RadToolTip/Multiple UserControl

5 posts, 0 answers
  1. Andrew Thompson
    Andrew Thompson avatar
    12 posts
    Member since:
    Apr 2005

    Posted 23 Jan 2008 Link to this post

    My goal: create a TextBox that is readonly. Click on the text, and a ToolTip appears where you can 'edit' the content and click on save where upon the tooltip disappears and the form is updated.

    I created the user control and in the Tooltip attributes set the TargetControlID to the Textbox (ID=PayLoadTextBox) and set the IsClientID to false.

    It works great.

    Now I want to be able to add multiple of these controls onto a single page. I therefore change the TargetControlID to "<%= PayLoadTextBox.ClientID %>" and set the IsClientID to true.

    Now the popup doesn't appear. (Nothing else was changed.)

    Am I missing something obvious?


    Thanks,


    Andrew T.
  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 24 Jan 2008 Link to this post

    Hello Andrew Thompson,
    Unfortunately in this case the code between the '<%= %>' tags is not resolved to the ClientID of the textbox, but is taken as it is. That is why, in order to get the desired result, you can use one of the following approaches:
    1. Set the TargetControlID of the RadToolTip in the code-behind:
      protected void Page_Load(object sender, EventArgs e)  
      {  
          this.RadToolTip1.TargetControlID = this.PayLoadTextBox.ClientID;  
    2. Use databinding expressions (in this case you will have to call DataBind for the RadToolTip):
      <telerik:RadToolTip ID="RadToolTip1" runat="server"   
      TargetControlID="<%# PayLoadTextBox.ClientID %>" IsClientID="true"></telerik:RadToolTip> 
      protected void Page_Load(object sender, EventArgs e)  
      {  
          this.RadToolTip1.DataBind();  
    Regards,
    Tsvetie
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Andrew Thompson
    Andrew Thompson avatar
    12 posts
    Member since:
    Apr 2005

    Posted 24 Jan 2008 Link to this post

    The first technique doesn't work with 2.0 Framework because ClientID is a readonly property, however the second technique worked like a charm.

    Thank you very much for your prompt response.
  4. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 24 Jan 2008 Link to this post

    Hello Andrew,

    The first approach will definitely work as well - it is not the ClientID that is being assigned to, but the TargetControlID property. The ClientID is simply being "read", not "written to".

    this.RadToolTip1.TargetControlID   = this.PayLoadTextBox.ClientID;

    We are glad to know that you got things working though.

    Best regards,
    Tervel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Andrew Thompson
    Andrew Thompson avatar
    12 posts
    Member since:
    Apr 2005

    Posted 24 Jan 2008 Link to this post

    You are perfectly correct, my bad.

    I've got too much coffee and not enough braincells this morning.

    Thank you.
Back to Top