RadTextBox collection access in javascript

14 posts, 0 answers
  1. Ken Jones
    Ken Jones avatar
    41 posts
    Member since:
    Sep 2009

    Posted 20 Jan 2011 Link to this post

    Hello,

    I have come across the following javascript code to access a collection of ComboBox objects:

    var combos = Telerik.Web.UI.RadComboBox.ComboBoxes;

    Is there an equivalent for RadTextBoxes?

    Thanks,

    Ken Jones
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 Jan 2011 Link to this post

    Hello Ken,

    As far as I know,  there is no such direct method to get the RadTextBox collection. You can try the following approach to meet your scenario.

    JavaScript:
    function GetRadTextBoxes()
    {
        var allRadTextBoxes = [];
        var allRadControls = $telerik.radControls;
        for (var i = 0; i < allRadControls.length; i++)
        {
            var element = allRadControls[i];
            var isRadTextBox = element instanceof Telerik.Web.UI.RadTextBox;
            if (isRadTextBox)
             {
                Array.add(allRadTextBoxes, element);
             }
        }
     alert(allRadTextBoxes.length);
    }

    Thanks,
    Shinu.
  3. Ken Jones
    Ken Jones avatar
    41 posts
    Member since:
    Sep 2009

    Posted 24 Jan 2011 Link to this post

    Hello,

    Thanks for the repsonse, that works for me, I now need to be able to test on the client id of each of the textboxes to know whether to update them or not, the following link does not seem to inform me as to how I get the id.

    http://www.telerik.com/help/aspnet-ajax/input_clientsideradtextbox.html

    Thanks,

    Ken
  4. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 27 Jan 2011 Link to this post

    Hello Ken Jones,

    Please revise the following help topic:
    http://www.telerik.com/help/aspnet-ajax/input_clientsidebasics.html

    Kind regards,
    Maria Ilieva
    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.
  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 27 Jan 2011 Link to this post

    Hello Ken Jones,

    Please revise the following help topic:
    http://www.telerik.com/help/aspnet-ajax/input_clientsidebasics.html

    Kind regards,
    Maria Ilieva
    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.
  6. Ken Jones
    Ken Jones avatar
    41 posts
    Member since:
    Sep 2009

    Posted 27 Jan 2011 Link to this post

    Hello,

    Thanks again for your reply but as far as I can see, the link that you suggested does not answer my question.

    Ta,

    Ken
  7. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 28 Jan 2011 Link to this post

    Hello Ken,

    You can try the following approach to access the ClientID of the RadTextBoxes.

    JavaScript:
    for (var i = 0; i < allRadTextBoxes.length; i++)
        {
            var txt = allRadTextBoxes[i];
            alert(txt._clientID);
        }

    Thanks,
    Shinu.
  8. Ken Jones
    Ken Jones avatar
    41 posts
    Member since:
    Sep 2009

    Posted 28 Jan 2011 Link to this post

    Thanks, I will give that a go.

    Ta,

    Ken
  9. Ken Jones
    Ken Jones avatar
    41 posts
    Member since:
    Sep 2009

    Posted 28 Jan 2011 Link to this post

    Hello,

    This works thanks. Unfortunately the next thing I tried doesnt work now. I need to be able to access the updated value of the text box from server side code. I have acheived this with a RadListBox using trackChanges() and commitChanges(). When I use these methods with my RadTextBox I get the message 'Object doesn't support this prpoerty or method'. Is there another way to acheive this?

    Thanks again,

    Ken
  10. Ken Jones
    Ken Jones avatar
    41 posts
    Member since:
    Sep 2009

    Posted 31 Jan 2011 Link to this post

    Hello,

    Does anybody have any suggestions for this?

    Ta,

    Ken
  11. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 01 Feb 2011 Link to this post

    Hello Ken Jones,

    You can get the new value from the arguments of the server TextChanged event of the RadTextBox.
    If you need to access it on the client please use get_textBoxValue()


    Regards,
    Maria Ilieva
    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.
  12. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 01 Feb 2011 Link to this post

    Hello Ken Jones,

    You can get the new value from the arguments of the server TextChanged event of the RadTextBox.
    If you need to access it on the client please use get_textBoxValue()


    Regards,
    Maria Ilieva
    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.
  13. Ken Jones
    Ken Jones avatar
    41 posts
    Member since:
    Sep 2009

    Posted 01 Feb 2011 Link to this post

    Thanks for the update.

    I think that part of the problem here is that my RadTextBox is sat inside the FormTemplate of a RadGrid, I am accessing the value in the UpdateCommand method server-side but thefollowing code results in the original value being stored in site.Client and not the value that has been updated client side.

    RadTextBox uiTxtClient = (RadTextBox)editedItem.FindControl("uiTxtClient");
    site.Client = uiTxtClient.Text;

    Let me know if anything needs changing.

    Ken
  14. Ken Jones
    Ken Jones avatar
    41 posts
    Member since:
    Sep 2009

    Posted 01 Feb 2011 Link to this post

    I have now worked the problem out to be that my text box is read only....
Back to Top