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

Setting the value of a radnumerictextbox during testing

3 Answers 90 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ace Ellett
Top achievements
Rank 1
Ace Ellett asked on 23 Feb 2010, 06:27 PM
I have a radnumeric textbox that contains the row number of the selected row of a radgrid.  The user should be able to change the value in the textbox, click a button, and the grid will update to change the selected row.

While testing this in WebAii, I can retrieve the textbox as either an element or radnumerictextbox using:

Dim

 

qsb As Element = frame.Find.ById("PRSelectTextbox")

 


or

Dim

 

qsb2 As RadNumericTextbox = frame.Find.ById(Of RadNumericTextbox)("PRSelectTextbox")

And I can see the value inside of it is "1".

However, when I try to set the value, using either
qsb.Attributes(3).value = "2"
or
qsb2.SetValue("2")

I can see the value change in the debugger, but it never changes in the browser, and when I programmatically click the button to update the grid, the grid doesn't update because the textbox hasn't changed.

Earlier in the code I am able to successfully change the text of a HtmlInputText object, but this does not work for the radnumerictextbox.

Any idea why the page is not staying in sync with the debugger?

 

3 Answers, 1 is accepted

Sort by
0
Missing User
answered on 23 Feb 2010, 06:54 PM
Hi Ace,

Thanks for the post and question.

Please try either: InputValue = ... or TypeText("...")

If possible, use TypeText since this will simulate actual typing and the Rad controls may not respond unless the input is simulated.

And, if you haven't already done so, please also check out this link for further documentation and resources on the framework.

Kind regards,
Nelson Sin
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ace Ellett
Top achievements
Rank 1
answered on 23 Feb 2010, 09:24 PM
Thanks for the quick response!

Turns out that I was incorrect in my original post.  When I try to find the textbox in a strongly-typed way
i.e. Dim qsb as RadNumericTextBox = frame.Find.ById(Of RadNumericTextBox)("PRSelectTextbox")
qsb gets set to Nothing, so when I try to write qsb.TypeText("2") I get an exception.

After a little more investigation, it seems that I can retrieve PRSelectTextbox as an Element or HtmlInputText, and additionally, I see several more Elements with names like PRSelectTextbox_text and PRSelectTextbox_wrapper

If I set the value attribute of PRSelectTextbox_text, then the change is refelected in the page so that I see "2" instead of "1".  However, when I click the button, the text goes back to "1" and the grid doesn't get updated.

Any further advice?  I can try to tear out some of my code if required.
0
Missing User
answered on 23 Feb 2010, 11:04 PM
Hello again Ace,

Please try using a Find Expression with more find parameters based on tag attributes like the following:

Dim qsb As RadNumericTextBox = ActiveBrowser.Find.ByExpression(Of RadNumericTextBox)("id=~PRSelectTextbox", "name=","StartTagContent=~"
'Add Name, TagName attribute, or add StartTagContent with partial content  

where the '~' operator is partial. So the above is find by partial id, name is an exact value, and the start tag contains some partial content.

I'm not exactly sure what you meant by changing the value attribute. But it seems like your controls would indeed require TypeText, since when you changed the Dom directly the change did not persist.

Edit: I forgot to add the link on the Find Expression documentation, sorry about that.

Greetings,
Nelson
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
Ace Ellett
Top achievements
Rank 1
Answers by
Missing User
Ace Ellett
Top achievements
Rank 1
Share this question
or