Hello
I have a radgrid, there I have a nestedview with two-TAB controls and within
each tab a repeater control with a checkbox that tells me whether or not
selected an option from my database.
Since the option ItemCommand make it along the repeater and enable or disable the
options with the checkbox, my problem is how do I get each time
checkbox event access Oncheckedchangued return me the id code
grid and the repeater control to scroll it and store control
changes in my database.
I have an option that is to place a button and using the property commandname
ItemCommand capturing the event and do my validations and
routes, not if you have a more direct option to control
checkbox inside the repeater and nestedview.
Thanks
Alex Alfonso
Code ----------
Code Behind to Itemcommand
I have a radgrid, there I have a nestedview with two-TAB controls and within
each tab a repeater control with a checkbox that tells me whether or not
selected an option from my database.
Since the option ItemCommand make it along the repeater and enable or disable the
options with the checkbox, my problem is how do I get each time
checkbox event access Oncheckedchangued return me the id code
grid and the repeater control to scroll it and store control
changes in my database.
I have an option that is to place a button and using the property commandname
ItemCommand capturing the event and do my validations and
routes, not if you have a more direct option to control
checkbox inside the repeater and nestedview.
Thanks
Alex Alfonso
Code ----------
<
telerik:RadGrid
ID
=
"RadGridSedes"
runat
=
"server"
AllowPaging
=
"True"
AllowSorting
=
"True"
AutoGenerateColumns
=
"False"
GridLines
=
"None"
DataSourceID
=
"OpenAccessDataSedes"
>
<
ExportSettings
ExportOnlyData
=
"True"
>
</
ExportSettings
>
<
MasterTableView
DataKeyNames
=
"CodigoSede"
DataSourceID
=
"OpenAccessDataSedes"
CommandItemDisplay
=
"TopAndBottom"
>
<
CommandItemSettings
AddNewRecordText
=
"Adicionar Nuevo Registro"
RefreshText
=
"Actualizar"
/>
<
RowIndicatorColumn
Visible
=
"True"
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
Visible
=
"True"
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"CodigoSede"
DataType
=
"System.Int32"
HeaderText
=
"Codigo Sede"
ReadOnly
=
"True"
SortExpression
=
"CodigoSede"
UniqueName
=
"CodigoSede"
Visible
=
"false"
>
</
telerik:GridBoundColumn
>
<
telerik:GridClientSelectColumn
UniqueName
=
"ClientSelectColumn"
>
<
HeaderStyle
Width
=
"30px"
/>
</
telerik:GridClientSelectColumn
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
UniqueName
=
"Editcommandcolumn"
>
<
HeaderStyle
Width
=
"30px"
/>
</
telerik:GridEditCommandColumn
>
<
telerik:GridBoundColumn
DataField
=
"Nombre"
HeaderText
=
"Nombre"
SortExpression
=
"Nombre"
UniqueName
=
"Nombre"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Direccion"
HeaderText
=
"Direccion"
SortExpression
=
"Direccion"
UniqueName
=
"Direccion"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Email"
HeaderText
=
"Email"
SortExpression
=
"Email"
UniqueName
=
"Email"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Telefono1"
HeaderText
=
"Telefono1"
SortExpression
=
"Telefono1"
UniqueName
=
"Telefono1"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Fax1"
HeaderText
=
"Fax1"
SortExpression
=
"Fax1"
UniqueName
=
"Fax1"
>
</
telerik:GridBoundColumn
>
</
Columns
>
<
EditFormSettings
EditFormType
=
"WebUserControl"
UserControlName
=
"AddEditSedes.ascx"
>
</
EditFormSettings
>
<
NestedViewTemplate
>
<
div
class
=
"Centrado"
>
<
telerik:RadTabStrip
ID
=
"RadTabStrip2"
runat
=
"server"
SelectedIndex
=
"0"
MultiPageID
=
"RadMultiPageSed"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Jornadas"
ImageUrl
=
"~/images/Jornadas.png"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Semestres"
ImageUrl
=
"~/images/Semestres.png"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTabStrip
>
<
telerik:RadMultiPage
ID
=
"RadMultiPageSed"
runat
=
"server"
Width
=
"100%"
SelectedIndex
=
"0"
>
<
telerik:RadPageView
ID
=
"RadPageViewJornadas"
runat
=
"server"
>
<
telerik:OpenAccessDataSource
ID
=
"OpenAccessJornadas"
runat
=
"server"
EnableDelete
=
"False"
EnableInsert
=
"False"
EnableUpdate
=
"False"
ObjectContextProvider
=
"ServisistemasAra.FoxisWeb.TelerikOrm.AcademicoEntityDiagrams, ServisistemasAra.FoxisWeb.TelerikOrm"
TypeName
=
"ServisistemasAra.FoxisWeb.TelerikOrm.Jornadas"
OrderBy
=
"Descripcion"
Where
=
""
>
</
telerik:OpenAccessDataSource
>
<
asp:Repeater
ID
=
"JornadasList"
runat
=
"server"
DataSourceID
=
"OpenAccessJornadas"
>
<
ItemTemplate
>
<
asp:CheckBox
runat
=
"server"
ID
=
"RoleCheckBoxJornadas"
AutoPostBack
=
"true"
Text='<%# eval("descripcion") %>' OnCheckedChanged="JornadasCheckBox_CheckChanged" />
<
br
/>
</
ItemTemplate
>
</
asp:Repeater
>
</
telerik:RadPageView
>
<
telerik:RadPageView
ID
=
"RadpageviewSem"
runat
=
"server"
>
<
div
class
=
"Centrado"
>
<
ul
class
=
"uledicion"
>
<
li
>
<
asp:Label
runat
=
"server"
ID
=
"LblSedeJornadaSemestre"
CssClass
=
"labelsedicion width130"
Text
=
"Seleccione la jornada"
></
asp:Label
>
<
telerik:RadComboBox
ID
=
"ComboSedeJornadas"
runat
=
"server"
Width
=
"220px"
DataTextField
=
"Descripcion"
DataValueField
=
"Codigo"
AppendDataBoundItems
=
"true"
>
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Text='<%$ Resources:General, SeleccioneOpcion %>'
Value="0" Selected="true" />
</
Items
>
</
telerik:RadComboBox
>
<
asp:Button
ID
=
"ButConsulta"
runat
=
"server"
Text
=
"Consultar"
CommandName
=
"ConsultaSemestres"
/>
</
li
>
</
ul
>
<
asp:Repeater
ID
=
"RepeaterSedesJornadasSemestres"
runat
=
"server"
DataSourceID
=
"OpenAccessDataSemestres"
Visible
=
"false"
>
<
ItemTemplate
>
<
asp:CheckBox
runat
=
"server"
ID
=
"RoleCheckBoxSemestres"
AutoPostBack
=
"true"
Text='<%# eval("descripcion") %>' OnCheckedChanged="SemestresCheckBox_CheckChanged" />
<
br
/>
</
ItemTemplate
>
</
asp:Repeater
>
</
div
>
</
telerik:RadPageView
>
</
telerik:RadMultiPage
>
</
div
>
</
NestedViewTemplate
>
<
PagerStyle
FirstPageToolTip
=
"Primera Página"
LastPageToolTip
=
"Ultima Página"
NextPagesToolTip
=
"Siguientes Páginas"
NextPageToolTip
=
"Siguiente Página"
PagerTextFormat="Cambiar Página: {4} Página <strong>{0}</
strong
> de <
strong
>{1}</
strong
>, items <
strong
>{2}</
strong
> de <
strong
>{3}</
strong
> de <
strong
>{5}</
strong
>."
PrevPagesToolTip="Páginas anteriores" PrevPageToolTip="Página anterior" />
</
MasterTableView
>
<
ClientSettings
EnableRowHoverStyle
=
"true"
>
<
Selecting
AllowRowSelect
=
"True"
/>
<
Resizing
AllowRowResize
=
"True"
AllowColumnResize
=
"True"
></
Resizing
>
</
ClientSettings
>
</
telerik:RadGrid
>
Code Behind to Itemcommand
Protected
Sub
RadGridSedes_ItemCommand(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
RadGridSedes.ItemCommand
If
e.CommandName = RadGrid.ExpandCollapseCommandName
Then
If
e.Item.Expanded =
False
Then
'Es expandcollapseName
Dim
SedeId
As
String
= e.Item.OwnerTableView.Items(e.Item.ItemIndex)(
"CodigoSede"
).Text
Dim
JornadasXSede
As
List(Of VJornadasBySedes)
JornadasXSede = (From Sj
In
CachedScope.VJornadasBySedes() Where Sj.Sede = SedeId
Select
Sj).ToList
If
Not
JornadasXSede
Is
Nothing
Then
Dim
Repeatlista
As
Repeater =
DirectCast
(e.Item, GridDataItem).ChildItem.FindControl(
"JornadasList"
)
For
Each
ri
As
RepeaterItem
In
Repeatlista.Items
' Programmatically reference the CheckBox
Dim
RoleCheckBox
As
CheckBox = TryCast(ri.FindControl(
"RoleCheckBoxJornadas"
), CheckBox)
' See if RoleCheckBox.Text is in selectedUsersRoles
Dim
TmpRole = RoleCheckBox.Text
For
Each
SedesyJornadas
As
VJornadasBySedes
In
JornadasXSede
If
SedesyJornadas.Descripcion = TmpRole
Then
RoleCheckBox.Checked =
True
End
If
Next
Next
End
If
'Adicionamos las jornadas en el combo
Dim
MisJornadasxsede = (From VJS
In
CachedScope.VJornadasBySedes() Where VJS.Sede = SedeId
Select
VJS).ToList()
Dim
CboSedesJornadas
As
RadComboBox =
DirectCast
(e.Item, GridDataItem).ChildItem.FindControl(
"ComboSedeJornadas"
)
CboSedesJornadas.DataSource = MisJornadasxsede
CboSedesJornadas.DataBind()
End
If
End
If
If
e.CommandName =
"ConsultaSemestres"
Then
Dim
nestedview
As
GridNestedViewItem =
DirectCast
(e.Item, GridNestedViewItem)
Dim
RadcboSede
As
RadComboBox =
DirectCast
(nestedview.FindControl(
"ComboSedeJornadas"
), RadComboBox)
Dim
JornadaID
As
Integer
= RadcboSede.SelectedValue
Dim
LSedesJornadasSemestres
As
List(Of VSemestresByJornadas)
LSedesJornadasSemestres = (From Sj
In
CachedScope.VSemestresByJornadas() Where Sj.Jornada = JornadaID
Select
Sj).ToList
If
Not
LSedesJornadasSemestres
Is
Nothing
Then
Dim
RepeatSemestres
As
Repeater =
DirectCast
(nestedview.FindControl(
"RepeaterSedesJornadasSemestres"
), Repeater)
RepeatSemestres.Visible =
True
For
Each
ri
As
RepeaterItem
In
RepeatSemestres.Items
' Programmatically reference the CheckBox
Dim
SemestreCheckBox
As
CheckBox = TryCast(ri.FindControl(
"RoleCheckBoxSemestres"
), CheckBox)
SemestreCheckBox.Checked =
False
' See if RoleCheckBox.Text is in selectedUsersRoles
Dim
TmpSemestre = SemestreCheckBox.Text
For
Each
SemestresxJornadas
As
VSemestresByJornadas
In
LSedesJornadasSemestres
If
SemestresxJornadas.Descripcion = TmpSemestre
Then
SemestreCheckBox.Checked =
True
End
If
Next
Next
End
If
End
If
End
Sub