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

Delete raise error

2 Answers 31 Views
Grid
This is a migrated thread and some comments may be shown as answers.
lakmal
Top achievements
Rank 2
lakmal asked on 04 Sep 2009, 11:34 AM
Hi,

This is my grid and datasource. When i delete its raise this error. Why that?

Could not find control 'RadComp' in ControlParameter 'IDCcomID'.


 <telerik:RadGrid ID="RadGrid5" runat="server" AutoGenerateColumns="False"  AllowAutomaticInserts="True"
        AllowAutomaticUpdates="True" AllowAutomaticDeletes="false"
                                        GridLines="None" DataSourceID="SqlDataSource2" Width="400px"
                                AllowSorting="True" Skin="Web20" >
                                <MasterTableView AutoGenerateColumns="False" DataKeyNames="DocNo" CommandItemDisplay="TopAndBottom" AllowAutomaticDeletes="true" AllowAutomaticInserts="true" >
                                
                                    <Columns>
                                                                             
                                        <telerik:GridBoundColumn DataField="DocNo" HeaderText="Doc No" Visible="false" ReadOnly="true"
                                            UniqueName="DocNo">
                                        </telerik:GridBoundColumn>
                                        
                                      <telerik:GridTemplateColumn UniqueName="TemplateColumn1" HeaderText="Doc Own AppComment">                                        
                                        <ItemTemplate>                                        
                                         <telerik:RadComboBox runat="server"
                                             ID="RadComp"
                                             DataTextField="DocOwnAppComment"
                                             DataValueField="DocOACID"
                                             HighlightTemplatedItems="true"
                                             Height="190px"
                                             Width="220px"
                                             DropDownWidth="420px"
                                                DataSourceID="ContactsDataSource"
                                                SelectedValue='<%#Bind("IDCcomID") %>'></telerik:RadComboBox>
                                        
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                        
                                        <telerik:RadComboBox runat="server"
                                             ID="RadCompEdit"
                                             DataTextField="DocOwnAppComment"
                                             DataValueField="DocOACID"
                                             HighlightTemplatedItems="true"
                                             Height="190px"
                                             Width="220px"
                                             DropDownWidth="420px"
                                                DataSourceID="ContactsDataSource"
                                                SelectedValue='<%#Bind("IDCcomID") %>'></telerik:RadComboBox>
                                                
                                        
                                        </EditItemTemplate>                                        
                                        </telerik:GridTemplateColumn>                                    
                                        
                                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmText="Are you sure delete this record?"
                                            Text="Delete" UniqueName="column">
                                        </telerik:GridButtonColumn>
                                       </Columns>
                                    
                                </MasterTableView>
                              </telerik:RadGrid>


 <asp:SqlDataSource ID="SqlDataSource2"
                                    ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>" runat="server"
                                    SelectCommand="SELECT DocNo , [IDCcomID] FROM [tbl_DATA_IDCcomment] WHERE (DocNo = @DocNo)"
                                    DeleteCommand="DELETE FROM [tbl_DATA_IDCcomment] WHERE [DocNo] = @DocNo and IDCcomID=@IDCcomID "
                                    InsertCommand="INSERT INTO tbl_DATA_IDCcomment(DocNo, IDCcomID) VALUES (@DocNo, @IDCcomID)" >
                                  <SelectParameters>                                                                           
                                        <asp:ControlParameter ControlID="Label1" PropertyName="Text" Type="String" Name="DocNo" />
                                    </SelectParameters>
                                                                        
                                     <DeleteParameters>
                                           <asp:ControlParameter ControlID="Label1" PropertyName="Text" Type="String" Name="DocNo" />   
                                           <asp:ControlParameter ControlID="RadComp" PropertyName="SelectedValue" Type="Int32" Name="IDCcomID" />  
                                    </DeleteParameters>
                                    <InsertParameters>
                                            <asp:ControlParameter ControlID="Label1" PropertyName="Text" Type="String" Name="DocNo" />   
                                           <asp:ControlParameter ControlID="RadCompEdit" PropertyName="SelectedValue" Type="Int32" Name="IDCcomID" />  
                                    </InsertParameters>
                                </asp:SqlDataSource>








2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 04 Sep 2009, 12:05 PM
Hello lak,

You cannot have control parameter with control which is inside of different INamingContainer. In your case you have this control inside repeating control (RadGrid) and finally you will get page-size controls of this type.

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
lakmal
Top achievements
Rank 2
answered on 04 Sep 2009, 12:44 PM
How can i solve this. Have you any sample code?

krds
lakmal
Tags
Grid
Asked by
lakmal
Top achievements
Rank 2
Answers by
Vlad
Telerik team
lakmal
Top achievements
Rank 2
Share this question
or