Skip to main content

Posts

Showing posts from February, 2005

Enhancements to Panel control in ASP.NET 2.0

As we know Panel Server control is a container control which can contain other controls within it and help us in laying out the page neatly. There are few interesting enhancements made to this control and the properties or attributes added are as follows: Scrollbars :: Auto, Both, Horizontal, None and Vertical Directions :: LeftToRight, NotSet, RightToLeft Wrap :: True and False HorizontalAlign :: NotSet, Center, Justify, Left and Right I wrote a basic code snippet using "Scrollbars" and "Directions" attribute. I have just added that panel code alone here for those who would be interested in knowing the syntax!! <asp:Panel ID="Panel1" runat="server" Width="100px" Height="100px" ScrollBars ="auto" Direction ="rightToLeft"> Test msg Test msg Test msg Test msg Test msg Test msg Test msg Test msg Test msg Test msg Test msg Test msg Test msg Test msg Test msg </asp:Panel> When I get time I would writ

[ASP.NET 2.0] Cool enhancement in Validation server control

Validation controls in ASP.NET 2.0 have a new attribute by name "ValidationGroup". This was on the wish list for quite sometime but I am really glad it was introduced in Whidbey. Using this we can easily group controls which needs to be fired on click of a button. Just go through the below code snippet which I wrote to test this feature for your better understanding. <body> <form id="form1" runat="server"> <h1>GROUP I</h1> Firstname: <asp:TextBox ID="txtFirstname" Runat="server"></asp:TextBox> <asp:Button ID="Button1" Runat="server" Text="Login" ValidationGroup="Group1" /> <asp:RequiredFieldValidator ID="RFV1" Runat="server" ErrorMessage="* Firstname is mandatory" ControlToValidate="txtFirstname" ValidationGroup="Group1" > </asp:RequiredFieldValidator> <hr /> <h1>GROUP II</h1>

[ASP.NET 2.0] Providing hotkeys in Label server control

Label server control in ASP.NET 2.0 has a new attribute by name "AccessKey". Hotkeys are assigned using this keyword. As you know if we want to access an hot key we would use ALT + "access key". Label server control also has another new attribute by name "AssociatedControlId". Here we would specify the name of another control on this form where control needs to go on using the hotkeys set. For instance, Write the below code snippet in your aspx and run the app. On clicking "ALT + N" the focus would be set on the TextBox control. <asp:Label ID="LblSample" Runat="server" AccessKey ="N" AssociatedControlId ="txtFirstname">First<u>n</u>ame </asp:Label> <asp:Textbox ID="txtFirstname" Runat="server"></asp:Textbox>