Problem getting text from a TextBox

4 posts, 0 answers
  1. Ricardo
    Ricardo avatar
    3 posts
    Member since:
    Dec 2011

    Posted 19 Dec 2011 Link to this post

    Hello everyone!

    I'm having some problems getting the text on a TextBox, it keeps saying it's empty when it's not. Basically, I'm filling in a contact form, saving it and then reopening the contact's details (which opens the same form) and trying to get the text from the TextBox's.

    Since the object is originally is an ITextBox, I tried casting the object to TextBox, FrameworkElement and also not casting it at all and still no good... The "TextContent" property is empty and the "Text" doesn't exist (throws an exception).

    Unfortunately, it's not possible to make the app available to the outside due to company's policy...

    Best regards,
    Ricardo
  2. Jonas
    Jonas avatar
    20 posts
    Member since:
    Jun 2012

    Posted 20 Dec 2011 Link to this post

    Hello Ricardo,

    I've had the same issue, but only on some textboxes in grids.
    My sollution was to first click in the textbox (turns out that a border was above the textbox, when i clicked it then my TextBox appeared), then i could read the ITextBox object as text.

    One of my example:

    var myTextBox = rutin.ItemTextbox;

    var myBorderThatIsBlocking = rutin.ItemBorder;

    myBorderThatIsBlocking.User.Click();

    Assert.AreEqual(inputText, myTextBox.Text);


    This helped me, perhaps it can help you aswell.

    //Jonas
  3. Ricardo
    Ricardo avatar
    3 posts
    Member since:
    Dec 2011

    Posted 20 Dec 2011 Link to this post

    Although that wasn't the solution, thank you very much for your reply Jonas! :)

    The problem was that the "TextBox" was afterall an "ExtendedTextBox", which seems to have different behaviors.

    Best regards,
    Ricardo
  4. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 20 Dec 2011 Link to this post

    @Ricardo
    We're glad you sorted out your issue. Please post again if you require further assistance.

    @Jonas
    Thank you for offering assistance. Your Telerik Points have been updated accordingly.

    Regards,
    Anthony
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top