Trying to programmatically set textbox value

4 posts, 0 answers
  1. Jason
    Jason avatar
    6 posts
    Member since:
    Jun 2009

    Posted 12 May 2010 Link to this post

    I use the NeedDataSource Event to bind a table from the resultset of a stored procedure. In the table I have a text box(textBox7) in which sometimes there is a visible value, other times there is not. I want to test to see if there is a value in this textbox. I
    f there is, I want to set the value of textBox6 to "Yes". If textBox7 does not have a value, make the value of TextBox6 equal to "No". I am using the ItemDataBound event of TextBox6 to try to achieve this. Right now the value of textBox6 always ends up being "Yes" . However, this is not correct. I need to know how to write a valid test for the value of TextBox7, or if I am doing something else wrong. Code is below. Any help would be greatly appreciated.


            private void textBox6_ItemDataBound(object sender, System.EventArgs e)  
                if (textBox7.Value != null || textBox7.Value=="")  
                    textBox6.Value = "Yes";  
                    textBox6.Value = "No";  


  2. Peter
    Peter avatar
    1638 posts

    Posted 17 May 2010 Link to this post

    Hi Jason,

    You have modified the definition TextBox item instead of the processing counterpart (the sender argument), thus all subsequent processing items will be modeled after the modified reporting item.

    Check out the following help articles:
    Generally speaking for similar cases our suggestion is to use Bindings instead of Events. You can achieve your requirement as shown in the following sreenshoot:

    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. Ashish
    Ashish avatar
    7 posts
    Member since:
    Jul 2013

    Posted 11 Sep 2013 Link to this post

    I am facing same problem for  Boolean field.
    How can I set the text box value =yes if true else No
  4. Squall
    Squall avatar
    181 posts
    Member since:
    Feb 2011
Back to Top