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. Web Development
  3. ASP.NET
  4. I will created dynamic check boxes in panel but it losing the checked values when i reloads

I will created dynamic check boxes in panel but it losing the checked values when i reloads

Scheduled Pinned Locked Moved ASP.NET
databasehelptutorial
2 Posts 2 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.
  • H Offline
    H Offline
    haneef1
    wrote on last edited by
    #1

    I will created dynamic check boxes in panel but it losing the checked values when i reloads Example : no problem with bind data but when i click submit i need to reload the binddata() definitely other wise panel doesn't show any items. if i reload then checked values are losing when i calling the submit button. sub binddata() dim ds as dataset // here i will take data source from which from database. Try ds=obj.GetSource() For index = 0 To ds.Tables(0).Rows.Count - 1 chklist = New CheckBox chklist.Text = ds.Tables(0).Rows(index).Item(0).ToString chklist.ID = ds.Tables(0).Rows(index).Item(0).ToString chklist.EnableViewState = True Panel1.Controls.Add(chklist) Panel1.Controls.Add(New LiteralControl(" ")) Next end sub problem below when i reloads the databind(). but i need to be definitely reloads the databind other wist panel doen't show any thing Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submit.Click While index < ds.Tables(0).Rows.Count DisplayPanel = CType(FindControl("panel1"), Panel) chklist1 = CType(DisplayPanel.FindControl(ds.Tables(0).Rows(index).Item(0).ToString), CheckBox) If Not chklist1 Is Nothing Then chklist1.Text = ds.Tables(0).Rows(index).Item(0).ToString If chklist1.Checked = True Then //here showing that not checking even thought i will check check boxes objWeb.Addid(drlist.SelectedItem.Value, chklist1.ID) End If End If index = index + 1 End While end sub this is haneef

    this is haneef

    N 1 Reply Last reply
    0
    • H haneef1

      I will created dynamic check boxes in panel but it losing the checked values when i reloads Example : no problem with bind data but when i click submit i need to reload the binddata() definitely other wise panel doesn't show any items. if i reload then checked values are losing when i calling the submit button. sub binddata() dim ds as dataset // here i will take data source from which from database. Try ds=obj.GetSource() For index = 0 To ds.Tables(0).Rows.Count - 1 chklist = New CheckBox chklist.Text = ds.Tables(0).Rows(index).Item(0).ToString chklist.ID = ds.Tables(0).Rows(index).Item(0).ToString chklist.EnableViewState = True Panel1.Controls.Add(chklist) Panel1.Controls.Add(New LiteralControl(" ")) Next end sub problem below when i reloads the databind(). but i need to be definitely reloads the databind other wist panel doen't show any thing Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submit.Click While index < ds.Tables(0).Rows.Count DisplayPanel = CType(FindControl("panel1"), Panel) chklist1 = CType(DisplayPanel.FindControl(ds.Tables(0).Rows(index).Item(0).ToString), CheckBox) If Not chklist1 Is Nothing Then chklist1.Text = ds.Tables(0).Rows(index).Item(0).ToString If chklist1.Checked = True Then //here showing that not checking even thought i will check check boxes objWeb.Addid(drlist.SelectedItem.Value, chklist1.ID) End If End If index = index + 1 End While end sub this is haneef

      this is haneef

      N Offline
      N Offline
      Naveed Kamboh
      wrote on last edited by
      #2

      Hi Hafneef, Are you saving values of check box i.e in database or XML file . You need to save check box values and when you reload them dynamically then you need to put those values into check boxes. Tip: Check if you are missing "Ispostback"

      Naveed Kamboh Complexity kills, Write easy code for your self. isolutionteam

      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