I am trying to modify the filter menus in a grid. I have done this before (successfully), so I copied the event code from the other web page that was working fine, pasted it into a second .aspx, and everytime it executes it goes into a CPU loop -- which I cannot locate the source of using normal debugging techniques.
I have attached a screen capture of the grid at run-time so you can visualize it.
The source code for the actual grid is immediately below, and the related event code which is causing the problem is included below that. If I comment out the event code, the page runs fine. If I let the While..Loop execute, a cpu-loop will result without any debug stops being executed.
Any help would be most appreciated! It will probably turn out to be something stupid I am doing, but for the life of me, I cannot find it.
Thanks for any assistance in advance!
Lynn
Now the relevant event code:
I have attached a screen capture of the grid at run-time so you can visualize it.
The source code for the actual grid is immediately below, and the related event code which is causing the problem is included below that. If I comment out the event code, the page runs fine. If I let the While..Loop execute, a cpu-loop will result without any debug stops being executed.
Any help would be most appreciated! It will probably turn out to be something stupid I am doing, but for the life of me, I cannot find it.
Thanks for any assistance in advance!
Lynn
<telerik:RadGrid ID="gvCCECCommitteeProperties" GridLines="None" AutoGenerateColumns="false" PageSize="15" EnableEmbeddedSkins="true" Skin="Default" Width="99%" AllowFilteringByColumn="true" AllowAutomaticDeletes="false" AllowMultiRowEdit="false" AllowMultiRowSelection="false" AllowPaging="true" AllowSorting="false" runat="server" OnItemCreated="gvCCECCommitteeProperties_ItemCreated" DataSourceID="SqlDataSource1" AllowAutomaticUpdates="true" AllowAutomaticInserts="False" OnInit="gvCCECCommitteeProperties_Init" SelectCommandType="StoredProcedure" SelectCommand="SelectEmployees" UpdateCommandType="" UpdateCommand="UPDATE [CCECCommitteeProperties] SET [LastName] = @LastName, [FirstName] = @FirstName, [MiddleName] = @MiddleName, [Suffix] = @Suffix, [IsDependent] = @IsIndependent, [IsUnopposed] = @IsUnapplosed, [IsOneParty] = @IsOneParty, [IsPrimaryWinner] = @IsPrimaryWinner, [IsGeneralWinner] = @IsGeneralWinner, [IsActive] = @IsActive, [IsQualifiedForBallot] = @IsQualifiedForBallot, [IsReallocated] = @IsReAllocated, [IsIncumbent] = @IsIncumbent WHERE [CCECCommitteePropertyID] = @CCECCommitteePropertyID" ShowStatusBar="true"> <MasterTableView ShowFooter="false" DataKeyNames="CCECCommitteePropertyID" EditMode="InPlace" CommandItemDisplay="TopAndBottom"> <Columns> <telerik:GridEditCommandColumn FooterText="EditCommand footer" UniqueName="EditCommandColumn" HeaderText="Edit" HeaderStyle-Width="100px" UpdateText="Update"> </telerik:GridEditCommandColumn> <telerik:GridTemplateColumn HeaderStyle-Width="250px" HeaderText="Names<br>(Last Name)" AllowFiltering="true" DataField="LastName"> <ItemTemplate> <div style="width: 250px"> <asp:Label Width="100px" ID="Label1" runat="server" Text="Last Name;" ></asp:Label> <asp:Label Width="100px" ID="txtLastName" runat="server" Text='<%# Bind("LastName") %>'></asp:Label> <br /> <asp:Label Width="100px" ID="Label2" runat="server" Text="First Name:" ></asp:Label> <asp:Label Width="100px" ID="txtFirstName" runat="server" Text='<%# Bind("FirstName") %>'></asp:Label> <br /> <asp:Label Width="100px" ID="Label4" runat="server" Text="Middle Name:" ></asp:Label> <asp:Label Width="100px" ID="txtMiddleName" runat="server" Text='<%# Bind("MiddleName") %>'></asp:Label> <br /> <asp:Label Width="100px" ID="Label3" runat="server" Text="Suffix:" ></asp:Label> <asp:Label Width="100px" ID="txtSuffix" runat="server" Text='<%# Bind("Suffix") %>'></asp:Label> </div> </ItemTemplate> <EditItemTemplate> <div style="width: 250px" > <asp:Label Width="100px" ID="Label1" runat="server" Text="Last Name;" ></asp:Label> <asp:TextBox Width="100px" ID="LastName" runat="server" Text='<%# Bind("LastName") %>'></asp:TextBox> <br /> <asp:Label Width="100px" ID="Label2" runat="server" Text="First Name:" ></asp:Label> <asp:TextBox Width="100px" ID="FirstName" runat="server" Text='<%# Bind("FirstName") %>'></asp:TextBox> <br /> <asp:Label Width="100px" ID="Label4" runat="server" Text="Middle Name:" ></asp:Label> <asp:TextBox Width="100px" ID="MiddleName" runat="server" Text='<%# Bind("MiddleName") %>'></asp:TextBox> <br /> <asp:Label Width="100px" ID="Label3" runat="server" Text="Suffix:" ></asp:Label> <asp:TextBox Width="100px" ID="Suffix" runat="server" Text='<%# Bind("Suffix") %>'></asp:TextBox> </div> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Information<br>(Filer Id)" AllowFiltering="true" DataField="CommitteeID"> <ItemTemplate> <div style="float: left;"> FilerID: <asp:Label ID="lblFilerID" runat="server" Text='<%# Eval("CommitteeID") %>'></asp:Label> <br /> Party: <asp:Label ID="lblCandidateParty" runat="server" Font-Bold="False" Text='<%# Eval("PartyName") %>'></asp:Label> </div> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridCheckBoxColumn AllowFiltering="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" DataField="IsActive" HeaderText="Active?" ></telerik:GridCheckBoxColumn> <telerik:GridCheckBoxColumn AllowFiltering="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" DataField="IsIndependent" HeaderText="Independent?" ></telerik:GridCheckBoxColumn> <telerik:GridCheckBoxColumn AllowFiltering="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" DataField="IsUnopposed" HeaderText="Unopposed?" ></telerik:GridCheckBoxColumn> <telerik:GridCheckBoxColumn AllowFiltering="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" DataField="IsOneParty" HeaderText="One Party<br>Dominant?" ></telerik:GridCheckBoxColumn> <telerik:GridCheckBoxColumn AllowFiltering="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" DataField="IsPrimaryWinner" HeaderText="Primary<br>Winner?" ></telerik:GridCheckBoxColumn> <telerik:GridCheckBoxColumn AllowFiltering="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" DataField="IsGeneralWinner" HeaderText="General<br>Winner?" ></telerik:GridCheckBoxColumn> <telerik:GridCheckBoxColumn AllowFiltering="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" DataField="IsQualifiedForBallot" HeaderText="Qualified<br>for Ballot?" ></telerik:GridCheckBoxColumn> <telerik:GridCheckBoxColumn AllowFiltering="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" DataField="IsReallocated" HeaderText="Reallocated?" ></telerik:GridCheckBoxColumn> <telerik:GridCheckBoxColumn AllowFiltering="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" DataField="IsIncumbent" HeaderText="Incumbent?" ></telerik:GridCheckBoxColumn> <telerik:GridBoundColumn Visible="false" DataField="OfficeID" ></telerik:GridBoundColumn> </Columns> </MasterTableView></telerik:RadGrid>Now the relevant event code:
protected void gvCCECCommitteeProperties_Init(object sender, System.EventArgs e){ GridFilterMenu menu = gvCCECCommitteeProperties.FilterMenu; int i = 0; while (i < menu.Items.Count) { if (i == 0) { if (menu.Items[i].Text == "NoFilter" || menu.Items[i].Text == "Contains" || menu.Items[i].Text == "StartsWith" || menu.Items[i].Text == "EqualTo") { i++; } else { menu.Items.RemoveAt(i); } } }}