public partial class Form : System.Web.UI.Page
{
    private void connecttodb()
    {
        OracleConnection conn = new OracleConnection();
        conn.ConnectionString = "User Id=WLL; Password=wll; Data Source=WLL;";
     }
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!Page.IsPostBack)
        {
            String CommandText = "Select DepartmentID,Department from its_department;";
            OracleDataReader odr = GetDr(CommandText, ConnectionString);
            DropDownList1.DataSource = odr;
            DropDownList1.DataTextField ="Department";
            DropDownList1.DataValueField ="DepartmentID";
            DropDownList1.DataBind();
        }
   private OracleDataReader GetDr(String sqltext, String ConnectionString)
            {
              OracleDataReader dr;
              OracleConnection oracle_conn = new OracleConnection(ConnectionString);
              OracleCommand Oracle_cmd = new OracleCommand( sqltext, conn );
               Oracle_cmd.Connection.open();
              dr = Oracle_cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
              return dr;
            }
   
}

u have missed brace for partial class form

Add a braces before "private OracleDataReader GetDr(String sqltext, String ConnectionString)"

public partial class Form : System.Web.UI.Page
{
    private void connecttodb()
    {
        OracleConnection conn = new OracleConnection();
        conn.ConnectionString = "User Id=WLL; Password=wll; Data Source=WLL;";
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!Page.IsPostBack)
        {
            String CommandText = "Select DepartmentID,Department from its_department;";
            OracleDataReader odr = GetDr(CommandText, ConnectionString);
            DropDownList1.DataSource = odr;
            DropDownList1.DataTextField ="Department";
            DropDownList1.DataValueField ="DepartmentID";
            DropDownList1.DataBind();
        }
    }
    private OracleDataReader GetDr(String sqltext, String ConnectionString)
    {
        OracleDataReader dr;
        OracleConnection oracle_conn = new OracleConnection(ConnectionString);
        OracleCommand Oracle_cmd = new OracleCommand( sqltext, conn );
        Oracle_cmd.Connection.open();
        dr = Oracle_cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
        return dr;
    }
}

Issue was with brace ending Page_Load. General rule of thumb that I work with is to always ensure that when I open a brace I immediately close it and then start filling betwen the braces with my statements. This way I never forget to close a brace. Also, not sure if the posted code reflects your actual code but ensuring that tab stops are enforced (4 spaces per indent level) uniformly throughout your code makes it easier to spot and correct things like that.

Hope this helps :) Please remember to mark the thread solved once your issue is resolved.

Edit:

u have missed brace for partial class form

Incorrect but s'all good...

Add a braces before "private OracleDataReader GetDr(String sqltext, String ConnectionString)"

This was correct :twisted:

commented: well written and spot on +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.