Hi,
I'm new developing using telerik and I have aproblem with the radgrid.
When I click in edit and then click in save the updatecommand does nothing.
Please help me and I really appreciate it.
Here's the code of the grid:
<
telerik:RadGrid
ID
=
"rgControlPedidos"
runat
=
"server"
RenderMode
=
"Lightweight"
AllowPaging
=
"true"
AllowSorting
=
"true"
AutoGenerateColumns
=
"false"
ShowStatusBar
=
"true"
AllowMultiRowSelection
=
"True"
Skin
=
"Default"
DataSourceID
=
"datosPedidos"
AllowAutomaticUpdates
=
"true"
OnItemDataBound
=
"rgControlPedidos_ItemDataBound"
>
<
MasterTableView
ShowFooter
=
"false"
DataKeyNames
=
"idPedido"
EditMode
=
"InPlace"
CommandItemDisplay
=
"TopAndBottom"
ClientDataKeyNames
=
"refPedido"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"refPedido"
HeaderText
=
"Número de Referencia"
ReadOnly
=
"true"
/>
<
telerik:GridBoundColumn
DataField
=
"numCliente"
HeaderText
=
"Número de Cliente"
ReadOnly
=
"true"
/>
<
telerik:GridTemplateColumn
HeaderText
=
"Status"
>
<
ItemTemplate
>
<%#DataBinder.Eval(Container.DataItem,"Status") %>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadDropDownList
ID
=
"ddlStatus"
runat
=
"server"
DataSourceID
=
"datosStatus"
DataTextField
=
"Status"
DataValueField
=
"idStatus"
SelectedValue='<%# DataBinder.Eval(Container, "DataItem.idStatus")%>'></
telerik:RadDropDownList
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"fechaPedido"
HeaderText
=
"Fecha del Pedido"
ReadOnly
=
"true"
/>
<
telerik:GridEditCommandColumn
UniqueName
=
"ColumnaEditar"
HeaderText
=
"Editar"
UpdateText
=
"Guardar"
CancelText
=
"Cancelar"
>
</
telerik:GridEditCommandColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
This is the code of SqlDataSource:
<
asp:SqlDataSource
ID
=
"datosStatus"
runat
=
"server"
></
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"datosPedidos"
runat
=
"server"
UpdateCommand
=
"UPDATE DV_CAT_PEDIDOS SET idStatus = @idStatus where refPedido=@refPedido"
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"idStatus"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"refPedido"
Type
=
"String"
/>
</
UpdateParameters
>
</
asp:SqlDataSource
>
And this code is in CodeBehind:
string
con = ConfigurationManager.AppSettings[
"ConeccionBD"
].ToString();
datosStatus.ConnectionString = con;
datosStatus.SelectCommand =
"SELECT idStatus,Status FROM DV_CAT_STATUS"
;
datosPedidos.ConnectionString = con;
datosPedidos.SelectCommand =
"select pedidos.idPedido, pedidos.refPedido , pedidos.numCliente, "
+
"pedidos.fechaPedido , status.Status, status.idStatus "
+
"from DV_CAT_PEDIDOS pedidos "
+
"JOIN DV_CAT_STATUS status ON status.idStatus=pedidos.idStatus "
+
"ORDER BY pedidos.idPedido desc"
;