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.
Here is my aspx page:
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> |