473,479 Members | 2,060 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

'System.Web.UI.WebControls.SortDirection' is a 'type' but is use

I'm trying to use this malformed code from:
http://forums.asp.net/thread/1384075.aspx

In this method, I get the error:

Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS0118: 'System.Web.UI.WebControls.SortDirection' is
a 'type' but is used like a 'variable'

Source Error:

Line 32: string newSortDirection = String.Empty;
Line 33:
Line 34: switch (SortDirection)
Line 35: {
Line 36: case SortDirection.Ascending
private string ConvertSortDirectionToSql(SortDirection sortDireciton)
{
string newSortDirection = String.Empty;

switch (SortDirection)
{
case SortDirection.Ascending:
newSortDirection = "ASC";
break;

case SortDirection.Descending:
newSortDirection = "DESC";
break;
}

return newSortDirection;
}
--
dba123
Aug 29 '06 #1
2 4330

dba123 wrote:
I'm trying to use this malformed code from:
http://forums.asp.net/thread/1384075.aspx

In this method, I get the error:

Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS0118: 'System.Web.UI.WebControls.SortDirection' is
a 'type' but is used like a 'variable'

Source Error:

Line 32: string newSortDirection = String.Empty;
Line 33:
Line 34: switch (SortDirection)
Line 35: {
Line 36: case SortDirection.Ascending
private string ConvertSortDirectionToSql(SortDirection sortDireciton)
{
string newSortDirection = String.Empty;

switch (SortDirection)
{
case SortDirection.Ascending:
newSortDirection = "ASC";
break;

case SortDirection.Descending:
newSortDirection = "DESC";
break;
}

return newSortDirection;
}
Well, apart from the fact that "sortDirection" is spelled wrong on the
following line:

private string ConvertSortDirectionToSql(SortDirection sortDireciton)
{
string newSortDirection = String.Empty;

switch (SortDirection)
{

the most likely cause is that C# is case-sensitive, so

switch (SortDirection)

is referring to the SortDirection type, whereas

switch (sortDirection)

would refer to the parameter, which is what you want.

Aug 29 '06 #2
Yea, that was it. They spelled it wrong. small s not S
--
dba123
"Bruce Wood" wrote:
>
dba123 wrote:
I'm trying to use this malformed code from:
http://forums.asp.net/thread/1384075.aspx

In this method, I get the error:

Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS0118: 'System.Web.UI.WebControls.SortDirection' is
a 'type' but is used like a 'variable'

Source Error:

Line 32: string newSortDirection = String.Empty;
Line 33:
Line 34: switch (SortDirection)
Line 35: {
Line 36: case SortDirection.Ascending
private string ConvertSortDirectionToSql(SortDirection sortDireciton)
{
string newSortDirection = String.Empty;

switch (SortDirection)
{
case SortDirection.Ascending:
newSortDirection = "ASC";
break;

case SortDirection.Descending:
newSortDirection = "DESC";
break;
}

return newSortDirection;
}

Well, apart from the fact that "sortDirection" is spelled wrong on the
following line:

private string ConvertSortDirectionToSql(SortDirection sortDireciton)
{
string newSortDirection = String.Empty;

switch (SortDirection)
{

the most likely cause is that C# is case-sensitive, so

switch (SortDirection)

is referring to the SortDirection type, whereas

switch (sortDirection)

would refer to the parameter, which is what you want.

Aug 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5644
by: Luis Esteban Valencia | last post by:
A page let of work for me I commented almost all lines but nothing the code is this
2
3077
by: TR | last post by:
Is it possible to use Type.GetType(...) with the types in the System.Web.UI.? My attempts always resolve to Nothing. Is this legal, or is the Web.UI assembly of the kind Type.GetType doesn't...
6
14532
by: Tim Cartwright | last post by:
I have a page that has the login control on it, nothing else. This page inherits from a master page, neither page has any code in it. This page works perfectly when running on the WebDev debug web...
2
2640
by: Sean Carey | last post by:
I converted a C# Upload app to VB.NET and am down to one error and was hoping someone could help me with te error. I would greatly appreciate help from anyone. Here is the error: ...
6
7187
by: Arthur Dent | last post by:
How do you sort a generic collection derived from System.Collections.ObjectModel.Collection? Thanks in advance, - Arthur Dent
0
4319
by: Jim Duffie | last post by:
Hi, I am trying to build a simple websire using the above in Visual Web Developer. When finished I have build the website and it works fine locally but when I FTP it to the server I am getting a...
0
2993
by: DC | last post by:
Why would this code give me the error "Could not load type System.Web.UI.WebControls.AccessDataSource from assembly System.Web, Version=1.0.5000.0" at line 16... <form id="form1"...
14
2128
by: Ronald S. Cook | last post by:
I'm just curious how you would handle this. In the cable industry, Comcast is referred to as an "MSO" (multiple systems operator) meaning they own many cable systems. Therefore a solution must be...
5
8276
by: Henry Stock | last post by:
I am trying to understand the following error: Any thing you can tell me about this is appreciated. Security Exception Description: The application attempted to perform an operation not allowed...
0
7033
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6903
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7027
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4763
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
2987
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
557
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.