Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserDetailsScreen.aspx.cs" Inherits="website4_UserDetailsForm" %>
namespace website4


using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Drawing;
using System.Data;
{
    public class UserDetailsForm
    {
Posted
Updated 27-Feb-13 8:56am
v2

Move the namespace line to after the using lines, or move the using statements to after the open curly bracket. But it's more normal to have the using lines first in the file.

[edit]Typo: "noamrl" for "normal" - OrignalGriff[/edit]
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 27-Feb-13 17:50pm    
This is not fully accurate.

OP's was different. Did not know that the syntax with "using" inside namespace is valid, and "ideologically" important? OP's bug is brackets, not order...
Please see my answer.

—SA
The code of Solution 2 is correct, but this is not the only option. You problem is not "before" or "after", but brackets. You also can do:

C#
namespace website4 {
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

//...
} // namespace website4


Don't forget to remove unused "using"; Visual Studio has a menu item for that... And before it, don't forget to removed unused references.

—SA
 
Share this answer
 
namespace should after Using Statement

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace website4
{
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 27-Feb-13 17:48pm    
My 4. This code sample is correct, but the bug of OP was different. Perhaps you did not know it, but the syntax with "using" inside namespace is valid, and "ideologically" important.
Please see my answer. I of course credited your code.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900