Hi:
I am going down a different path, I am trying to implement a FormView with the Radgrid. I have the following, but I have a couple of problems.
1) edit form is a popup,... I would like in-line,
2) the insert event is not fully wired-up. The ItemCommand event has the Insert command but the InsertCommand is not triggered:
Sorry about the size, I tried the simplest example. The code behind is nothing.
This comes from:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/form-template-update/defaultcs.aspx
Phil
I am going down a different path, I am trying to implement a FormView with the Radgrid. I have the following, but I have a couple of problems.
1) edit form is a popup,... I would like in-line,
2) the insert event is not fully wired-up. The ItemCommand event has the Insert command but the InsertCommand is not triggered:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="MasterFormDetailProdGrid.aspx.cs" Inherits="Telerik.RadGrid.MasterFormDetailProdGrid" %>
<%@ Register TagPrefix="Telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"HeadContent"
runat
=
"server"
>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"MainContent"
runat
=
"server"
>
<
Telerik:RadGrid
ID
=
"categoriesGrid"
runat
=
"server"
DataSourceID
=
"categoriesDataSource"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"True"
AutoGenerateColumns
=
"False"
allowautomaticdeletes
=
"True"
allowautomaticinserts
=
"True"
allowautomaticupdates
=
"True"
Skin
=
"Office2007"
CellSpacing
=
"0"
OnItemCommand
=
"categoriesGrid_ItemCommand"
OnInsertCommand
=
"categoriesGrid_InsertCommand"
OnItemInserted
=
"categoriesGrid_ItemInserted"
>
<
MasterTableView
CommandItemDisplay
=
"Top"
DataSourceID
=
"categoriesDataSource"
EditMode
=
"InPlace"
DataKeyNames
=
"CategoryID"
GridLines
=
"None"
PageSize
=
"1"
ShowHeader
=
"False"
>
<
Columns
>
<
Telerik:GridTemplateColumn
HeaderText
=
"CategoryID"
UniqueName
=
"CategoryIDColumn"
AllowFiltering
=
"False"
ItemStyle-BorderStyle
=
"None"
>
<
ItemTemplate
>
<
table
style
=
"padding: 0; margin: 0; width: 100%"
>
<
tr
>
<
td
class
=
"rightDetail"
style
=
"width: 120px;"
>
CategoryID:
</
td
>
<
td
class
=
"leftDetail"
>
<
asp:Label
ID
=
"categoryIDLabel"
runat
=
"server"
Text='<%# Eval("CategoryID") %>' />
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"rightDetail"
>
CategoryName:
</
td
>
<
td
class
=
"leftDetail"
>
<
asp:Label
ID
=
"categoryNameLabel"
runat
=
"server"
Text='<%# Eval("CategoryName") %>' />
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"rightDetail"
>
Description:
</
td
>
<
td
class
=
"leftDetail"
>
<
asp:Label
ID
=
"descriptionLabel"
runat
=
"server"
Text='<%# Eval("Description") %>' />
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"rightDetail"
>
Picture:
</
td
>
<
td
class
=
"leftDetail"
>
<
telerik:RadBinaryImage
runat
=
"server"
ID
=
"RadBinaryImage1"
DataValue='<%# Eval("Picture") == DBNull.Value? new System.Byte[0]: Eval("Picture") %>'
AutoAdjustImageControlSize="false" Width="150px" Height="150px" ToolTip='<%#Eval("CategoryName", "Photo of {0}") %>'
AlternateText='<%#Eval("CategoryName", "Photo of {0}") %>' />
</
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:Label
ID
=
"CategoryIDLabel"
runat
=
"server"
Text='<# Eval("CategoryID") %>' />
</
EditItemTemplate
>
</
Telerik:GridTemplateColumn
>
<
Telerik:GridEditCommandColumn
EditText
=
"Edit"
ItemStyle-VerticalAlign
=
"Top"
ItemStyle-Width
=
"40px"
ItemStyle-BorderStyle
=
"None"
/>
<
Telerik:GridButtonColumn
Text
=
"Delete"
CommandName
=
"Delete"
UniqueName
=
"DeleteColumn"
ItemStyle-VerticalAlign
=
"Top"
ItemStyle-Width
=
"50px"
ItemStyle-BorderStyle
=
"None"
ConfirmText
=
"Are you sure you want to delete this data?"
/>
</
Columns
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
EditItemStyle
CssClass
=
"EditedTelerikGrid"
/>
<
EditFormSettings
EditFormType
=
"Template"
>
<
FormTemplate
>
<
table
style
=
"padding: 0; margin: 0; width: 100%"
>
<
tr
>
<
td
colspan
=
"3"
class
=
"rightDetail"
>
<
asp:LinkButton
id
=
"insertButton"
runat
=
"server"
CausesValidation
=
"True"
CommandName
=
"Insert"
Text
=
"Save"
CssClass
=
"buttonBlue"
CommandArgument
=
"close"
ValidationGroup
=
"insertValidationGroup"
/>
|
<
asp:LinkButton
id
=
"InsertCancelButton"
runat
=
"server"
CausesValidation
=
"False"
CommandName
=
"Cancel"
Text
=
"Cancel"
CssClass
=
"buttonBlue"
/>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"rightDetail"
>
CategoryID:
</
td
>
<
td
class
=
"leftDetail"
>
<
asp:Label
ID
=
"categoryIDLabel"
runat
=
"server"
Text='<%# Eval("CategoryID") %>' />
</
td
>
<
td
class
=
"leftDetail"
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"rightDetail"
>
CategoryName:
</
td
>
<
td
class
=
"leftDetail"
>
<
telerik:RadTextBox
ID
=
"categoryNameTextBox"
runat
=
"server"
Text='<%# Bind("CategoryName") %>' Columns="14" MaxLength="15" />
</
td
>
<
td
class
=
"leftDetail"
>
<
asp:RequiredFieldValidator
id
=
"categoryNameValidator"
runat
=
"server"
ControlToValidate
=
"categoryNameTextBox"
ValidationGroup
=
"insertValidationGroup"
ErrorMessage
=
"'CategoryName' is required"
Text
=
"*"
/>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"rightDetail"
>
Description:
</
td
>
<
td
class
=
"leftDetail"
>
<
telerik:RadTextBox
ID
=
"descriptionTextBox"
runat
=
"server"
Text='<%# Bind("Description") %>' Columns="80" Rows="3" />
</
td
>
<
td
class
=
"leftDetail"
>
<
asp:RequiredFieldValidator
id
=
"descriptionValidator"
runat
=
"server"
ControlToValidate
=
"descriptionTextBox"
ValidationGroup
=
"insertValidationGroup"
ErrorMessage
=
"'Description' is required"
Text
=
"*"
/>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"rightDetail"
>
Picture:
</
td
>
<
td
class
=
"leftDetail"
>
</
td
>
<
td
class
=
"leftDetail"
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"3"
>
<
asp:ValidationSummary
id
=
"insertValidationSummary"
runat
=
"server"
ValidationGroup
=
"insertValidationGroup"
/>
</
td
>
</
tr
>
</
table
>
</
FormTemplate
>
</
EditFormSettings
>
<
CommandItemSettings
AddNewRecordText
=
"Add"
RefreshText
=
"Refresh"
/>
</
MasterTableView
>
<
FilterMenu
EnableTheming
=
"True"
Skin
=
"Office2007"
>
<
CollapseAnimation
Duration
=
"200"
Type
=
"OutQuint"
/>
</
FilterMenu
>
</
Telerik:RadGrid
>
<
asp:HiddenField
ID
=
"CategoryIDHidden"
runat
=
"server"
Value
=
''
/>
<
asp:SqlDataSource
ID
=
"categoriesDataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:Northwind %>"
SelectCommand="SELECT * FROM [Categories]"
DeleteCommand="DELETE FROM [Categories] WHERE [CategoryID] = @CategoryID"
InsertCommand=" INSERT INTO [Categories] ( [CategoryName], [Description] )
VALUES ( @CategoryName, @Description )"
UpdateCommand=" UPDATE [Categories]
SET
[CategoryName] = @CategoryName,
[Description] = @Description
WHERE
[CategoryID] = @CategoryID ">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"CategoryID"
/>
</
DeleteParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"CategoryName"
/>
<
asp:Parameter
Name
=
"Description"
/>
<
asp:Parameter
Name
=
"Picture"
/>
</
InsertParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"CategoryName"
/>
<
asp:Parameter
Name
=
"Description"
/>
<
asp:Parameter
Name
=
"Picture"
/>
<
asp:Parameter
Name
=
"CategoryID"
/>
</
UpdateParameters
>
</
asp:SqlDataSource
>
<
asp:Label
ID
=
"messageLabel"
runat
=
"server"
Text
=
""
CssClass
=
"notification"
></
asp:Label
>
</
asp:Content
>
This comes from:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/form-template-update/defaultcs.aspx
Phil