[CLOSED] DirectEvent In Button Menu
I have a form with gridpanel,
here is my DirectEvent in Code Behind
Code:
Public Sub SaveItemStatus()
Try
Dim SelectedItems As String = Nothing
Dim smt As RowSelectionModel = TryCast(Me.gpanel1.SelectionModel.Primary, RowSelectionModel)
For Each rowt As SelectedRow In smt.SelectedRows
SelectedItems = SelectedItems & "," & rowt.RecordID
Next
SelectedItems = Mid(SelectedItems, 2, SelectedItems.Length)
ezmanHelper.orders.SP_UPDATE_ORD_ITEM_STATUS_VIA_STRING(SelectedItems, Users.CurrentUserId, cmbItemStatus.SelectedItem.Value)
storeitems.DataBind()
Catch ex As Exception
Ext.Net.X.Msg.Alert("Response", "Please try again or contact to administrator.<br>" & ex.Message).Show()
End Try
End Sub
When i fire above directevent from any button in the form the FOR LOOP works and it gives me the ROW IDs AS i expected.
but When i put my button in a menu panel,FOR LOOP is not working and throwing exception "Object reference not set to an instance of an object". Below is the menu button that Fires the directevent but FOR LOOP can not access to my gridpanels selected row list
Code:
<ext:Button ID="btnChangeItemStatus" Hidden="true" runat="server" Icon="StyleGo" Text="Change Item Status">
<Menu>
<ext:Menu ID="Menu2" runat="server" Width="250" Layout="FormLayout" ShowSeparator="false">
<Items>
<ext:ComboBox Width="180" runat="server" DisplayField="OrdItemStatusTypeName" ValueField="OrdItemStatusTypeId" Text="Select Status" ID="ComboBox2">
<Store>
<ext:Store runat="server" DataSourceID="dtsItemsStatus" ID="store2">
<Model>
<ext:Model runat="server" ID="model7" IDProperty="OrdItemStatusTypeId">
<Fields>
<ext:ModelField Name="OrdItemStatusTypeId" Type="Int"></ext:ModelField>
<ext:ModelField Name="OrdItemStatusTypeName" Type="String"></ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:ComboBox>
<ext:Button Width="180" runat="server" ID="Button2" Icon="Accept" Text="Save">
<DirectEvents>
<Click OnEvent="SaveItemStatus">
<EventMask ShowMask="true" UseMsg="true" Msg="Please wait while items' status changing....."></EventMask>
</Click>
</DirectEvents>
</ext:Button>
</Items>
</ext:Menu>
</Menu>
</ext:Button>