Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > PageView > Find textbox control

Not answered Find textbox control

Feed from this thread
  • TAYIM avatar

    Posted on Oct 5, 2011 (permalink)

    Hi to everyone
    this is my problem
    on a radform, I placed a radpageview control with 02 pages
    inside this pages, I placed texboxes, group etc..
    I also have a button somewhere inside the radform
    How can I reset all the textboxes (xtextbox.text="") ?
    My english is not so good
    thanks

    Reply

  • Posted on Oct 6, 2011 (permalink)

    Hey Tayim,

    several possibilities come to mind:

    1) in the designer, select the control and clear it's Text Property. That should also work with multiple controls selected. You might need to select the different pages individually - that gives some more clicks.

    2) open the designer codebehind file and work out a clever regular expression to replace .Text=".*" with .Text=""

    3) in code: recursively iterate over the forms controls collection and reset the .Text properties of the controls you are interested in. When you get a RadPageView control you may need some more specific code to get to the different pages and their controls.

    I'm sure other people will come up with even more ways.

    regards
    Erwin

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.
  • Ivan Petrov Ivan Petrov admin's avatar

    Posted on Oct 7, 2011 (permalink)

    Hi TAYIM,

    Thank you for writing.

    As Erwin has posted, it depends on when you want to "reset" the text. If you are doing it in the designer, you can use the Visual Studio property grid and set the Text property of each RadTextBox. Or you can use the Find & Replace dialog of Visual Studio to replace the text with an empty string in the form .Designer.cs file. If you want to do it at runtime, you can iterate through the controls on each page of the RadPageView, check if the control is RadTextBox and then reset the text. Here is a code snippet which demonstrates this:

    foreach (RadPageViewPage page in this.radPageView1.Pages)
    {
      foreach (Control control in page.Controls)
      {
        if (control is RadTextBox)
        {
          ((RadTextBox)control).Text = String.Empty;
        }
      }
    }

    I hope this will help you. If you have further questions, do not hesitate to ask.

    Kind regards,
    Ivan Petrov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > PageView > Find textbox control