This is a migrated thread and some comments may be shown as answers.

Delete SP not working on NestedViewTemplate - RadGrid

5 Answers 114 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 27 Jun 2011, 03:07 PM
I have a NestedViewTemplate within a RadGrid.  Within the NestedViewTemplate I have two other Rad-grids showing data to the parent RadGrid.  The 'select' operation on both nested RadGrid's work fine.  However, when attempting to delete a record in one of the nested RadGrid, nothing happens.  Please review the below code and advise:

 

<telerik:RadGrid ID="RadGrid2" DataSourceID="SqlDataSource3" GridLines="None" ShowGroupPanel="False" Skin="WebBlue" runat="server"

 

 

AutoGenerateEditColumn="True" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true">

 

 

<ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true" HideStructureColumns="true"></ExportSettings>

 

 

<MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSource3"

 

 

ShowHeader="True" AllowPaging="false" CommandItemDisplay="Top">

 

 

<Columns>

 

 

<telerik:GridBoundColumn DataField="intInspectorID" DataType="System.Int32" HeaderText="intInspectorID"

 

 

SortExpression="intInspectorID" UniqueName="intInspectorID" Visible="false" ReadOnly="true">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="intCertificationID" DataType="System.Int32" HeaderText="intCertificationID"

 

 

SortExpression="intCertificationID" UniqueName="intCertificationID" Visible="false" ReadOnly="true">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="strCertificationDesc" HeaderText="Certification" SortExpression="strCertificationDesc"

 

 

UniqueName="strCertificationDesc">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="dtmDateExpires" HeaderText="Date Expires" SortExpression="dtmDateExpires"

 

 

UniqueName="dtmDateExpires">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridButtonColumn ConfirmText="Delete this Certification?" ButtonType="LinkButton"

 

 

CommandName="Delete" Text="Delete" UniqueName="DeleteColumn1">

 

 

<HeaderStyle Width="20px" />

 

 

<ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />

 

 

</telerik:GridButtonColumn>

 

 

</Columns>

 

 

<EditFormSettings EditFormType="Template">

 

 

<FormTemplate>

 

 

<table style="width:100%; table-layout:fixed; margin: 0 0 0 0; background-color:#E6E6E6;">

 

 

<tr>

 

 

<td align="right" style=" vertical-align:top;">

 

 

<asp:Label ID="Label3" runat="server" Text="Certification:"></asp:Label>

 

 

</td>

 

 

<td align="left">

 

 

<telerik:RadComboBox ID="cboStateEdit" runat="server" DataTextField='<%# Bind("strCertificationDesc") %>'

 

 

DataValueField='<%# Bind("intCertificationID") %>' Text='<%# Bind("strCertificationDesc") %>'

 

 

SelectedValue='<%# Bind("intCertificationID") %>' Skin="WebBlue">

 

 

<Items>

 

 

<telerik:RadComboBoxItem Text="--Select--" Value="" />

 

 

<telerik:RadComboBoxItem Text="NICET" Value="1" />

 

 

<telerik:RadComboBoxItem Text="NICEPT" Value="2" />

 

 

<telerik:RadComboBoxItem Text="ACI" Value="3" />

 

 

<telerik:RadComboBoxItem Text="PennDOT Concrete" Value="4" />

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td align="right" style=" vertical-align:top;">

 

 

<asp:Label ID="Label15" runat="server" Text="Date Expires:"></asp:Label>

 

 

</td>

 

 

<td align="left">

 

 

<telerik:RadDatePicker ID="RadDatePicker1" runat="server"

 

 

DbSelectedDate='<%# Bind("dtmDateExpires") %>' EnableTyping="false">

 

 

</telerik:RadDatePicker>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td colspan="2">

 

 

<asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'

 

 

runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'>

 

 

</asp:Button>&nbsp;

 

 

<asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

</FormTemplate>

 

 

</EditFormSettings>

 

 

</MasterTableView>

 

 

</telerik:RadGrid>

 

 

<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:inspectors %>"

 

 

SelectCommand="getInspectorCertifications" SelectCommandType="StoredProcedure"

 

 

InsertCommand="insInspectorCertifications" InsertCommandType="StoredProcedure"

 

 

UpdateCommand="updInspectorCertifications" UpdateCommandType="StoredProcedure"

 

 

DeleteCommand="delInspectorCertification" DeleteCommandType="StoredProcedure">

 

 

<SelectParameters>

 

 

<asp:ControlParameter ControlID="Label1" Name="intInspectorID" PropertyName="Text" Type="Int32" />

 

 

</SelectParameters>

 

 

<InsertParameters>

 

 

<asp:ControlParameter ControlID="Label1" Name="intInspectorID" PropertyName="Text" Type="Int32" />

 

 

<asp:Parameter Name="intCertificationID" Type="Int32" />

 

 

<asp:Parameter Name="dtmDateExpires" Type="DateTime" />

 

 

</InsertParameters>

 

 

<UpdateParameters>

 

 

<asp:Parameter Name="intCertificationID" Type="Int32" />

 

 

<asp:Parameter Name="intInspectorID" Type="Int32" />

 

 

<asp:Parameter Name="dtmDateExpires" Type="dateTime" />

 

 

</UpdateParameters>

 

 

<DeleteParameters>

 

 

<asp:Parameter Name="intCertificationID" Type="Int32" />

 

 

<asp:Parameter Name="intInspectorID" Type="Int32" />

 

 

</DeleteParameters>

 

 

</asp:SqlDataSource>

 

</

 

telerik:RadPageView>

 

5 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 29 Jun 2011, 02:36 PM
Hi Richard,

Please, paste your code using the CODE FORMATTER TOOL of the ticket editor - your code is not readable. In addition, do provide complete aspx and code-behind. 

Greetings,
Tsvetoslav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Richard
Top achievements
Rank 1
answered on 29 Jun 2011, 03:10 PM
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <table style="width:970px; height:665px; table-layout:fixed;">
            <tr>
                <td valign="top">
                    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                        <ClientEvents OnRequestStart="onRequestStart" />
                        <AjaxSettings>
                            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                            <telerik:AjaxSetting AjaxControlID="cmdSearch">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                            <telerik:AjaxSetting AjaxControlID="cmdReset">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                        </AjaxSettings>
                    </telerik:RadAjaxManager>
                    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Skin="WebBlue" runat="server" />
                    <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" 
                        AutoGenerateEditColumn="True" DataSourceID="SqlDataSource1" GridLines="None" Skin="WebBlue"
                        AllowAutomaticInserts="True" AllowAutomaticUpdates="True" 
                        OnItemCommand="RadGrid1_ItemCommand">
                        <ExportSettings HideStructureColumns="True" ExportOnlyData="True" OpenInNewWindow="True">
                            <Pdf PageWidth="11in" PageHeight="8.5in" />
                        </ExportSettings>
                        <MasterTableView AutoGenerateColumns="False" DataKeyNames="intInspectorID" DataSourceID="SqlDataSource1" CommandItemDisplay="Top">
                            <HeaderStyle Width="850px" Font-Size="10pt" />
                            <ItemStyle Width="850px" Font-Size="10pt" />
                            <Columns>
                                <telerik:GridBoundColumn DataField="intInspectorID" DataType="System.Int32" HeaderText="ID"
                                    ReadOnly="True" SortExpression="intInspectorID" UniqueName="intInspectorID" AllowFiltering="False" Visible="False">
                                    <HeaderStyle Width="50px" />
                                    <ItemStyle Width="50px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="strFirstName" HeaderText="First Name" SortExpression="strFirstName"
                                    UniqueName="strFirstName">
                                    <HeaderStyle Width="100px" />
                                    <ItemStyle Width="100px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="strMiddleName" HeaderText="Middle Name" SortExpression="strMiddleName"
                                    UniqueName="strMiddleName" AllowFiltering="False" Visible="False">
                                    <HeaderStyle Width="25px" />
                                    <ItemStyle Width="25px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="strLastName" HeaderText="Last Name" SortExpression="strLastName"
                                    UniqueName="strLastName">
                                    <HeaderStyle Width="100px" />
                                    <ItemStyle Width="100px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="strAddress1" HeaderText="Address" SortExpression="strAddress1"
                                    UniqueName="strAddress1" AllowFiltering="False">
                                    <HeaderStyle Width="150px" />
                                    <ItemStyle Width="150px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="strAddress2" HeaderText="Address 2" SortExpression="strAddress2"
                                    UniqueName="strAddress2" AllowFiltering="False" Visible="False">
                                    <HeaderStyle Width="100px" />
                                    <ItemStyle Width="100px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="strCity" HeaderText="City" SortExpression="strCity"
                                    UniqueName="strCity" AllowFiltering="False">
                                    <HeaderStyle Width="100px" />
                                    <ItemStyle Width="100px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="strState" HeaderText="State" SortExpression="strState"
                                    UniqueName="strState" AllowFiltering="False" Visible="False">
                                    <HeaderStyle Width="25px" />
                                    <ItemStyle Width="25px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="strZipCode" HeaderText="Zip Code" SortExpression="strZipCode"
                                    UniqueName="strZipCode" AllowFiltering="False" Visible="False">
                                    <HeaderStyle Width="50px" />
                                    <ItemStyle Width="50px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="intHomeDistrict" DataType="System.Int32" HeaderText="Home District"
                                    SortExpression="intHomeDistrict" UniqueName="intHomeDistrict">
                                    <HeaderStyle Width="10px" />
                                    <ItemStyle Width="10px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridTemplateColumn DataField="strEmail" HeaderText="Email" AllowFiltering="False"
                                    SortExpression="strEmail" UniqueName="strEmail">
                                    <HeaderStyle Width="100px" />
                                    <ItemStyle Width="100px" Wrap="true" />
                                    <ItemTemplate>
                                        <a href='mailto:<%#Eval("strEmail")%>'><%#Eval("strEmail")%></a>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn DataField="strHomePhone" HeaderText="Home Phone" AllowFiltering="False"
                                    SortExpression="strHomePhone" UniqueName="strHomePhone">
                                    <HeaderStyle Width="90px" />
                                    <ItemStyle Width="90px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="strCellPhone" HeaderText="Cell" AllowFiltering="False"
                                    SortExpression="strCellPhone" UniqueName="strCellPhone">
                                    <HeaderStyle Width="90px" />
                                    <ItemStyle Width="90px" />
                                </telerik:GridBoundColumn>
                            </Columns>
                            <EditFormSettings CaptionFormatString="Edit details for Inspector with ID {0}"
                                CaptionDataField="intInspectorID" EditFormType="Template">
                                <FormTemplate>
                                    <table style="width:50%; table-layout:fixed; margin: 0 0 0 0; background-color:#E6E6E6; float:left;">
                                        <tr>
                                            <td align="right" style=" vertical-align:top;">
                                                <asp:Label ID="Label3" runat="server" Text="First Name:"></asp:Label>
                                            </td>
                                            <td align="left">
                                                <telerik:RadTextBox ID="txtFirstNameEdit" runat="server" Text='<%# Bind("strFirstName") %>' 
                                                    Skin="WebBlue" BorderStyle="Solid"></telerik:RadTextBox>
                                            </td>
                                        </tr>
                                         <tr>                                                     
                                            <td align="right">
                                                <asp:Label ID="Label5" runat="server" Text="Middle Name:"></asp:Label><br />
                                            </td>
                                            <td align="left">
                                                <telerik:RadTextBox ID="txtMiddleNameEdit" runat="server" Text='<%# Bind("strMiddleName") %>' 
                                                    Skin="WebBlue" BorderStyle="Solid"></telerik:RadTextBox><br />
                                            </td>
                                         <tr>
                                         <tr>
                                            <td align="right">
                                                <asp:Label ID="Label7" runat="server" Text="Last Name:"></asp:Label><br />
                                            </td>
                                            <td align="left">
                                                <telerik:RadTextBox ID="txtLastNameEdit" runat="server" Text='<%# Bind("strLastName") %>' 
                                                    Skin="WebBlue" BorderStyle="Solid"></telerik:RadTextBox><br />
                                            </td>
                                         </tr>
                                         <tr>
                                            <td align="right">
                                                <asp:Label ID="Label9" runat="server" Text="Address 1:"></asp:Label>
                                            </td>
                                            <td align="left">
                                                <telerik:RadTextBox ID="txtAddress1Edit" runat="server" Text='<%# Bind("strAddress1") %>' 
                                                    Skin="WebBlue" BorderStyle="Solid"></telerik:RadTextBox><br />
                                            </td>
                                          </tr>
                                         <tr>
                                            <td align="right">
                                                <asp:Label ID="Label10" runat="server" Text="Address 2:"></asp:Label>
                                            </td>
                                            <td align="left">
                                                <telerik:RadTextBox ID="txtAddress2Edit" runat="server" Text='<%# Bind("strAddress2") %>' 
                                                    Skin="WebBlue" BorderStyle="Solid"></telerik:RadTextBox><br />
                                            </td>
                                         </tr>
                                         <tr>
                                            <td align="right">
                                                <asp:Label ID="Label13" runat="server" Text="City:"></asp:Label>
                                            </td>
                                            <td align="left">
                                                <telerik:RadTextBox ID="txtCityEdit" runat="server" Text='<%# Bind("strCity") %>' 
                                                    Skin="WebBlue" BorderStyle="Solid"></telerik:RadTextBox><br />
                                            </td>
                                          </tr>
                                    </table>
                                    <table style="width:50%; table-layout:fixed; margin: 0 0 0 0; background-color:#E6E6E6; float:right;">
                                          <tr>
                                            <td align="right">
                                                <asp:Label ID="Label6" runat="server" Text="State:"></asp:Label><br />
                                            </td>                                                        
                                            <td align="left">
                                                <telerik:RadComboBox ID="cboStateEdit" runat="server" DataTextField='<%# Bind("strState") %>'
                                                    DataValueField='<%# Bind("strState") %>' Text='<%# Bind("strState") %>'
                                                    SelectedValue='<%# Bind("strState") %>' Skin="WebBlue">
                                                    <Items>
                                                        <telerik:RadComboBoxItem Text="--Select--" Value="" />
                                                        <telerik:RadComboBoxItem Text="PA" Value="PA" />
                                                        <telerik:RadComboBoxItem Text="OH" Value="OH" />
                                                        <telerik:RadComboBoxItem Text="MD" Value="MD" />
                                                    </Items>
                                                </telerik:RadComboBox>                                                                
                                            </td>
                                         </tr>
                                         <tr>
                                            <td align="right">
                                                <asp:Label ID="Label4" runat="server" Text="Zip Code:"></asp:Label>
                                            </td>
                                            <td align="left">
                                                <telerik:RadTextBox ID="txtZipCodeEdit" runat="server" Text='<%# Bind("strZipCode") %>' 
                                                    Skin="WebBlue" BorderStyle="Solid"></telerik:RadTextBox><br />
                                            </td>
                                          </tr>
                                         <tr>
                                            <td align="right">
                                                <asp:Label ID="Label8" runat="server" Text="Email:"></asp:Label><br />
                                            </td>
                                            <td align="left">
                                                <telerik:RadTextBox ID="txtEmailEdit" runat="server" Text='<%# Bind("strEmail") %>' 
                                                    Skin="WebBlue" BorderStyle="Solid"></telerik:RadTextBox><br />
                                            </td>
                                         </tr>
                                          <tr>
                                            <td align="right">
                                                <asp:Label ID="Label11" runat="server" Text="Home Phone:"></asp:Label>
                                            </td>
                                            <td align="left">
                                                <telerik:RadTextBox ID="txtHomePhone" runat="server" Text='<%# Bind("strHomePhone") %>' 
                                                    Skin="WebBlue" BorderStyle="Solid"></telerik:RadTextBox><br />
                                            </td>
                                         </tr>
                                         <tr>
                                            <td align="right">
                                                <asp:Label ID="Label12" runat="server" Text="Cell Phone:"></asp:Label>
                                            </td>
                                            <td align="left">
                                                <telerik:RadTextBox ID="txtCellPhone" runat="server" Text='<%# Bind("strCellPhone") %>' 
                                                    Skin="WebBlue" BorderStyle="Solid"></telerik:RadTextBox><br />
                                            </td>
                                         </tr>
                                         <tr>
                                            <td align="right">
                                                <asp:Label ID="Label14" runat="server" Text="Home District:"></asp:Label>
                                            </td>
                                            <td align="left">
                                                <telerik:RadTextBox ID="txtHomeDistrictEdit" runat="server" Text='<%# Bind("intHomeDistrict") %>' 
                                                    Skin="WebBlue" BorderStyle="Solid"></telerik:RadTextBox>
                                            </td>
                                         </tr>
                                    </table>
                                    <table style="width:100%; table-layout:fixed; margin: 0 0 0 0; background-color:#E6E6E6;">
                                        <tr>
                                            <td colspan="2" align="center">
                                                <asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                                                    runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'>
                                                </asp:Button
                                                <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>
                                            </td>
                                        </tr>
                                    </table>
                                </FormTemplate>
                            </EditFormSettings>
                            <NestedViewTemplate>
                                <asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false" BackColor="gainsboro">
                                <div style="margin: 5px 5px 10px 5px;">
                                    <telerik:RadTabStrip runat="server" ID="TabStip1" MultiPageID="Multipage1" SelectedIndex="0">
                                        <Tabs>
                                            <telerik:RadTab runat="server" Text="Certifications" PageViewID="PageView1">
                                            </telerik:RadTab>
                                            <telerik:RadTab runat="server" Text="Districts Willing to Work In" PageViewID="PageView2">
                                            </telerik:RadTab>
                                        </Tabs>
                                    </telerik:RadTabStrip>
                                    <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">
                                        <telerik:RadPageView runat="server" ID="PageView1">
                                            <asp:Label ID="Label1" Font-Bold="true" Font-Italic="true" Text='<%# Eval("intInspectorID") %>' Visible="false" runat="server" />
                                            <telerik:RadGrid ID="RadGrid2" DataSourceID="SqlDataSource3" GridLines="None" ShowGroupPanel="False" Skin="Office2007" runat="server"
                                                    AutoGenerateEditColumn="True" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true">
                                                <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true" HideStructureColumns="true"></ExportSettings>
                                                <MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSource3" 
                                                    ShowHeader="True" AllowPaging="false" CommandItemDisplay="Top">
                                                    <Columns>
                                                        <telerik:GridBoundColumn DataField="intInspectorID" DataType="System.Int32" HeaderText="intInspectorID"
                                                            SortExpression="intInspectorID" UniqueName="intInspectorID" Visible="false" ReadOnly="true">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="intCertificationID" DataType="System.Int32" HeaderText="intCertificationID"
                                                            SortExpression="intCertificationID" UniqueName="intCertificationID" Visible="false" ReadOnly="true">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="strCertificationDesc" HeaderText="Certification" SortExpression="strCertificationDesc"
                                                            UniqueName="strCertificationDesc">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="dtmDateExpires" HeaderText="Date Expires" SortExpression="dtmDateExpires"
                                                            UniqueName="dtmDateExpires">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridButtonColumn ConfirmText="Delete this Certification?" ButtonType="LinkButton"
                                                            CommandName="Delete" Text="Delete" UniqueName="DeleteColumn2">
                                                            <HeaderStyle Width="20px" />
                                                            <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                                                        </telerik:GridButtonColumn>
                                                    </Columns>
                                                    <EditFormSettings EditFormType="Template">
                                                        <FormTemplate>
                                                            <table style="width:100%; table-layout:fixed; margin: 0 0 0 0; background-color:#E6E6E6;">
                                                                <tr>
                                                                    <td align="right" style=" vertical-align:top;">
                                                                        <asp:Label ID="Label3" runat="server" Text="Certification:"></asp:Label>
                                                                    </td>
                                                                    <td align="left">
                                                                        <telerik:RadComboBox ID="cboStateEdit" runat="server" DataTextField='<%# Bind("strCertificationDesc") %>'
                                                                            DataValueField='<%# Bind("intCertificationID") %>' Text='<%# Bind("strCertificationDesc") %>'
                                                                            SelectedValue='<%# Bind("intCertificationID") %>' Skin="WebBlue">
                                                                            <Items>
                                                                                <telerik:RadComboBoxItem Text="--Select--" Value="" />
                                                                                <telerik:RadComboBoxItem Text="NICET" Value="1" />
                                                                                <telerik:RadComboBoxItem Text="NECEPT" Value="2" />
                                                                                <telerik:RadComboBoxItem Text="ACI" Value="3" />
                                                                                <telerik:RadComboBoxItem Text="PennDOT Concrete" Value="4" />
                                                                            </Items>
                                                                        </telerik:RadComboBox>                                                                
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td align="right" style=" vertical-align:top;">
                                                                        <asp:Label ID="Label15" runat="server" Text="Date Expires:"></asp:Label>
                                                                    </td>
                                                                    <td align="left">
                                                                        <telerik:RadDatePicker ID="RadDatePicker1" runat="server" 
                                                                            DbSelectedDate='<%# Bind("dtmDateExpires") %>' EnableTyping="false">
                                                                        </telerik:RadDatePicker>                                                        
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td colspan="2">
                                                                        <asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                                                                            runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'>
                                                                        </asp:Button
                                                                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>
                                                                    </td>
                                                                </tr>
                                                            </table>                                                                        
                                                        </FormTemplate>
                                                    </EditFormSettings>
                                                </MasterTableView>
                                            </telerik:RadGrid>
                                            <hr />
                                            <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:inspectors %>"
                                                    SelectCommand="getInspectorCertifications" SelectCommandType="StoredProcedure"
                                                    InsertCommand="insInspectorCertifications" InsertCommandType="StoredProcedure"
                                                    UpdateCommand="updInspectorCertifications" UpdateCommandType="StoredProcedure"
                                                    DeleteCommand="delInspectorCertification" DeleteCommandType="StoredProcedure">
                                                <SelectParameters>
                                                    <asp:ControlParameter ControlID="Label1" Name="intInspectorID" PropertyName="Text" Type="Int32" />
                                                </SelectParameters>
                                                <InsertParameters>
                                                    <asp:ControlParameter ControlID="Label1" Name="intInspectorID" PropertyName="Text" Type="Int32" />
                                                    <asp:Parameter Name="intCertificationID" Type="Int32" />
                                                    <asp:Parameter Name="dtmDateExpires" Type="DateTime" />
                                                </InsertParameters>
                                                <UpdateParameters>
                                                    <asp:Parameter Name="intCertificationID" Type="Int32" />
                                                    <asp:ControlParameter ControlID="Label1" Name="intInspectorID" PropertyName="Text" Type="Int32" />
                                                    <asp:Parameter Name="dtmDateExpires" Type="dateTime" />
                                                </UpdateParameters>
                                                <DeleteParameters>
                                                    <asp:ControlParameter ControlID="Label1" Name="intInspectorID" PropertyName="Text" Type="Int32" />
                                                    <asp:Parameter Name="intCertificationID" Type="Int32" />
                                                </DeleteParameters>
                                            </asp:SqlDataSource>
                                        </telerik:RadPageView>
                                        <telerik:RadPageView runat="server" ID="PageView2">
                                            <asp:Label ID="Label2" Font-Bold="true" Font-Italic="true" Text='<%# Eval("intInspectorID") %>' Visible="false" runat="server" />
                                            <telerik:RadGrid ID="RadGrid3" DataSourceID="SqlDataSource4" GridLines="None" ShowGroupPanel="False" Skin="Office2007" runat="server"
                                                AutoGenerateEditColumn="True" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true">
                                                <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true" HideStructureColumns="true"></ExportSettings>
                                                <MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSource4" 
                                                        ShowHeader="True" AllowPaging="false" CommandItemDisplay="Top">
                                                    <Columns>
                                                        <telerik:GridBoundColumn DataField="intInspectorID" DataType="System.Int32" HeaderText="intInspectorID"
                                                            SortExpression="intInspectorID" UniqueName="intInspectorID" Visible="false">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="intDistrictID" DataType="System.Int32" HeaderText="intDistrictID"
                                                            SortExpression="intDistrictID" UniqueName="intDistrictID" Visible="false">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="intDistrictNumber" HeaderText="Districts" SortExpression="intDistrictNumber"
                                                            UniqueName="intDistrictNumber">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridButtonColumn ConfirmText="Delete this Inspector?" ButtonType="LinkButton"
                                                            CommandName="Delete" Text="Delete" UniqueName="DeleteColumn1">
                                                            <HeaderStyle Width="20px" />
                                                            <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                                                        </telerik:GridButtonColumn>
                                                    </Columns>
                                                    <EditFormSettings EditFormType="Template">
                                                        <FormTemplate>
                                                            <table style="width:100%; table-layout:fixed; margin: 0 0 0 0; background-color:#E6E6E6;">
                                                                <tr>
                                                                    <td align="right" style=" vertical-align:top;">
                                                                        <asp:Label ID="Label3" runat="server" Text="District:"></asp:Label>
                                                                    </td>
                                                                    <td align="left">
                                                                        <telerik:RadComboBox ID="cboDistrictEdit" runat="server" DataTextField='<%# Bind("intDistrictNumber") %>'
                                                                            DataValueField='<%# Bind("intDistrictID") %>' Text='<%# Bind("intDistrictNumber") %>'
                                                                            SelectedValue='<%# Bind("intDistrictID") %>' Skin="WebBlue">
                                                                            <Items>
                                                                                <telerik:RadComboBoxItem Text="--Select--" Value="" />
                                                                                <telerik:RadComboBoxItem Text="1" Value="1" />
                                                                                <telerik:RadComboBoxItem Text="2" Value="2" />
                                                                                <telerik:RadComboBoxItem Text="3" Value="3" />
                                                                                <telerik:RadComboBoxItem Text="4" Value="4" />
                                                                                <telerik:RadComboBoxItem Text="5" Value="5" />
                                                                                <telerik:RadComboBoxItem Text="6" Value="6" />
                                                                                <telerik:RadComboBoxItem Text="8" Value="8" />
                                                                                <telerik:RadComboBoxItem Text="9" Value="9" />
                                                                                <telerik:RadComboBoxItem Text="10" Value="10" />
                                                                                <telerik:RadComboBoxItem Text="11" Value="11" />
                                                                                <telerik:RadComboBoxItem Text="12" Value="12" />
                                                                            </Items>
                                                                        </telerik:RadComboBox>                                                                
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td colspan="2">
                                                                        <asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                                                                            runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'>
                                                                        </asp:Button
                                                                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>
                                                                    </td>
                                                                </tr>                                                                        
                                                        </FormTemplate>
                                                    </EditFormSettings>
                                                </MasterTableView>
                                            </telerik:RadGrid>
                                            <hr />
                                            <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:inspectors %>"
                                                    SelectCommand="getInspectorDistricts" SelectCommandType="StoredProcedure"
                                                    InsertCommand="insInspectorDistricts" InsertCommandType="StoredProcedure"
                                                    UpdateCommand="updInspectorDistricts" UpdateCommandType="StoredProcedure"
                                                    DeleteCommand="delInspectorDistrict" DeleteCommandType="StoredProcedure">
                                                <SelectParameters>
                                                    <asp:ControlParameter ControlID="Label2" Name="intInspectorID" PropertyName="Text" Type="Int32" />
                                                </SelectParameters>
                                                <InsertParameters>
                                                    <asp:ControlParameter ControlID="Label2" Name="intInspectorID" PropertyName="Text" Type="Int32" />
                                                    <asp:Parameter Name="intDistrictID" Type="Int32" />
                                                    <asp:Parameter Name="intDistrictNumber" Type="Int32" />
                                                </InsertParameters>
                                                <UpdateParameters>
                                                    <asp:ControlParameter ControlID="Label2" Name="intInspectorID" PropertyName="Text" Type="Int32" />
                                                    <asp:Parameter Name="intDistrictID" Type="Int32" />
                                                </UpdateParameters>
                                                <DeleteParameters>
                                                    <asp:ControlParameter ControlID="Label2" Name="intInspectorID" PropertyName="Text" Type="Int32" />
                                                    <asp:Parameter Name="intDistrictID" Type="Int32" />
                                                </DeleteParameters>
                                            </asp:SqlDataSource>
                                        </telerik:RadPageView>
                                    </telerik:RadMultiPage>
                                      
                                </div>
                                </asp:Panel>
                            </NestedViewTemplate>
                             <ParentTableRelation >
                                <telerik:GridRelationFields DetailKeyField="intInspectorID" MasterKeyField="intInspectorID" />
                             </ParentTableRelation>
                            <CommandItemSettings ShowExportToExcelButton="True" ShowRefreshButton="False" ExportToPdfText="Export to Pdf" />
                            <ExpandCollapseColumn Visible="True">
                                <HeaderStyle Width="15px" />
                                <ItemStyle Width="15px" />
                            </ExpandCollapseColumn>
                        </MasterTableView>
                    </telerik:RadGrid>
                </td>
            </tr>
            <tr>
                <td>
                      
                </td>
            </tr>
        </table>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:inspectors %>" 
    SelectCommand="getInspectors" SelectCommandType="StoredProcedure" 
    InsertCommand="insInspectorInfo" InsertCommandType="StoredProcedure" 
    UpdateCommand="updInspectorInfo" UpdateCommandType="StoredProcedure" 
    DeleteCommand="delInspectorInfo" DeleteCommandType="StoredProcedure">
    <SelectParameters>
        <asp:ControlParameter ControlID="TextBox1" Name="WhereClause" PropertyName="Text"
            Type="String" DefaultValue=" " />
    </SelectParameters>
    <UpdateParameters>
        <asp:Parameter Name="intInspectorID" Type="Int32" />
        <asp:Parameter Name="strFirstName" Type="String" />
        <asp:Parameter Name="strMiddleName" Type="String" />
        <asp:Parameter Name="strLastName" Type="String" />
        <asp:Parameter Name="strAddress1" Type="String" />
        <asp:Parameter Name="strAddress2" Type="String" />
        <asp:Parameter Name="strCity" Type="String" />
        <asp:Parameter Name="strState" Type="String" />
        <asp:Parameter Name="strZipCode" Type="String" />
        <asp:Parameter Name="intHomeDistrict" Type="Int32" />
        <asp:Parameter Name="strEmail" Type="String" />
        <asp:Parameter Name="strHomePhone" Type="String" />
        <asp:Parameter Name="strCellPhone" Type="String" />
    </UpdateParameters>
    <InsertParameters>
        <asp:Parameter Name="strFirstName" Type="String" />
        <asp:Parameter Name="strMiddleName" Type="String" />
        <asp:Parameter Name="strLastName" Type="String" />
        <asp:Parameter Name="strAddress1" Type="String" />
        <asp:Parameter Name="strAddress2" Type="String" />
        <asp:Parameter Name="strCity" Type="String" />
        <asp:Parameter Name="strState" Type="String" />
        <asp:Parameter Name="strZipCode" Type="String" />
        <asp:Parameter Name="intHomeDistrict" Type="Int32" />
        <asp:Parameter Name="strEmail" Type="String" />
        <asp:Parameter Name="strHomePhone" Type="String" />
        <asp:Parameter Name="strCellPhone" Type="String" />
    </InsertParameters>
    <DeleteParameters>
        <asp:Parameter Name="intInspectorID" Type="Int32" />
    </DeleteParameters>
</asp:SqlDataSource>
aspx.vb
Partial Class inspectors_Default
    Inherits System.Web.UI.Page
  
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim dvSql As Data.DataView = DirectCast(SqlDataSource2.Select(DataSourceSelectArguments.Empty), Data.DataView)
        Dim dvSql2 As Data.DataView = DirectCast(SqlDataSource5.Select(DataSourceSelectArguments.Empty), Data.DataView)
  
        For Each drvSql As Data.DataRowView In dvSql
            Dim chkCheckbox As CheckBox = New CheckBox
            chkCheckbox.Text = drvSql("strCertificationDesc").ToString
            chkCheckbox.ID = ("c1" & drvSql("intCertificationID").ToString)
            Me.pnlCertifications.ContentTemplateContainer.Controls.Add(chkCheckbox)
        Next
        For Each drvSql2 As Data.DataRowView In dvSql2
            Dim chkCheckbox2 As CheckBox = New CheckBox
            chkCheckbox2.Text = drvSql2("intDistrictNumber").ToString
            chkCheckbox2.ID = ("c2" & drvSql2("intDistrictID").ToString)
            Me.pnlDistricts.ContentTemplateContainer.Controls.Add(chkCheckbox2)
        Next
  
    End Sub
  
    Protected Sub RadGrid1_DetailTableDataBind(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridDetailTableDataBindEventArgs) Handles RadGrid1.DetailTableDataBind
        MsgBox(e.DetailTableView.DataSourceCount.ToString)
  
    End Sub
  
    Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
        If e.CommandName = Telerik.Web.UI.RadGrid.ExpandCollapseCommandName And (TypeOf (e.Item) Is Telerik.Web.UI.GridDataItem) Then
            Dim datItem2 As Telerik.Web.UI.GridDataItem = e.Item
            datItem2.ChildItem.FindControl("InnerContainer").Visible = Not e.Item.Expanded
        End If
        If e.CommandName = Telerik.Web.UI.RadGrid.ExportToExcelCommandName Then
            RadGrid1.MasterTableView.HierarchyDefaultExpanded = True
            RadGrid1.ExportSettings.IgnorePaging = True
  
            RadGrid1.MasterTableView.ExportToExcel()
        End If
        'If e.CommandName = Telerik.Web.UI.RadGrid.ExportToPdfCommandName Then
        '    RadGrid1.MasterTableView.HierarchyDefaultExpanded = True
        '    'RadGrid1.ExportSettings.IgnorePaging = True
  
        '    'RadGrid1.MasterTableView.ExportToPdf()
        'End If
  
    End Sub
  
    Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated
        If (TypeOf (e.Item) Is Telerik.Web.UI.GridNestedViewItem) Then
            Dim datItem2 As Telerik.Web.UI.GridNestedViewItem = e.Item
            e.Item.FindControl("InnerContainer").Visible = datItem2.ParentItem.Expanded
        End If
        If TypeOf e.Item Is Telerik.Web.UI.GridFilteringItem Then
  
            Dim filteringItem As Telerik.Web.UI.GridFilteringItem = CType(e.Item, Telerik.Web.UI.GridFilteringItem)
            'set dimensions for the filter textbox   
            Dim box As TextBox = CType(filteringItem("strFirstName").Controls(0), TextBox)
            box.Width = Unit.Pixel(50)
            box = CType(filteringItem("strLastName").Controls(0), TextBox)
            box.Width = Unit.Pixel(50)
            box = CType(filteringItem("intHomeDistrict").Controls(0), TextBox)
            box.Width = Unit.Pixel(25)
        End If
    End Sub
  
    Protected Sub cmdSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim strWhereClause As String = ""
        Dim strWhereClause1 As String = ""
        Dim strWhereClause2 As String = ""
        Dim cControl As Control
  
        For Each cControl In Me.pnlCertifications.ContentTemplateContainer.Controls
            If TypeOf cControl Is CheckBox Then
                Dim chkCheckbox As System.Web.UI.WebControls.CheckBox = CType(cControl, CheckBox)
                If chkCheckbox.Checked = True Then
                    strWhereClause1 = strWhereClause1 & " OR tblCertifications.intCertificationID = " & Mid(chkCheckbox.ID.ToString, 3)
                End If
            End If
        Next
        For Each cControl In Me.pnlDistricts.ContentTemplateContainer.Controls
            If TypeOf cControl Is CheckBox Then
                Dim chkCheckbox As System.Web.UI.WebControls.CheckBox = CType(cControl, CheckBox)
                If chkCheckbox.Checked = True Then
                    strWhereClause2 = strWhereClause2 & " OR tblDistricts.intDistrictID = " & Mid(chkCheckbox.ID.ToString, 3)
                End If
            End If
        Next
  
        If strWhereClause1 <> "" Then
            strWhereClause = " AND (" & Mid(strWhereClause1, 5) & ")"
        End If
        If strWhereClause2 <> "" Then
            strWhereClause = strWhereClause & " AND (" & Mid(strWhereClause2, 5) & ")"
        End If
  
        If strWhereClause <> "" Then
            strWhereClause = Mid(strWhereClause, 6) & " AND (tblInspectors.blnInactive = 0)"
        End If
  
        Me.TextBox1.Text = strWhereClause
  
    End Sub
  
    Protected Sub cmdReset_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  
        Dim cControl As Control
        For Each cControl In Me.pnlCertifications.ContentTemplateContainer.Controls
            If TypeOf cControl Is CheckBox Then
                Dim chkCheckbox As System.Web.UI.WebControls.CheckBox = CType(cControl, CheckBox)
                chkCheckbox.Checked = False
            End If
        Next
        For Each cControl In Me.pnlDistricts.ContentTemplateContainer.Controls
            If TypeOf cControl Is CheckBox Then
                Dim chkCheckbox As CheckBox = CType(cControl, CheckBox)
                chkCheckbox.Checked = False
            End If
        Next
  
        Me.TextBox1.Text = ""
    End Sub
  
End Class

Sorry about that Tsvetoslav.  I could probably debug this on my own if I new how to step through the embedded sqldatasource events.  However, the code-behind page doesn't recognize the embedded radgrids nor the embedded sqldatasources.

Thanks.
0
Tsvetoslav
Telerik team
answered on 04 Jul 2011, 11:35 AM
Hello Richard,

Thanks for the code.

You should remove the UpdatePanel control from your page and leave just the RadAjaxManager one. RadAjaxManager ajaxifies its controls by wrapping them in UpdatePanels and that's why in your case you are getting nested UpdatePanels and this sometimes breaks the ajax requests.

Other than that I could not see anything wrong with your code. If the problem persists even after the removal of the UpdatePanel, try attaching an event handler to the Deleting event of the grid and inspect the e.Command.Paramaters collection to see what parameters are being sent to the stored procedure and what value they have. In addition, you can also try setting a DefaultValue for the delete parameter of one of the SqlDataSources for the inner grids and see if that deletes the item with the hard-coded ID.

Hope it helps.

Best wishes,
Tsvetoslav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Richard
Top achievements
Rank 1
answered on 05 Jul 2011, 03:41 PM
Thanks Tsvetoslav.  As it turned out, it wasn't a conflict with the update panel.  I was able to successfully step through the sqldatasource 'delete' routine and finally figured out why the delete wouldn't work.  Within the MasterTableView of the embedded RadGrid, I had to specify two DataKeyNames since the embedded delete operation required both keys to be explicitly specified before it would recognize the gridcolumn fields.

Interestingly enough, the DataKeyNames weren't required to be specified when the 'Update' operation was called.  Just the 'Delete' operation.

Thanks for the help.
0
Tsvetoslav
Telerik team
answered on 08 Jul 2011, 03:36 PM
Hi Richard,

Glad to hear you have overcome the set-back with the delete operations.

Regards,
Tsvetoslav
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Richard
Top achievements
Rank 1
Share this question
or