first at all thanks for reading =)
I have a situation here, i need to create a dynamic datagridview with a sql query.
for example:
I have a table called permissions and another called, user_permissions.
So i need to show a datagridview in this way: the checkbox obviously represnt if has the permission
User Perm1 Perm2 ... Perm n
Gaston (checkbox) (checkbox) (checkbox)
Pepe (checkbox) (checkbox) (checkbox)
So i think i need a dynamic datagrid... what i did till now was:
Make a query to bring all permissions and create a datatable adding those rows as columns, so i could create the datagrid's column propertly with the names and scroll-x (there are so many, a case sentence is not good for this)
but the problem appear when i tried to create a checbox into each column of each row for each user, i dont know how to:
For Each row As DataRow In dt_strSql.Rows
index = row("sis_codigo").ToString.Trim + row("prf_id").ToString.Trim
dt_aux.Columns.Add(index)
Next
dt_aux.Rows.Add()
For Each column As DataColumn In dt_aux.Columns
dt_aux.Rows(0)(column.ColumnName) = True
Next
dt_aux.AcceptChanges()
a1c_permisos_dinamico.DataSource = dt_aux
a1c_permisos_dinamico.DataBind()
For Each row As GridViewRow In Me.a1c_permisos_dinamico.Rows
For Each column As DataColumn In dt_aux.Columns
'here i need to transform the value "true" that i hardcoded above (just a test) 'into a chebox checked in each column of each row for each user
Next
Next