Hello All,
In my RadGrid, I have a template column of checkbox .
- If any checkbox is checked then click "delete" button to delete that row (just change status from 'Active' to 'Inactive', not delete that row from database),
the status of that rows must changed to 'Inactive' (First time, All of rows have 'Active' Status)
In Web controls I can code but in RadControl I can't because of I've never used these controls before.
Plz help me..
This is my code in aspx.vb
------------------------------------------------------------------------------------------------------
Protected Sub btnMultipleRowDelete_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim i As Integer = 0
For Each row As GridViewRow In GridView1.Rows
Dim MatId As String = Convert.ToString(GridView1.DataKeys(row.RowIndex).Value)
Dim checkbox As CheckBox = CType(row.FindControl("CheckBox1"), CheckBox)
If checkbox.Checked Then
i = i + 1
Dim a As String
a = GridView1.DataKeys(row.RowIndex).Values("MatStatus").ToString()
SqlMaterial.UpdateCommand = "Update Material SET [MatStatus] = 'Inactive' Where MatId ='" + MatId + "'"
SqlMaterial.Update()
Dim sb As New StringBuilder
sb.Append("<script type='text/javascript' language='javascript'>")
sb.Append("alert('Delete Complete');")
'sb.Append("document.location ='manageMatTypeData.aspx';")
sb.Append("</script>")
Page.ClientScript.RegisterStartupScript(Page.GetType, "RedirectScript", sb.ToString)
End If
Next row
If (i = 0) Then
Page.ClientScript.RegisterStartupScript(Page.GetType, "RedirectScript", "<script language='javascript'>alert('Please select the row you want to delete');</script>")
End If
End Sub
-------------------------------------------------------------------------------------------
Thanks very much,
Koi
In my RadGrid, I have a template column of checkbox .
- If any checkbox is checked then click "delete" button to delete that row (just change status from 'Active' to 'Inactive', not delete that row from database),
the status of that rows must changed to 'Inactive' (First time, All of rows have 'Active' Status)
In Web controls I can code but in RadControl I can't because of I've never used these controls before.
Plz help me..
This is my code in aspx.vb
------------------------------------------------------------------------------------------------------
Protected Sub btnMultipleRowDelete_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim i As Integer = 0
For Each row As GridViewRow In GridView1.Rows
Dim MatId As String = Convert.ToString(GridView1.DataKeys(row.RowIndex).Value)
Dim checkbox As CheckBox = CType(row.FindControl("CheckBox1"), CheckBox)
If checkbox.Checked Then
i = i + 1
Dim a As String
a = GridView1.DataKeys(row.RowIndex).Values("MatStatus").ToString()
SqlMaterial.UpdateCommand = "Update Material SET [MatStatus] = 'Inactive' Where MatId ='" + MatId + "'"
SqlMaterial.Update()
Dim sb As New StringBuilder
sb.Append("<script type='text/javascript' language='javascript'>")
sb.Append("alert('Delete Complete');")
'sb.Append("document.location ='manageMatTypeData.aspx';")
sb.Append("</script>")
Page.ClientScript.RegisterStartupScript(Page.GetType, "RedirectScript", sb.ToString)
End If
Next row
If (i = 0) Then
Page.ClientScript.RegisterStartupScript(Page.GetType, "RedirectScript", "<script language='javascript'>alert('Please select the row you want to delete');</script>")
End If
End Sub
-------------------------------------------------------------------------------------------
Thanks very much,
Koi