Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
<%@ 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 27-Feb-13 8:43am
Edited 27-Feb-13 8:56am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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]
  Permalink  
v2
Comments
Sergey Alexandrovich Kryukov at 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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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:
 
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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

namespace should after Using Statement
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace website4
{
  Permalink  
Comments
Sergey Alexandrovich Kryukov at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 6,745
1 OriginalGriff 6,696
2 CPallini 5,315
3 George Jonsson 3,599
4 Gihan Liyanage 2,650


Advertise | Privacy | Mobile
Web01 | 2.8.140922.1 | Last Updated 27 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100