Thursday, August 16, 2012

Reset all controls to initial state

Reset all controls to initial state

Hello, I have an application with a huge searchform(that form is Grid), lots of various elements inside of it(comboboxes, textboxes etc. ). If needed all data for this controls is populated from LoadDate event. My requirement is to make a button which resets all elements inside this grid and returns them in the state as they were after the LoadDate event.

Is it possible to reload only this Grid containing number of controls?

Thanks in advance for help.

Answers & Comments...

Answer: 1

Ante7848

Is it possible to reload only this Grid containing number of controls?

if you are adding this search form control(grid) into any of the container, then you can clear the container and add this form again.

or else There is no proper way to do this, i hope this will help you 

foreach( var uiElement in LayoutRoot.Childrens)  {  	if(uiElement is TextBox)  	{  		var textBox = uiElement as TextBox;  		textBox.Text = string.empty;  	}  	else if(uiElement is ComboBox)  	{  		var comboBox = uiElement as ComboBox;  		comboBox.ItemSource = null;  	}  	more else if condition for other controls  }  



by :

Answer: 2

Thank you for help.

You said that i can add my grid into the container and later it will be possible to clear that container and this grid again. For doing this should i create a UserControl that in turn will be this searchform or there is another way to add this grid into the container after clearing it?

by :




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog