I have the same problem, I'm getting dynamic text boxes in the <formtemplate>, but when I want to access the controls in the ItemCommand, the panel is empty .
please i need an idea. Thankyou
<telerik:RadGrid runat=
"server"
Id=
"grdConceptos"
skin=
"Outlook"
EnableEmbeddedSkins=
"False"
DataSourceID=
"SqlEquipos"
AllowPaging=
"True"
PageSize=
"20"
AllowSorting=
"True"
AutoGenerateColumns=
"False"
Culture=
"es-MX"
TableLayout=
"Fixed"
ShowStatusBar=
"true"
AllowAutomaticDeletes=
"True"
AllowAutomaticInserts=
"True"
AllowAutomaticUpdates=
"True"
Width=
"100%"
EnableViewState=
"true"
>
<MasterTableView CommandItemDisplay=
"TopAndBottom"
GridLines=
"None"
InsertItemPageIndexAction=
"ShowItemOnCurrentPage"
DataSourceID=
"SqlEquipos"
DataKeyNames=
"IdEquipo"
AllowFilteringByColumn=
"true"
AllowSorting=
"True"
>
<CommandItemTemplate>
......
</CommandItemTemplate>
<columns>
....
</columns>
<EditFormSettings EditFormType=
"Template"
>
<FormTemplate>
<table style=
"width: 100%;"
>
<tr>
<td colspan=
"2"
class=
"titulo2"
>
<br /> Edición del equipo:
<asp:Label ID=
"lbIdEquipo"
Text=
'<%# Bind("IdEquipo") %>' runat="server" Width="70px"/>
<br /><br />
</td>
</tr>
<tr>
<td class=
"tipografiaBOLD"
>
<span style=
"color:Red"
> *</span> Cliente:
</td>
<td>
<telerik:RadComboBox ID=
"ddlCliente"
DataSourceID=
"SqlCliente"
DataTextField=
"Nombre"
DataValueField=
"IdCliente"
Height=
"300px"
AppendDataBoundItems=
"true"
AllowCustomText=
"True"
Filter=
"Contains"
SelectedValue=
'<%# Bind("IdCliente") %>'
runat=
"server"
ShowMoreResultsBox=
"true"
EnableLoadOnDemand=
"true"
EnableVirtualScrolling=
"true"
Width=
"350px"
>
<Items>
<telerik:RadComboBoxItem Text=
"Seleccionar..."
value=
""
/>
</Items>
</telerik:RadComboBox>
</td>
</tr>
<tr>
<td class=
"tipografiaBOLD"
>
<span style=
"color:Red"
> *</span> Unidad:
</td>
<td>
<telerik:RadComboBox ID=
"ddlUnidad"
DataSourceID=
"SqlUnidad"
DataTextField=
"Unidad"
DataValueField=
"IdUnidad"
Height=
"300px"
AppendDataBoundItems=
"true"
AllowCustomText=
"True"
Filter=
"Contains"
SelectedValue=
'<%# Bind("IdUnidad") %>'
runat=
"server"
ShowMoreResultsBox=
"true"
EnableLoadOnDemand=
"true"
EnableVirtualScrolling=
"true"
Width=
"100px"
>
<Items>
<telerik:RadComboBoxItem Text=
"Seleccionar..."
value=
""
/>
</Items>
</telerik:RadComboBox>
</td>
</tr>
<tr>
<td class=
"tipografiaBOLD"
>
<span style=
"color:Red"
> *</span> Marca:
</td>
<td>
<telerik:RadComboBox ID=
"ddlMarca"
DataSourceID=
"SqlMarca"
DataTextField=
"Marca"
DataValueField=
"IdMarca"
Height=
"300px"
AppendDataBoundItems=
"true"
AllowCustomText=
"True"
Filter=
"Contains"
SelectedValue=
'<%# Bind("IdMarca") %>'
runat=
"server"
ShowMoreResultsBox=
"true"
EnableLoadOnDemand=
"true"
EnableVirtualScrolling=
"true"
Width=
"250px"
>
<Items>
<telerik:RadComboBoxItem Text=
"Seleccionar..."
value=
""
/>
</Items>
</telerik:RadComboBox>
</td>
</tr>
<tr>
<td class=
"tipografiaBOLD"
>
<span style=
"color:Red"
> *</span> Tipo de Equipo:
</td>
<td>
<telerik:RadComboBox ID=
"ddlTipoEquipo"
DataSourceID=
"SqlTipoEquipo"
DataTextField=
"TipoEquipo"
DataValueField=
"IdTipoEquipo"
Height=
"300px"
AppendDataBoundItems=
"true"
AllowCustomText=
"True"
Filter=
"Contains"
SelectedValue=
'<%# Bind("IdTipoEquipo") %>'
runat=
"server"
ShowMoreResultsBox=
"true"
EnableLoadOnDemand=
"true"
EnableVirtualScrolling=
"true"
Width=
"150px"
>
<Items>
<telerik:RadComboBoxItem Text=
"Seleccionar..."
value=
""
/>
</Items>
</telerik:RadComboBox>
</td>
</tr>
<tr>
<td colspan=
"2"
>
</td>
</tr>
</table>
<asp:Panel ID=
"ctrlDynamic"
runat =
"server"
></asp:Panel>
<asp:Button ID=
"btnActualizar"
Text=
'<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insertar", "Actualizar") %>'
runat=
"server"
CommandName=
'<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'></asp:Button>
<asp:Button ID=
"btnCancelar"
Text=
"Cancelar"
runat=
"server"
CausesValidation=
"False"
CommandName=
"Cancel"
></asp:Button>
<br /><br />
</FormTemplate>
</EditFormSettings>
</MasterTableView>
</telerik:Radgrid>
Protected
Sub
grdConceptos_ItemDataBound(
ByVal
source
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridItemEventArgs)
Handles
grdConceptos.ItemDataBound
If
(
TypeOf
e.Item
Is
GridEditFormItem
And
e.Item.IsInEditMode)
Then
Dim
editItem
As
GridEditFormItem =
DirectCast
(e.Item, GridEditFormItem)
IdTipoEquipo =
DirectCast
(editItem.FindControl(
"ddlTipoEquipo"
), RadComboBox).SelectedValue
IdEquipo =
DirectCast
(editItem.FindControl(
"lbIdEquipo"
), Label).Text.Trim()
ctrlDynamic =
DirectCast
(editItem.FindControl(
"ctrlDynamic"
), Panel)
Dim
colEq
As
oColumna =
New
oColumna()
Dim
listaCol
As
List(Of oColumna) =
New
List(Of oColumna)
Dim
datos
As
List(Of
String
) =
New
List(Of
String
)
listaCol = colEq.ObtieneColumnasEquipoValor(IdEquipo, sesion.IdLaboratorio)
Dim
tbl
As
Table =
New
Table()
For
i
As
Integer
= 0
To
listaCol.Count - 1
Dim
lbl
As
New
Label()
lbl.ID =
"lbl"
+ listaCol(i).Nombre
lbl.Text = listaCol(i).Nombre
Dim
tcLabel
As
TableCell =
New
TableCell()
tcLabel.Controls.Add(lbl)
'ctrlDynamic.Controls.Add(lbl)
Dim
txt
As
New
TextBox()
txt.Attributes.Add(
"style"
,
"margin-bottom: 10px"
)
txt.ID =
"txt"
+ listaCol(i).Nombre
txt.Text = listaCol(i).Valor
Dim
tcTxt
As
TableCell =
New
TableCell()
tcTxt.Controls.Add(txt)
Dim
tr
As
TableRow =
New
TableRow()
tr.Cells.Add(tcLabel)
tr.Cells.Add(tcTxt)
tbl.Rows.Add(tr)
ctrlDynamic.Controls.Add(tbl)
Next
End
If
End
Sub
Protected
Sub
grdConceptos_ItemCommand(
ByVal
source
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
grdConceptos.ItemCommand
If
e.CommandName =
"Update"
Then
If
(
TypeOf
e.Item
Is
GridEditFormItem
And
e.Item.IsInEditMode)
Then
Dim
editItem
As
GridEditFormItem =
CType
(e.Item, GridEditFormItem)
Dim
c
As
oColumna =
New
oColumna()
Dim
idCliente
As
RadComboBox =
DirectCast
(editItem.FindControl(
"ddlCliente"
), RadComboBox)
Dim
idunidad
As
RadComboBox =
DirectCast
(editItem.FindControl(
"ddlUnidad"
), RadComboBox)
Dim
IdMarca
As
RadComboBox =
DirectCast
(editItem.FindControl(
"ddlMarca"
), RadComboBox)
Dim
IdTipoEquipo
As
RadComboBox =
DirectCast
(editItem.FindControl(
"ddlTipoEquipo"
), RadComboBox)
c.UpdateEquipo(IdEquipo, idCliente.SelectedValue, idunidad.SelectedValue, IdMarca.SelectedValue, IdTipoEquipo.SelectedValue)
Dim
colEq
As
oColumna =
New
oColumna()
Dim
listaCol
As
List(Of oColumna) =
New
List(Of oColumna)
listaCol = colEq.ObtieneColumnasEquipo(IdTipoEquipo.SelectedValue, sesion.IdLaboratorio)
ctrlDynamic =
DirectCast
(editItem.FindControl(
"ctrlDynamic"
), Panel)
Dim
txt1
As
TextBox =
New
TextBox()
txt1 =
DirectCast
(ctrlDynamic.FindControl(
"txtMVA"
), TextBox)
For
i
As
Integer
= 0
To
listaCol.Count - 1
Dim
txt
As
TextBox =
New
TextBox()
txt =
DirectCast
(editItem.FindControl(
"txt"
+ listaCol(i).Nombre), TextBox)
c.UpdateEquipoColumna(IdEquipo, listaCol(i).IdColumna, txt.Text)
Next
End
If
End
If
End
Sub