Question: I got a page with multiple dropdownlist. Each of them are fill with a lot of stock.I need the selected value of each of them on postback.

My problem is, at the end of the post back it take so much time to refresh(show) the page.
and I saw that the viewstate is fill with a lot of thing. 

I try to disable viewstate for my dropdownlist, but that erase my value on postback.

I already have a conpressor for viewstate.

can you help me.

Answer: 
There is, but a little tricky way to achieve your goals:

1. The variable is private, available only to some elements.
2. Your function template can access it.

Use private static variable in a class defined in header, and make your function/class templates friend of this class.

**YourFile.h**

```
class PrivateYourFileEntities {
private:
   static const int SomeVariable;
   // ... other variables and functions
   template <class T>
   friend class A;
   template <class T>
   friend void func();
   // the rest of friends follows
};

template <class T>
void A<T>::func() {
     int a = PrivateYourFileEntities::SomeVariable;
}

template <class T>
void func() {
     int a = PrivateYourFileEntities::SomeVariable;
}

```

**YourFile.cpp**

```
const int PrivateYourFileEntities::SomeVariable = 7;

```
Put the method declaration into .h file and method body into .cpp file like:

.h file:

```
#include <iostream>

void myfunc1();
void myfunc2();

```

.cpp file:

```
#include "myheader.h"

static int myglobalvar=90;

    void myfunc1()
    {
      cout << myglobalvar << endl;
    }

    void myfunc2()
    {
      cout << "Oh yeah" << endl;
    }

```