ASP Net Controls ASP.Net Tutorial

<%@ Page Language="C#" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>

    SqlDataReader myReader;
    
    void Page_Load(object sender, EventArgs e)
    {
       string ConnectionString = Convert.ToString(ConfigurationSettings.AppSettings["MSDEConnectString"]);
    
       SqlConnection myConnection = new SqlConnection(ConnectionString);
       SqlCommand myCommand = new SqlCommand();
       myCommand.Connection = myConnection;
    
       try {
          myConnection.Open();
          if (!(Page.IsPostBack)) {
             myCommand.CommandText = "SELECT PublisherID, PublisherName FROM Publisher";
             myReader = myCommand.ExecuteReader();
             ListBox1.DataBind();
             myReader.Close();
          } else {
             myCommand.CommandText = "SELECT * FROM Book WHERE BookPublisherID=" + ListBox1.SelectedItem.Value;
             myReader = myCommand.ExecuteReader();
             DataGrid1.DataSource = myReader;
             DataGrid1.DataBind();
             myReader.Close();
          }
       } catch (Exception ex) {
          throw (ex);
       } finally {
          myConnection.Close();
       }
    }





    
        

A RadioButtonList 
        


            ">
        

A DropDownList 
        


            ">
        

A ListBox 
        


            " Rows="5">
            
            
                
                
                
                
                
            
    


File: Web.config