I am using VS 2013 VB. I have a aspxgridview that uses objectdatasource. One of the columns is a command column used as a checkbox named "Select". When the user selects a checkbox and then goes to another page and then back to the page where they made a selected checkbox that check mark is gone. It is not retaining the selection. This is a grid of inventory items. I want to make multiple selections and then click on a button. On the button click I want to open a separate page with the items that were checked. This is to create a work order.
Any ideas of how to accomplish this? I am using VB not C#. Thanks in advance! Below is the grid:
<dx:ASPxGridView ID="gvInventory" runat="server" AutoGenerateColumns="False" DataSourceID="InventoryDataSource" EnableTheming="True" Theme="Office2003Olive" EnableRowsCache="False" KeyFieldName="ID_Number">
<Columns>
<dx:GridViewDataTextColumn FieldName="ID_Number" Visible="False" VisibleIndex="7">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Caption="Item" FieldName="Item_Number" VisibleIndex="2" Width="25px">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Caption="Description" FieldName="Item_Description" VisibleIndex="3">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Caption="Cost" FieldName="Current_Cost" VisibleIndex="6" Width="15px">
<PropertiesTextEdit DisplayFormatString="{0:c}">
</PropertiesTextEdit>
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Caption="WH" FieldName="Warehouse_Location" VisibleIndex="4" Width="15px">
</dx:GridViewDataTextColumn>
<dx:GridViewDataDateColumn Caption="Date Rcv'd" FieldName="Last_Receipt_Date" VisibleIndex="1" Width="25px">
</dx:GridViewDataDateColumn>
<dx:GridViewDataTextColumn Caption="QTY On Hand" FieldName="Quantity_On_Hand" VisibleIndex="5" Width="20px">
<HeaderStyle Wrap="True" />
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Current_Month_Issue_Quantity" Visible="False" VisibleIndex="17">
</dx:GridViewDataTextColumn>
**<dx:GridViewCommandColumn Caption="Select" ShowInCustomizationForm="True" ShowSelectCheckbox="True" VisibleIndex="0">
</dx:GridViewCommandColumn>**
Changed Checkbox to: *
*<dx:GridViewDataTextColumn ShowInCustomizationForm="True" VisibleIndex="0">
<DataItemTemplate>
<dx:ASPxCheckBox ID="wed" runat="server" OnInit="cb_Init">
</dx:ASPxCheckBox>
</DataItemTemplate>
</dx:GridViewDataTextColumn>*
*
Added:
</dx:ASPxGridView>
<dx:ASPxHiddenField ID="hf" runat="server" ClientInstanceName="hf">
</dx:ASPxHiddenField>
In .vb page added:
Protected Sub cb_Init(ByVal sender As Object, ByVal e As EventArgs)
Dim cb As ASPxCheckBox = CType(sender, ASPxCheckBox)
Dim container As GridViewDataItemTemplateContainer = CType(cb.NamingContainer, GridViewDataItemTemplateContainer)
Dim key As String = String.Format("{0}_{1}", container.Column.Name, container.VisibleIndex)
cb.ClientSideEvents.CheckedChanged = String.Format("function(s, e) {{ hf.Set('{0}', s.GetChecked()); }}", key)
cb.ClientSideEvents.Init = String.Format("function(s, e) {{ s.SetChecked(hf.Get('{0}')); }}", key)
End Sub
I found this at: https://www.devexpress.com/Support/Center/Question/Details/Q527992
Thank you, KRob for all of your help!
Please see original post. I show the changes that I made there. I found the information at: https://www.devexpress.com/Support/Center/Question/Details/Q527992
Thank you again KRob!