Assign a value to a textbox on Add New Record of radgrid

4 posts, 0 answers
  1. Arpita
    Arpita avatar
    2 posts
    Member since:
    Oct 2010

    Posted 27 Oct 2010 Link to this post

    We have a variable with a value. Want to assign the value of a variable to the textbox on add new record on button click event?

  2. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 27 Oct 2010 Link to this post

    Hello Arpita Parikh,

    We need a little more information before we can assist you.

    1. Where is this variable located? In your JavaScript code? In the test code?
    2. Do you value in the variable read and then put into the text box or the contents of the text box read and put into this variable?
    3. Are you trying to write test code that hooks into the button click event, or trying to use/set the variable after the button click is done?

    Sincerely yours,
    Cody
    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
  3. Arpita
    Arpita avatar
    2 posts
    Member since:
    Oct 2010

    Posted 27 Oct 2010 Link to this post

    Hi Cody,

    Thanks for your reply.

    1. The variable is a global variable. No the code in not JavaScript.
    2. I read the value from variable and then assign it to the text box
    3. Yes, I am writing test code on the button click event.


    -Arpita

  4. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 02 Nov 2010 Link to this post

    Hello Arpita,

    I would like to better understand what it is you're trying to test. I ask because it is very unusual to want to hook into a button click event and act on it. The normal test sequence is to have the test click the button and then verify the correct response was returned by the web application. Would you mind giving me an overview of what it is you're trying to validate in this particular test case please? Once I understand what you're trying to accomplish I might be able to offer a better and easier way to accomplish it.

    It is possible to hook into JavaScript events. This is documented here.

    To set the text of an input text box you would use code like this:

    string text_to_set = "Customer";
    HtmlInputText textbox = Find.ById<HtmlInputText>("input_q");
    textbox.Text = text_to_set;

    Kind regards,
    Cody
    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
Back to Top