I am trying to modify the filter menus on the grid at runtime using an example directly from your onlne manual, but the Grid_Init event code in the server is not firing.
Can anyone tell me what I am doing wrong?
Here's the actual grid definition from the .aspx:
The code behind contains:
The only reason the line of code "a = menu.Items[i].Text;" is in there is that I had a debug stop placed on it (and it never executed). I also had a debug stop on the very first line in this event's code and it never fired.
On code/debug stops in Page_Init and Page_Load did fire correctly.
Also, code (and the debug stop) in the "QualContsGrid_AjaxRequest" DID execute correctly.
How do I get the RadGrid_Init event code to fire?
Thanks in advance!
Lynn
Can anyone tell me what I am doing wrong?
Here's the actual grid definition from the .aspx:
<telerik:RadGrid AutoGenerateColumns="false" ID="QualContsGrid" runat="server" Width="800px" OnItemCommand="QualContsGrid_ItemCommand" Height="430px" On AllowSorting="true" AllowFilteringByColumn="true" EnableLinqExpressions="true" OnItemDataBound="QualContsGrid_ItemDataBound" AllowPaging="true" PageSize="15" BorderWidth="1px" BorderColor="#999999" EnableEmbeddedSkins="true" Skin="Default" DataSourceID="SQLDataSource1" ShowFooter="True" GridLines="None" > <StatusBarSettings ReadyText="Ready" LoadingText="Loading..." /> <MasterTableView > <Columns> <telerik:GridBoundColumn HeaderStyle-Width="125px" UniqueName="VoterFirstName" HeaderText="First Name" DataField="FirstName" SortExpression="FirstName" > </telerik:GridBoundColumn> <telerik:GridBoundColumn HeaderStyle-Width="125px" UniqueName="VoterLastName" HeaderText="Last Name" DataField="LastName" SortExpression="LastName" > </telerik:GridBoundColumn> <telerik:GridBoundColumn HeaderStyle-Width="300px" UniqueName="VoterAddress" HeaderText="Address" DataField="Address" SortExpression="Address" > </telerik:GridBoundColumn > <telerik:GridButtonColumn DataTextFormatString="Remove" ButtonType="PushButton" UniqueName="RemoveContribution" HeaderStyle-Width="75px" ConfirmText="Are you certain that you want to remove this contribution?" Text="Remove" HeaderText="Remove" CommandName="RemoveContribution" CommandArgument="VoterQualifyingContributionId" DataTextField="VoterQualifyingContributionId" > </telerik:GridButtonColumn> <telerik:GridBoundColumn HeaderStyle-Width="125px" UniqueName="ContributionStatus" HeaderText="Status" DataField="PaymentDescription" SortExpression="PaymentDescription" > </telerik:GridBoundColumn > <telerik:GridBoundColumn UniqueName="VoterQualifyingContributionId" HeaderText="" DataField="VoterQualifyingContributionId" Visible="false" > </telerik:GridBoundColumn > </Columns> </MasterTableView> <ClientSettings> <Scrolling AllowScroll="true" UseStaticHeaders="true" /> </ClientSettings></telerik:RadGrid>The code behind contains:
protected void QualContsGrid_Init(object sender, System.EventArgs e){ GridFilterMenu menu = QualContsGrid.FilterMenu; int i = 0; string a = ""; while (i < menu.Items.Count) { a = menu.Items[i].Text; 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); } }}The only reason the line of code "a = menu.Items[i].Text;" is in there is that I had a debug stop placed on it (and it never executed). I also had a debug stop on the very first line in this event's code and it never fired.
On code/debug stops in Page_Init and Page_Load did fire correctly.
Also, code (and the debug stop) in the "QualContsGrid_AjaxRequest" DID execute correctly.
How do I get the RadGrid_Init event code to fire?
Thanks in advance!
Lynn