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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Use Findcontrol

Use Findcontrol

Scheduled Pinned Locked Moved C#
helpdatabasequestion
2 Posts 2 Posters 1 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.
  • P Offline
    P Offline
    pariisa
    wrote on last edited by
    #1

    hi, help me... in my Asp project, there is 80 RadioButton in the Default.aspx page. I want to set the All text of RadioButton from My DataBase. I select a Data table from My DataBase with 80 rows. But I don`t Want to set Text with this format : RadioButton1.Text = dt.Rows[0][0]; RadioButton2.Text = dt.Rows[0][1]; . . . RadioButton80 .Text = dt.Rows[0][0]; I want to Use this codes : RadioButton rb; for(int i=1 ; i < 81 ; i++) { rb = (RadioButton)this.FindControl("RadioButton" + i ); rb.Text= dt.Rows[0][i].ToString(); } But there is error with Details : Object reference not set to an instance of an object. why??? please help me to find correct way.

    L 1 Reply Last reply
    0
    • P pariisa

      hi, help me... in my Asp project, there is 80 RadioButton in the Default.aspx page. I want to set the All text of RadioButton from My DataBase. I select a Data table from My DataBase with 80 rows. But I don`t Want to set Text with this format : RadioButton1.Text = dt.Rows[0][0]; RadioButton2.Text = dt.Rows[0][1]; . . . RadioButton80 .Text = dt.Rows[0][0]; I want to Use this codes : RadioButton rb; for(int i=1 ; i < 81 ; i++) { rb = (RadioButton)this.FindControl("RadioButton" + i ); rb.Text= dt.Rows[0][i].ToString(); } But there is error with Details : Object reference not set to an instance of an object. why??? please help me to find correct way.

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      pariisa wrote:

      rb.Text= dt.Rows[0][i].ToString();

      i-1 please read and apply my sig !

      Luc Pattyn [Forum Guidelines] [My Articles]


      this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


      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