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

Dynamic RadGrid and OnRowDeleted AJAX error

6 Answers 125 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Bruce
Top achievements
Rank 2
Bruce asked on 08 Jul 2009, 06:56 PM
I am having a bad time with AJAX request and error message after first OnRowDeleted function call: "Multiple controls with the same ID 'ctl00' were found. FindControl requires that controls have unique IDs."

I build my radtabstrip and radpages and radgrids on pageload.

here is my code for code behind.

 Public Function gametemplate(ByVal dt As Data.DataTable) As RadGrid 
            Dim g As New RadGrid 
            g.ID = System.Guid.NewGuid.ToString 
            ' g.EnableViewState = False 
 
            g.AutoGenerateColumns = False 
            g.Skin = "Gray" 
            g.MasterTableView.DataKeyNames = New String() {"gameid"
            g.MasterTableView.ClientDataKeyNames = g.MasterTableView.DataKeyNames 
            g.MasterTableView.AllowAutomaticDeletes = "true" 
            g.ClientSettings.ClientEvents.OnRowDeleted = "deleteGame" 
 
 
            Dim hColumn As New GridBoundColumn 'home team 
            Dim aColumn As New GridBoundColumn 'away team 
            Dim sColumn As New GridBoundColumn 'gametime 
            Dim statusColumn As New GridBoundColumn 'status of game 
            Dim deleteC As New GridClientDeleteColumn 
            deleteC.ImageUrl = "/images/cross.png" 
            deleteC.ConfirmText = "Are you sure you want to remove game from schedule?" 
            deleteC.ButtonType = GridButtonColumnType.ImageButton 
            deleteC.UniqueName = "deleteit" 
            'Dim templateColumnName As String = "Delete" 
            'Dim templateColumn As New GridTemplateColumn() 
            'templateColumn.ItemTemplate = New MyTemplate(templateColumnName) 
            'templateColumn.HeaderText = templateColumnName 
 
            'Dim dColumn As New GridTemplateColumn() ' delete it 
            'dColumn.HeaderText = "Delete" 
 
            'Dim dButton As New GridImageButton(dColumn) 
            'dButton.ImageUrl = "/images/cross.png" 
            'dButton.OnClientClick = "return confirm('you da man');" 
            'dColumn.ItemTemplate.InstantiateIn(dButton) 
 
 
            With statusColumn 
                .HeaderText = "Status" 
                .DataField = "status" 
                .UniqueName = "status" 
            End With 
            hColumn.UniqueName = "hometeam" 
            hColumn.DataField = "hometeam" 
            hColumn.HeaderText = "Home" 
            aColumn.DataField = "awayteam" 
            aColumn.UniqueName = "awayteam" 
            aColumn.HeaderText = "Away" 
            sColumn.DataField = "start" 
            sColumn.UniqueName = "start" 
            sColumn.HeaderText = "Start" 
 
            g.MasterTableView.Columns.Add(sColumn) 
            g.MasterTableView.Columns.Add(hColumn) 
            g.MasterTableView.Columns.Add(aColumn) 
            g.MasterTableView.Columns.Add(statusColumn) 
            g.MasterTableView.Columns.Add(deleteC) 
            'g.Columns.Add(templateColumn) 
 
            g.DataSource = dt 
            g.DataBind() 
            Return g 
 
        End Function 
 
        Protected Sub createFieldTabs() 
            Dim fields As bo.fieldlist = fbll.getTournamentFields(Me.tournamentid) 
           
            If fields.Count >= 1 Then 
                For Each f As bo.Field In fields 
                    Dim newtab As New RadTab 
 
                    Dim newpage As New RadPageView 
 
 
 
                    newtab.Text = f.name 
                    newtab.PageViewID = newpage.ID 
 
                    newpage.Controls.Add(Me.gametemplate(gbll.getGamesForField(Me.tournamentid, f.fieldid))) 
 
                    fieldpages.PageViews.Add(newpage) 
 
                    fieldtabs.Tabs.Add(newtab) 
 
                    If fields.IndexOf(f) <= 0 Then fieldpages.SelectedIndex = newtab.Index 
                Next 
 
              
 
 
            End If 
 
        End Sub 

Here is my aspx page:

<%@ Page Language="VB" MasterPageFile="~/masters/SubPage.master" AutoEventWireup="false" CodeFile="tabs.aspx.vb" Inherits="thunder.apps.sa.pages.scheduletabs" title="Untitled Page" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"
 <sa:TournamentTools ID="TournamentTools1" runat="server" /> 
     <div style="clear:both;height:20px;"></div>  
 <telerik:RadCodeBlock ID="cb1" runat="server"
 
 
    <script language="javascript" type="text/javascript"
    var ajaxManager ; 
    function setManager(){ 
   ajaxManager = $find("<%= RadAjaxManager3.ClientID %>"); 
    } 
     function deleteGame(sender, eventArgs) 
    { 
       var gameid = eventArgs.getDataKeyValue("gameid"); 
       setManager(); 
      
       ajaxManager.ajaxRequest(gameid); 
         
    } 
 
    </script> 
    
   </telerik:RadCodeBlock> 
    <telerik:RadAjaxManager RequestQueueSize="2" EnableAJAX="true"   ID="RadAjaxManager3" runat="server"
    </telerik:RadAjaxManager> 
    
<fieldset><legend>Tournament Schedule</legend> 
 
 
    <telerik:RadTabStrip ID="fieldtabs" Skin="Gray" MultiPageID="fieldpages" runat="server"
    <Tabs> 
     
    </Tabs> 
     
    </telerik:RadTabStrip> 
    <telerik:RadMultiPage ID="fieldpages" runat="server"
         
    </telerik:RadMultiPage> 
</fieldset> 
 
</asp:Content> 
 
 

6 Answers, 1 is accepted

Sort by
0
Bruce
Top achievements
Rank 2
answered on 08 Jul 2009, 06:57 PM
here is the ajaxrequest function:

 
        Protected Sub RadAjaxManager3_AjaxRequest(ByVal sender As ObjectByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager3.AjaxRequest 
            Try 
                gbll.deleteGame(Convert.ToInt32(e.Argument)) 
                'RadAjaxManager3.Alert("Game deleted.") 
 
            Catch ex As Exception 
 
            End Try 
 
 
        End Sub 

0
Nikolay Rusev
Telerik team
answered on 14 Jul 2009, 09:44 AM
Hello Bruce,

Unfortunately we were able to reproduce the problem and will need a bit more time to investigate.
I will update the thread as soon as we  have any details on the behavior.

All the best,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Terry
Top achievements
Rank 1
answered on 16 Sep 2009, 02:56 PM
Hello,

Did you find a solution to this issue?

We are receiving this error: 
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Multiple controls with the same ID 'ctl00' were found. FindControl requires that controls have unique IDs.

This occurs when we click the Update Button on a GridTemplateForm.  The grid is on a user control which is added to a page dynamically.

Thanks,

TFISHER
0
Nikolay Rusev
Telerik team
answered on 22 Sep 2009, 05:44 AM
Hello Terry,

Could you please open formal support ticket and send us runnable project that replicates the issue?
We will do our best to help you to attain the functionality in your particular scenario.

Sincerely yours,
Nikolay
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
cyfirst
Top achievements
Rank 1
answered on 10 Feb 2010, 03:16 PM
Was there any resolution to this issue?  If there was would you please share the resolution as I am experiencing the same error when updating a table.
Thanks
0
Nikolay Rusev
Telerik team
answered on 15 Feb 2010, 01:27 PM
Hello cyfirst,

Could you please provide a bit more information for your scenario. Thus we'll be able to help you resolve the behavior which you are observing.

Kind regards,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Ajax
Asked by
Bruce
Top achievements
Rank 2
Answers by
Bruce
Top achievements
Rank 2
Nikolay Rusev
Telerik team
Terry
Top achievements
Rank 1
cyfirst
Top achievements
Rank 1
Share this question
or