所以,我有一個radgrid控件與正在典型的編輯安排......現在不是。永遠不要觸發UpdateCommand事件,在那裏設置一個斷點並且不會到達。讓我瘋狂,因爲它一直工作得很好,我想不出我做了什麼會導致它。當我點擊編輯時,窗體打開就好,取消按鈕可以工作,但更新命令從不會觸發。 在網格我:Telerik的radgrid控件更新命令不點火
OnUpdateCommand="pendingVehiclesRadGrid_UpdateCommand"
And in my code behind I have:
protected void pendingVehiclesRadGrid_UpdateCommand(object source, GridCommandEventArgs e)
{
blah blah
}
看起來很簡單,但就像我說的什麼都沒有。我會一如既往深深地感謝有新鮮眼光的人可以提出建議。
編輯添加XML:
<telerik:RadGrid ID="pendingVehiclesRadGrid" runat="server" AutoGenerateColumns="False"
CellSpacing="0" GridLines="None" AllowPaging="True"
DataMember="ID"
onneeddatasource="pendingVehiclesRadGrid_NeedDataSource"
OnUpdateCommand="pendingVehiclesRadGrid_UpdateCommand" PageSize="20"
onitemcommand="pendingVehiclesRadGrid_ItemCommand" >
<MasterTableView DataKeyNames="status,charity,make,model,year,vin,date,id,salePrice,bid,note"
EditMode="EditForms">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridButtonColumn CommandName="History" Text="History" UniqueName="detailBtn" HeaderText="History" HeaderButtonType="PushButton" AutoPostBackOnFilter="True">
</telerik:GridButtonColumn>
<telerik:GridBoundColumn HeaderText="Charity" ItemStyle-Width="140px" FilterControlAltText="Filter column2 column"
UniqueName="column3" DataType="System.String" DataField="charity" ReadOnly="True">
<ItemStyle Width="140px"></ItemStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="VIN" ItemStyle-Width="140px" FilterControlAltText="Filter column6 column"
UniqueName="column7" DataType="System.String" DataField="vin" >
<ItemStyle Width="140px"></ItemStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Year" ItemStyle-Width="140px" FilterControlAltText="Filter column2 column"
UniqueName="column2" DataType="System.Int32" DataField="year">
<ItemStyle Width="140px"></ItemStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Make" ItemStyle-Width="140px" FilterControlAltText="Filter column column"
UniqueName="column" DataType="System.String" DataField="make">
<ItemStyle Width="140px"></ItemStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Model" ItemStyle-Width="140px" FilterControlAltText="Filter column1 column"
UniqueName="column1" DataType="System.String" DataField="model">
<ItemStyle Width="140px"></ItemStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Last Update" ItemStyle-Width="140px" FilterControlAltText="Filter column1 column"
UniqueName="column5" DataType="System.DateTime" DataField="date" ReadOnly="True">
<ItemStyle Width="140px"></ItemStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Min. Bid" ItemStyle-Width="140px" FilterControlAltText="Filter column1 column"
UniqueName="column8" DataType="System.Decimal" DataField="bid" DataFormatString="{0:C}" >
<ItemStyle Width="140px"></ItemStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Sale Price" ItemStyle-Width="140px" FilterControlAltText="Filter column1 column"
UniqueName="column6" DataType="System.Decimal" DataField="salePrice" DataFormatString="{0:C}" Display="False">
<ItemStyle Width="140px"></ItemStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Notes" ItemStyle-Width="140px" FilterControlAltText="Filter column1 column"
UniqueName="unsoldNotesColumn" DataType="System.String" DataField="note" Display="True">
<ItemStyle Width="140px"></ItemStyle>
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Latest Status" ItemStyle-Width="240px">
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "Status")%>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadComboBox RenderMode="Lightweight" runat="server" ID="pendingVehiclesRadGridupdateComboBox" DataTextField="Status"
DataValueField="ID" DataSourceID="LinqDataSource1" >
</telerik:RadComboBox>
</EditItemTemplate>
<ItemStyle Width="240px"></ItemStyle>
</telerik:GridTemplateColumn>
<telerik:GridEditCommandColumn FooterText="EditCommand footer" UniqueName="pendingVehiclesRadGridEditCommandColumn"
HeaderText="Edit" HeaderStyle-Width="100px" UpdateText="Update">
<HeaderStyle Width="100px"></HeaderStyle>
</telerik:GridEditCommandColumn>
</Columns>
<EditFormSettings EditColumn-DataType="System.String">
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>
請顯示RadGrid的整個XAML。我認爲你的命令按鈕有問題。 – modiX
@modiX我在這裏相當新...我怎麼能在評論中發佈整個事情?對不起:( – PaulBinCT2
@ PaulBinCT2你可以編輯你的問題,而不是把它放在註釋中 – Scotty