Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Accessing a row of data

Accessing a row of data

Scheduled Pinned Locked Moved C#
questioncsharpasp-nethelp
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    brian55
    wrote on last edited by
    #1

    I have finally solved my dropdownlist databinding issue....Next prolem. I now have a selected value. That value correpsopnds to a row of data. How do I access this data? Here is my code. Thanks in advance private void Page_Load(object sender, System.EventArgs e) { // Create a DropDownList control. DropDownList DropList = new DropDownList(); // Set the properties for the DropDownList control. DropList.ID = "AirportList"; DropList.AutoPostBack = true; // Manually register the event-handling method for the // SelectedIndexChanged event. DropList.SelectedIndexChanged += new EventHandler(this.Selection_Change); oleDbDataAdapter1.Fill(dsn_AirportList1,"tblAirport"); Session["DSN_AirportList"] = dsn_AirportList1; DropList.DataSource = dsn_AirportList1; // DropList.DataTextField = "AirportName"; // Bind the data to the control. DropList.DataBind(); // Set the default selected item when the page is first loaded. if(!IsPostBack) { DropList.SelectedIndex = 0; } // Add the DropDownList control to the Controls collection of // the PlaceHolder control. PlaceHolder1.Controls.Add(DropList); } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter(); this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand(); this.oleDbConnection2 = new System.Data.OleDb.OleDbConnection(); this.dsn_AirportList1 = new DSN_AirportList(); ((System.ComponentModel.ISupportInitialize)(this.dsn_AirportList1)).BeginInit(); // // oleDbDataAdapter1 // this.oleDbDataAdapter1.SelectCommand = this.oleDbSelectCommand1; this.oleDbDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "tblAirport", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("AirportCode", "AirportCode"), new System.Data.Common.DataC

    B 1 Reply Last reply
    0
    • B brian55

      I have finally solved my dropdownlist databinding issue....Next prolem. I now have a selected value. That value correpsopnds to a row of data. How do I access this data? Here is my code. Thanks in advance private void Page_Load(object sender, System.EventArgs e) { // Create a DropDownList control. DropDownList DropList = new DropDownList(); // Set the properties for the DropDownList control. DropList.ID = "AirportList"; DropList.AutoPostBack = true; // Manually register the event-handling method for the // SelectedIndexChanged event. DropList.SelectedIndexChanged += new EventHandler(this.Selection_Change); oleDbDataAdapter1.Fill(dsn_AirportList1,"tblAirport"); Session["DSN_AirportList"] = dsn_AirportList1; DropList.DataSource = dsn_AirportList1; // DropList.DataTextField = "AirportName"; // Bind the data to the control. DropList.DataBind(); // Set the default selected item when the page is first loaded. if(!IsPostBack) { DropList.SelectedIndex = 0; } // Add the DropDownList control to the Controls collection of // the PlaceHolder control. PlaceHolder1.Controls.Add(DropList); } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter(); this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand(); this.oleDbConnection2 = new System.Data.OleDb.OleDbConnection(); this.dsn_AirportList1 = new DSN_AirportList(); ((System.ComponentModel.ISupportInitialize)(this.dsn_AirportList1)).BeginInit(); // // oleDbDataAdapter1 // this.oleDbDataAdapter1.SelectCommand = this.oleDbSelectCommand1; this.oleDbDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "tblAirport", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("AirportCode", "AirportCode"), new System.Data.Common.DataC

      B Offline
      B Offline
      brian55
      wrote on last edited by
      #2

      I figured it out......Too easy!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups