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. datagridview + edititemtemplate + checkbox [modified]

datagridview + edititemtemplate + checkbox [modified]

Scheduled Pinned Locked Moved C#
htmldatabasehelpannouncement
4 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.
  • R Offline
    R Offline
    RanjithLogics
    wrote on last edited by
    #1

    hi .. I cant update the value in checkbox (which is in an edititem template) to database.My html code is When i save using gridview update, null values are saved in the database. I am using sqldatasource. My database field is INT. plz help. Thanks in advance -- modified at 5:37 Monday 14th May, 2007 Ranjith Stephen

    P 1 Reply Last reply
    0
    • R RanjithLogics

      hi .. I cant update the value in checkbox (which is in an edititem template) to database.My html code is When i save using gridview update, null values are saved in the database. I am using sqldatasource. My database field is INT. plz help. Thanks in advance -- modified at 5:37 Monday 14th May, 2007 Ranjith Stephen

      P Offline
      P Offline
      Panchal Hardik
      wrote on last edited by
      #2

      This is vb code transfer in C# Protected Sub dgAdminList_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles dgAdminList.RowUpdating Dim intActiveStatus as integer Dim ChkActiveTemp As CheckBox ChkActiveTemp = dgAdminList.Rows(e.RowIndex).FindControl("chkActive") If ChkActiveTemp.Checked Then intActiveStatus = 1 Else intAdminStatus = 0 End If end sub

      R 2 Replies Last reply
      0
      • P Panchal Hardik

        This is vb code transfer in C# Protected Sub dgAdminList_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles dgAdminList.RowUpdating Dim intActiveStatus as integer Dim ChkActiveTemp As CheckBox ChkActiveTemp = dgAdminList.Rows(e.RowIndex).FindControl("chkActive") If ChkActiveTemp.Checked Then intActiveStatus = 1 Else intAdminStatus = 0 End If end sub

        R Offline
        R Offline
        RanjithLogics
        wrote on last edited by
        #3

        Thank you very much for the code. I used updating event of the sql datasource for setting the parameters again.(checkbox field parameter only )..and it worked..:) Thanks again for the reply..

        Ranjith Stephen

        1 Reply Last reply
        0
        • P Panchal Hardik

          This is vb code transfer in C# Protected Sub dgAdminList_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles dgAdminList.RowUpdating Dim intActiveStatus as integer Dim ChkActiveTemp As CheckBox ChkActiveTemp = dgAdminList.Rows(e.RowIndex).FindControl("chkActive") If ChkActiveTemp.Checked Then intActiveStatus = 1 Else intAdminStatus = 0 End If end sub

          R Offline
          R Offline
          RanjithLogics
          wrote on last edited by
          #4

          My code is protected void SQL_DS_Updating(object sender, SqlDataSourceCommandEventArgs e) { if (e.Command.Parameters["@IMPA"].Value.ToString() == "True") e.Command.Parameters["@IMPA"].Value = true; else e.Command.Parameters["@IMPA"].Value = false; } I've changed my database field to 'BIT' :)

          Ranjith Stephen

          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