How to get the DataSourceId?
<pre><code>private SqlDataSource GetDataSource()
       {

           object o = Session["selectedDataSource"];
           DataSourceType dsType = DataSourceType.Gtable;            

              if (o != null)
                   dsType = (DataSourceType)o;

              switch (dsType)
              {
                  case DataSourceType.tableT:
                      return DataSourceTID;
                  case DataSourceType.tableR:
                      return DataSourceRID;
                  case DataSourceType.tableC:
                      return DataSourceCID;
                  default:
                      return DataSourceCID;
              }        
       }
</code></pre>

<p>For getting the datasourceid I wrote that code.But that gives the error as "Specified cast is not valid".This error is arise at <code>dsType=(DataSourceType)</code>o line.
Please give me any suggextions.</p>
