Here is the aspx code:
<telerik:RadGrid ID="gridCompanies" runat="server" AllowFilteringByColumn="True"
AllowPaging="True" AllowSorting="True" DataSourceID="dsCompanies" GridLines="None"
ShowGroupPanel="True" Skin="Office2007" ShowStatusBar="True"
AllowAutomaticUpdates="True" AllowAutomaticInserts="True" AllowAutomaticDeletes="True">
<AlternatingItemStyle BackColor="#E6E6E6" Font-Bold="False" Font-Italic="False"
Font-Overline="False" Font-Strikeout="False" Font-Underline="False"
Wrap="True" />
<PagerStyle Mode="NextPrevAndNumeric" />
<MasterTableView Name="Master" AllowAutomaticUpdates="True" AllowAutomaticInserts="True" CommandItemDisplay="Top" AutoGenerateColumns="False" DataKeyNames="CompanyID" DataSourceID="dsCompanies">
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<DetailTables>
<telerik:GridTableView Name="Detail" CommandItemDisplay="Top" DataKeyNames="CompanyUserID"
DataSourceID="dsCompanyUsers" AllowPaging="true" AllowSorting="true"
AllowFilteringByColumn="False" AutoGenerateColumns="false" Width="100%"
AllowAutomaticDeletes="True" AllowAutomaticInserts="False" AllowAutomaticUpdates="True">
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="CompanyUserID"
MasterKeyField="CompanyUserID" />
</ParentTableRelation>
<ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<Columns>
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn2">
<HeaderStyle Width="3%"></HeaderStyle>
<ItemStyle Width="3%"></ItemStyle>
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="CompanyID" DataType="System.Int32"
HeaderText="CompanyID" Display="false" ReadOnly="True" SortExpression="CompanyID" UniqueName="CompanyID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CompanyUserID" HeaderText="CompanyUserID"
SortExpression="CompanyUserID" Display="false" ReadOnly="True" UniqueName="CompanyUserID" DataType="System.Int32">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="UserID" HeaderText="UserID"
SortExpression="UserID" UniqueName="UserID" Display="False" ReadOnly="True" DataType="System.Int32">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="UserPermissionID" HeaderText="UserPermissionID"
SortExpression="UserPermissionID" UniqueName="UserPermissionID" Display="False" ReadOnly="True" DataType="System.Int32">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CompanyUserFName" HeaderText="First Name"
SortExpression="CompanyUserFName" UniqueName="CompanyUserFName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CompanyUserLName" HeaderText="Last Name"
SortExpression="CompanyUserLName" UniqueName="CompanyUserLName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CompanyUserTitle"
HeaderText="Title" SortExpression="CompanyUserTitle"
UniqueName="CompanyUserTitle">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CompanyUserEmail" HeaderText="Email"
SortExpression="CompanyUserEmail" UniqueName="CompanyUserEmail">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CompanyUserTel"
HeaderText="Tel." SortExpression="CompanyUserTel"
UniqueName="CompanyUserTel">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CompanyUserTelExt" HeaderText="Ext."
SortExpression="CompanyUserTelExt" UniqueName="CompanyUserTelExt">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CompanyUserCell" HeaderText="Cell"
SortExpression="CompanyUserCell" UniqueName="CompanyUserCell">
</telerik:GridBoundColumn>
<telerik:GridDropDownColumn DataField="PermissionID" DataSourceID="dsCompanyUsersPerms"
HeaderText="Permission" ListTextField="PermissionName" ListValueField="PermissionID"
UniqueName="PermissionID">
</telerik:GridDropDownColumn>
<telerik:GridCheckBoxColumn DataField="UserActive" HeaderText="Active"
SortExpression="UserActive" UniqueName="UserActive">
<HeaderStyle Width="5%"></HeaderStyle>
<ItemStyle Width="5%"></ItemStyle>
</telerik:GridCheckBoxColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
<HeaderStyle Width="3%"></HeaderStyle>
<ItemStyle Width="3%"></ItemStyle>
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="CompanyID" DataType="System.Int32"
HeaderText="CompanyID" ReadOnly="True" SortExpression="CompanyID"
UniqueName="CompanyID" Display="false">
</telerik:GridBoundColumn>
<telerik:GridDropDownColumn DataField="CountryID" DataSourceID="dsCountry"
HeaderText="Country" ListTextField="CountryName" ListValueField="CountryID"
UniqueName="CountryID">
</telerik:GridDropDownColumn>
<telerik:GridDropDownColumn DataField="ProvinceID" DataSourceID="dsProvince"
HeaderText="Province" ListTextField="ProvinceName" ListValueField="ProvinceID"
UniqueName="ProvinceID">
</telerik:GridDropDownColumn>
<telerik:GridBoundColumn DataField="CompanyName" HeaderText="Name"
SortExpression="CompanyName" UniqueName="CompanyName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CompanyAddress" HeaderText="Address"
SortExpression="CompanyAddress" UniqueName="CompanyAddress">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CompanyCity" HeaderText="City"
SortExpression="CompanyCity" UniqueName="CompanyCity">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CompanyTel" HeaderText="Tel"
SortExpression="CompanyTel" UniqueName="CompanyTel">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CompanyTelAreaCode"
HeaderText="Tel Area Code" SortExpression="CompanyTelAreaCode"
UniqueName="CompanyTelAreaCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CompanyFax" HeaderText="Fax"
SortExpression="CompanyFax" UniqueName="CompanyFax">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CompanyFaxAreaCode"
HeaderText="Fax Area Code" SortExpression="CompanyFaxAreaCode"
UniqueName="CompanyFaxAreaCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CompanyDomain" HeaderText="Domain"
SortExpression="CompanyDomain" UniqueName="CompanyDomain">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1"></EditColumn>
</EditFormSettings>
<PagerStyle Mode="NextPrevAndNumeric" />
</MasterTableView>
<ClientSettings AllowDragToGroup="True">
</ClientSettings>
<FilterMenu EnableTheming="True" Skin="Office2007">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</FilterMenu>
</telerik:RadGrid>
<asp:SqlDataSource ID="dsCompanies" runat="server"
ConnectionString="<%$ ConnectionStrings:VentrolSecurityConnectionString %>"
InsertCommand="spCreateCompany" InsertCommandType="StoredProcedure"
SelectCommand="spGetCompanies" SelectCommandType="StoredProcedure"
UpdateCommand="spUpdateCompany" UpdateCommandType="StoredProcedure">
<UpdateParameters>
<asp:Parameter Name="CompanyID" Type="Int32" />
<asp:Parameter Name="CountryID" Type="Int32" />
<asp:Parameter Name="ProvinceID" Type="Int32" />
<asp:Parameter Name="CompanyName" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyAddress" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyCity" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyTel" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyTelAreaCode" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyFax" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyFaxAreaCode" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyDomain" Type="String" ConvertEmptyStringToNull="true" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="CountryID" Type="Int32" />
<asp:Parameter Name="ProvinceID" Type="Int32" />
<asp:Parameter Name="CompanyName" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyAddress" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyCity" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyTel" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyTelAreaCode" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyFax" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyFaxAreaCode" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyDomain" Type="String" ConvertEmptyStringToNull="true" />
</InsertParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="dsCompanyUsers" runat="server"
ConnectionString="<%$ ConnectionStrings:VentrolSecurityConnectionString %>"
SelectCommand="spGetCompanyUsers" SelectCommandType="StoredProcedure"
UpdateCommand="spUpdateCompanyUser" UpdateCommandType="StoredProcedure">
<SelectParameters>
<asp:SessionParameter Name="CompanyID" SessionField="CompanyID" Type="Int32" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="CompanyID" Type="Int32" />
<asp:Parameter Name="UserID" Type="Int32" />
<asp:Parameter Name="UserPermissionID" Type="Int32" />
<asp:Parameter Name="CompanyUserID" Type="Int32" />
<asp:Parameter Name="CompanyUserFName" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyUserLName" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyUserTitle" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyUserEmail" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyUserTel" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyUserTelExt" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="CompanyUserCell" Type="String" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="PermissionID" Type="Int32" />
<asp:Parameter Name="UserActive" Type="Boolean" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="dsCompanyUsersPerms" runat="server"
ConnectionString="<%$ ConnectionStrings:VentrolSecurityConnectionString %>"
SelectCommand="spGetCompanyUsersPerms" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
<asp:SqlDataSource ID="dsProvince" runat="server"
ConnectionString="<%$ ConnectionStrings:VentrolSecurityConnectionString %>"
SelectCommand="spGetAllProvinces" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
<asp:SqlDataSource ID="dsCountry" runat="server"
ConnectionString="<%$ ConnectionStrings:VentrolSecurityConnectionString %>"
SelectCommand="spGetCountries" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
<telerik:RadAjaxManagerProxy ID="ajmProxy" runat="server" >
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="gridCompanies">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="gridCompanies" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
Here are the stored procedures for the detail grid:
ALTER
PROCEDURE [dbo].[spUpdateCompanyUser]
-- Add the parameters for the stored procedure here
@CompanyID int,
@UserID int,
@UserPermissionID int,
@CompanyUserID int,
@CompanyUserFName nvarchar(50),
@CompanyUserLName nvarchar(50),
@CompanyUserTitle nvarchar(50),
@CompanyUserEmail nvarchar(50),
@CompanyUserTel nvarchar(50),
@CompanyUserTelExt nvarchar(50),
@CompanyUserCell nvarchar(50),
@PermissionID int,
@UserActive bit
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
-- Update Company User
UPDATE tbl_secure_Company_User
SET CompanyUserFName = @CompanyUserFName,
CompanyUserLName = @CompanyUserLName,
CompanyUserTitle = @CompanyUserTitle,
CompanyUserEmail = @CompanyUserEmail,
CompanyUserTel = @CompanyUserTel,
CompanyUserTelExt = @CompanyUserTelExt,
CompanyUserCell = @CompanyUserCell
WHERE CompanyUserID = @CompanyUserID
-- Update Company User Permission
EXEC spUpdateUserPerm @UserPermissionID,@PermissionID
END
------------------------------------------------------------
ALTER
PROCEDURE [dbo].[spUpdateUserPerm] -- Add the parameters for the stored procedure here
@UserPermissionID int,
@PermissionID int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
UPDATE tbl_secure_User_Permission
SET PermissionID = @PermissionID
WHERE UserPermissionID = @UserPermissionID
END
When I execute the stored procedures from within SQL management studio it all works fine.
Please if any one can help me it would be fantastic.
Thanks in advance, much appreciation.
Reda.