I have two different grids on two different pages (one grid per page).
Both grids have been populated with data containing a single row.
Both grids have a GridButtonColumn for requesting processing against the data row.
Both grids are defined nearly exactly (except for data column names, etc.)
Both grids have a "_ItemCommand" in the code behind file for processing the buttons/data.
Both grids contain exactly the same code in the code behind file (except for the column name they are handling/examining).
The first grid functions perfectly and the button performs as advertised.
The second grid will not process correctly. It blows up with a "" error. It does see the button event. It does trigger the intended event code.
The code behind event code is:
The grid definition code is:
I have also attached two screen captures.
Many thanks in advance for any assistance you can give me!
Lynn
Both grids have been populated with data containing a single row.
Both grids have a GridButtonColumn for requesting processing against the data row.
Both grids are defined nearly exactly (except for data column names, etc.)
Both grids have a "_ItemCommand" in the code behind file for processing the buttons/data.
Both grids contain exactly the same code in the code behind file (except for the column name they are handling/examining).
The first grid functions perfectly and the button performs as advertised.
The second grid will not process correctly. It blows up with a "" error. It does see the button event. It does trigger the intended event code.
The code behind event code is:
protected void QualContsGrid_ItemCommand(Object source, Telerik.Web.UI.GridCommandEventArgs e){ if (e.CommandName == "RemoveContribution") { // First we need to get the key value of the record the user wants to remove from the list string code = (string)e.CommandArgument; string id = (e.Item as GridDataItem).GetDataKeyValue("VoterQualifyingContributionId").ToString(); Int32 iContributorRecKey = Convert.ToInt32(id); // Now we can get the record, change it (remove it from the list), and update it ElectronicPetitionSystemDataContext efdc = new ElectronicPetitionSystemDataContext(ConfigurationManager.ConnectionStrings["ElectronicPetitionSystemConnectionString"].ConnectionString); VoterQualifyingContribution qc = efdc.VoterQualifyingContributions.Single(qcrec => qcrec.VoterQualifyingContributionId == iContributorRecKey); string sFirst = qc.FirstName; string sLast = qc.LastName; qc.VoterQualifyingContributionStatusId = 2; efdc.SubmitChanges(); this.QualContsGrid.Rebind(); }}The grid definition code is:
<telerik:RadGrid AutoGenerateColumns="false" ID="QualContsGrid" runat="server" Width="765px" OnItemCommand="QualContsGrid_ItemCommand" Height="430px" 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="100px" UniqueName="VoterFirstName" HeaderText="First Name" DataField="FirstName" SortExpression="FirstName" > </telerik:GridBoundColumn> <telerik:GridBoundColumn HeaderStyle-Width="100px" 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="100px" 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>I have also attached two screen captures.
Many thanks in advance for any assistance you can give me!
Lynn