.NET Tip of The Day
Learn one new .NET trick every day
Быстрое пополнение счета телефона      Login or Join

.NET Tips & Tricks Community (ALPHA)

First ... 16 17 18 19 Last  RSS

How to maintain the position of the scrollbar on postbacks (across the entire site)

In ASP.NET 1.1 it was a pain to maintain the position of the scrollbar when doing a postback operation. In ASP.NET 2.0 you can simply add the MaintainScrollPostionOnPostBack attribute to the Page directive of any specific page:

<% Page Language="C#" ... MaintainScrollPositionOnPostback="true" %> 

If you would like to apply this behavior to your entire site simply modify the <pages /> entry of your <system.web /> section in your web.config file like so:

<pages maintainScrollPositionOnPostBack="true">

submitted by Joe Levi
10/3/2007

Enum.IsDefined() to check submited user values

Given an enum like...

public enum MyEnum

{

    Value1,

    Value2,

    Value3

}

When you have a user submited value you need to check against an enum, you can easilly do it..

int submitedValue = 123;

if(Enum.IsDefined(typeof(MyEnum), submitedValue))

{

    ...

 

submitted by M.Parreira
9/26/2007
First ... 16 17 18 19 Last  RSS
RSS .NET Tip of The Day
Subscribe to receive one tip from the .NET Tips and Tricks Community per day.
Previous Tips of The Day
The best of the .NET Tips & Tricks Community.
.NET Practitioners .NET Tips & Tricks Community
Every .NET practitioner has a trick up in their sleeve. This is the place to share it with other .NET people.
Submit a Tip
Discovered a new trick? Share it with others.
My Tips
Manage tips you authored.