I am attempting to rebind a grid (grdContributions) after the user has selected a row (client side selection) using the RowSelected event below:
function RowSelected(sender, eventArgs)
{
var tableView = $find("<%= grdContributionDetails.ClientID %>").get_masterTableView();
tableView.set_dataSource(result);
tableView.dataBind();
}
The following error is generated in the borwser when I compile the code:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
What I am trying to accomplish is to rebind a grid (grdContributionDetails) based upon the selection of a row in another grid (grdContribution). The above event is fired when the user selects a row in grdContribution.
What is causing this error and how can I resolve it?
Thank you,
Michael
| Protected Sub RadRotator1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadRotatorEventArgs) Handles RadRotator1.ItemDataBound |
| Dim ImgElem As New ImageElement |
| Dim IDraw As Neodynamic.WebControls.ImageDraw.ImageDraw = RadRotator1.FindControl("ImageDraw1") |
| Dim labelPath As System.Web.UI.WebControls.Label = RadRotator1.FindControl("lblPath") |
| Dim labelUrl As System.Web.UI.WebControls.Label = RadRotator1.FindControl("lblUrl") |
| Dim Shadow As New Neodynamic.WebControls.ImageDraw.DropShadow |
| Shadow.Color = Drawing.Color.DimGray |
| Dim ResizeH As New Neodynamic.WebControls.ImageDraw.Resize |
| Dim ResizeW As New Neodynamic.WebControls.ImageDraw.Resize |
| ImgElem = ImageElement.FromFile(labelPath.Text.ToString) |
| ImgElem.Actions.Add(Shadow) |
| If ImgElem.Height > 400 Then |
| ResizeH.Height = 400 |
| ResizeH.LockAspectRatio = LockAspectRatio.HeightBased |
| ImgElem.Actions.Add(ResizeH) |
| End If |
| If ImgElem.Width > 600 Then |
| ResizeW.Width = 600 |
| ResizeW.LockAspectRatio = LockAspectRatio.WidthBased |
| ImgElem.Actions.Add(ResizeW) |
| End If |
| IDraw.Elements.Add(ImgElem) |
| End Sub |
| <telerik:RadPanelBar ID="RadPanelBar1" runat="server" AppendDataBoundItems="True" |
| Skin="Web20" Width="198px" onitemclick="RadPanelBar1_ItemClick"> |
| <CollapseAnimation Type="None" Duration="100"></CollapseAnimation> |
| <Items> |
| <telerik:RadPanelItem runat="server" Expanded="True" Text="Employees" SelectedCssClass="" |
| ExpandedCssClass="" PreventCollapse="True" Value="Employees"> |
| <Items> |
| <telerik:RadPanelItem runat="server" Text="Add" SelectedCssClass="" CssClass="thickbox" |
| NavigateUrl="CensusDetails.aspx?TB_iframe=true&height=550&width=600" title="Add New Employee"> |
| </telerik:RadPanelItem> |
| <telerik:RadPanelItem runat="server" Text="Terminate" SelectedCssClass="" |
| Value="Terminate"> |
| </telerik:RadPanelItem> |
| <telerik:RadPanelItem runat="server" Text="Import (coming soon)" SelectedCssClass=""> |
| </telerik:RadPanelItem> |
| </Items> |
| </telerik:RadPanelItem> |
| <telerik:RadPanelItem runat="server" Text="Company" Value="Company" PreventCollapse="True"> |
| </telerik:RadPanelItem> |
| </Items> |
| <ExpandAnimation Type="None" Duration="100"></ExpandAnimation> |
| </telerik:RadPanelBar> |
| protected void RadPanelBar1_ItemClick(object sender, RadPanelBarEventArgs e) |
| { |
| switch (e.Item.Text) |
| { |
| case "Terminate": |
| { |
| foreach (GridDataItem row in CenusGrid.SelectedItems) |
| { |
| TerminateEmployees(Convert.ToInt32(row.GetDataKeyValue("CensusID"))); |
| } |
| break; |
| } |
| } |
| CenusGrid.DataBind(); |
| } |
| RadPanelItem radTerminate = RadPanelBar1.Items.FindItemByValue("Employees"); |
| switch (radTerminate.Items.FindItemByValue("Terminate").Value) |
| { |
| case "Terminate": |
| { |
| radTerminate.Items.FindItemByValue("Terminate").Attributes.Add("onclick", "javascript:return confirm('Are you sure you want to delete this record?')"); |
| break; |
| } |
| } |