How i get eval command event from gridview inside datalist on save button click in vb.net My code is below problem occuring at this line
**> Dim AccountsGrid As GridView = > CType(e.Item.FindControl("AccountsGrid"), GridView)** What I have tried: Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Dim constr As String = ConfigurationManager.ConnectionStrings("WGFOLTP").ConnectionString Dim con As New SqlConnection(constr) Dim cmd As New SqlCommand() cmd.CommandType = CommandType.Text cmd.CommandText = "sp_permissionupdate" cmd.Connection = con con.Open() Dim AccountsGrid As GridView = CType(e.Item.FindControl("AccountsGrid"), GridView) For Each row2 As GridViewRow In AccountsGrid.Rows 'Dim id As Integer = Convert.ToInt32(AccountsGrid.DataKeys(row2.RowIndex).Values(0)) Dim lbl As Label = DirectCast(row2.FindControl("permissionid"), Label) Dim check As Boolean = TryCast(row2.FindControl("checkviews"), CheckBox).Checked Dim view As Boolean = TryCast(row2.FindControl("ischeck"), CheckBox).Checked Dim maker As Boolean = TryCast(row2.FindControl("ismarked"), CheckBox).Checked cmd.Parameters.Clear() 'cmd.Parameters.AddWithValue("@id", id) cmd.Parameters.AddWithValue("@roleid", rolesDropDownList.SelectedValue) cmd.Parameters.AddWithValue("@permissionid", lbl) cmd.Parameters.AddWithValue("@Ismaker", maker) cmd.Parameters.AddWithValue("@Ischeck", check) cmd.Parameters.AddWithValue("@ViewOnly", view) cmd.ExecuteNonQuery() con.Close() labelpop.Text = "Data is Updated" Next End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)