locked
Change Text Value in Code RRS feed

  • Question

  • Anyone know how to change a text value in code?   I'd expected something like a "Text" property in Me.FindControl("AddTextNameHere") but I just see the usual DisplayName, Description, etc...

    I want to use the Text to display a warning message stating something like "Cannot delete this <ParentRecord> because it is referenced by a <ChildRecord>".  I don't want a MessageBox box, and I've disabled the DELETE button in the CanExecute method in this circumstance, so the tooltip/description I would have used won't display because the button is disabled.

    It's probably very simple but I didn't have luck searching the forum.  "Change Text value in Code" is too generic of search criteria I think.

    Thanks in advance!

    Mark

    Friday, May 31, 2013 2:21 PM

Answers

  • Hi Mark,

    I would recommend the following:

    Add a local property of type string to your screen (Add Data Item command).

    Bind it to a content item and set that content item Is Visible to false.

    Then the code to update the warning message and show it will be

        Me.Warning = "This is a warning"
        Me.FindControl("Warning").IsVisible = True

    Best regards,
    Huy
    • Marked as answer by Angie Xu Thursday, June 6, 2013 1:09 AM
    Tuesday, June 4, 2013 11:58 PM