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