What is an Validation Groups in 2.0 and how can u create them?
Validation Groups allows the different section of the webpage to be validated seperately. All the ASP.NET 2.0 Validation controls,interactive form controls like TextBox,list controls Button and other controls that are used to submit a webform have validationGroup property. The default value of this property is the empty string. When a button with a ValidationGroup property is clicked all of the validation controls on the page with the same ValidationGroup property value are executed. On postback, the Page.IsValid property checks the validity of all of the validation controls. Programmatically it can be checked by the Validate() Method. <html> <head runat='server'> <title>Validation Groups</title> <script runat='server'> void Group1Click(Object s, EventArgs e) { if (Page.IsValid) { lblResult.Text = 'Name Validated & Submitted'; } } void Group2Click(Object s, EventArgs e) { if (Page.IsValid) { lblResult.Text = 'Age Validated & Submitted'; } } </script> </head> <body> <form id='form1' runat='server'> <div> <asp:Label ID='lblResult' Runat='Server' /> <fieldset style='padding:20px'> <legend>Name</legend> <asp:Label ID='Name' runat='server' Text='Name:'></asp:Label> <asp:TextBox id='TextBox1' Runat='Server'/> <asp:Button ID='Button1' ValidationGroup='Group1' Text='Submit' OnClick='Group1Click' Runat='Server' /> <asp:RequiredFieldValidator ID='RequiredFieldValidator1' ValidationGroup='Group1' ControlToValidate='TextBox1' Text='Field Cannot Be Empty' Runat='Server' /> </fieldset> <fieldset style='padding:20px'> <legend>Age</legend> <asp:Label ID='Label1' runat='server' Text='Age:'></asp:Label> <asp:TextBox id='TextBox2' Runat='Server' /> <asp:Button ID='Button2' ValidationGroup='Group2' Text='Submit' OnClick='Group2Click' Runat='Server' /> <asp:RangeValidator ID='RangeValidator1' runat='server' ErrorMessage='Enter Age between 18 To 58' MaximumValue='58' MinimumValue='18' ValidationGroup='Group2' ControlToValidate='TextBox2'> Enter Age between 18 To 58</asp:RangeValidator> </fieldset> </div> </form> </body> </html>
Can I select multiple nodes in a TreeView Control?
The Treeview control does not support multiple selections but there are samples posted at GotDotNet which demonstrates how this feature can be implemented.
How can I change the background of my MDI Client container?
The default behavior is to make the client container use the Control color from the Control panel. You can change this behavior by making the MDI Client container use the form’s BackColor and Image. To do this, after the call to InitializeComponents(), add the code below. You can also download a working MDI Client project that has this code in it. //set back color foreach(Control c in this.Controls) { if(c is MdiClient) { c.BackColor = this.BackColor; c.BackgroundImage = this.BackgroundImage; } }
How can I create an MDI application in the .NET framework with C#?
This is one of the Quick Start Samples that ships with VS.Net.
How can I place a border around a PictureBox?
One solution is to use a panel that has a picturebox placed on it with DockStyle.Fill. This will make the picturebox assume the size of the panel. In addition, set the DockPadding.All property to the width of the desired border. Then in the Panel’s OnPaint method, call the baseclass and then paint the desired borders. Here are both VB and C# projects that illustrate how you might go about this. The derived PicturePanel class has properties that allow you to set the bordersize and color as well as the image that is to be displayed. This sample retrieves the image from an embedded resource. It also uses double buffering to minimize flashing as you resize the control.