Webgrid bound datasource with unbound Checkbox

2 replies. Last post: February 15, 2011 10:43 PM by Jason Wright
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Jason WrightMember

I'm sure this is a simple question to answer.  What I'd like to do (but seeming to have trouble with) is to have a webgrid with bound data, but have the first column being an unbound checkbox. 

 

The reason for this question is that I'd like the user to be able to select a number of rows they'd like to do some processing for.Ideally I'd like the user to be able to simply scroll down the datalist in the grid, and click the checkboxes corresponding to the rows they wish to process.  After they have finished ticking the checkboxes they wish to process, they click another button - and then I in the back end I'd scan the list for all boxes that were checked and do the necessary processing.

The webgrid I've setup only seems to allow you to check one checkbox at a time, and as I'm not updating any datasource, it doesn't appear to the back end that the checkbox has been checked, when it has.

Is there anyway to get this to work?

Webgrid below.

 

Thanks,

Jason.

 

html>
<head id="Head1" runat="server">
    <title>Warehouse Update</title>
    <link rel="stylesheet" type="text/css" href="../global.css" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="-1" />
    <meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />
</head>
<body id="Body1" runat="server">
    <form id="Form1" runat="server" style="height: 552px">
    <div>
        <ISWebDesktop:WebToolBar AutoPostBack="Yes" ID="WebToolBar1" runat="server" Caption="Sales Orders"
            CommandSize="" HeaderHeight="" Height="28px" IntegratedTo="None" NewDockingArea="NotSet"
            NewDockingRow="0" NewIsFloat="Default" Width="100%" OnCommandClick="WebToolBar1_CommandClick"
            AllowCustomize="No">
            <Commands>
                <ISWebDesktop:ToolCommand Category="WebToolBar1" DisplayMode="TextAndImage" Name="cmdOpen"
                    AutoPostBack="Yes" Image="~/Images/Open.gif" Text="Open" ToolTip="Open Sales Order">
                </ISWebDesktop:ToolCommand>
                <ISWebDesktop:ToolCommand Category="WebToolBar1" DisplayMode="TextAndImage" Name="cmdSave"
                    AutoPostBack="Yes" Image="~/Images/Save.gif" Text="Save" ToolTip="Save Sales Order">
                </ISWebDesktop:ToolCommand>
                <ISWebDesktop:ToolCommand Category="WebToolBar1" Name="Separator1" Type="Separator">
                </ISWebDesktop:ToolCommand>
                <ISWebDesktop:ToolCommand Category="WebToolBar1" DisplayMode="TextAndImage" Name="cmdHeader"
                    AutoPostBack="Yes" Image="~/Images/application_edit.png" Text="Header" ToolTip="Sales Order Header">
                </ISWebDesktop:ToolCommand>
                <ISWebDesktop:ToolCommand Category="WebToolBar1" DisplayMode="TextAndImage" Name="cmdDetail"
                    AutoPostBack="Yes" Image="~/Images/application_form.png" Text="Detail" ToolTip="Sales Order Details">
                </ISWebDesktop:ToolCommand>
                <ISWebDesktop:ToolCommand Category="WebToolBar1" DisplayMode="TextAndImage" Name="cmdTotals"
                    AutoPostBack="Yes" Image="~/Images/application_side_contract.png" Text="Totals"
                    ToolTip="Sales Order Totals">
                </ISWebDesktop:ToolCommand>
                <ISWebDesktop:ToolCommand Category="WebToolBar1" DisplayMode="TextAndImage" Name="cmdXML"
                    AutoPostBack="Yes" Image="~/Images/clipboard_text.png" Text="XML" ToolTip="Sales Order XML">
                </ISWebDesktop:ToolCommand>
            </Commands>
        </ISWebDesktop:WebToolBar>
        <br />
        <asp:Label ID="lblError" runat="server" CssClass="labelerror" Text="Label"></asp:Label>
        <br />
        <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
            <asp:View ID="viewStart" runat="server">
                <div>
                    <asp:CheckBox ID="chFilterMain" AutoPostBack="true" CssClass="CheckBox" Text="Filter List"
                        runat="server" />
                    <asp:SqlDataSource ID="sqlSalesOrders" runat="server" ConnectionString="<%$ ConnectionStrings:SCL %>"
                        SelectCommand="SELECT  [SalesOrder], [Customer], [OrderStatus], [CustomerPoNumber], [OrderDate], [ReqShipDate], [ShipAddress1], [ShipAddress3], [ShipAddress4], [ShipPostalCode] FROM [SorMaster] WHERE [OrderStatus] = '1'">
                    </asp:SqlDataSource>
                    <ISWebGrid:WebGrid ID="grdMain" runat="server" Height="60%" UseDefaultStyle="True"
                        DefaultStyleMode="Win7" Width="802px" DataSourceID="sqlSalesOrders">
                        <FlyPostBackSettings PostInputControls="True" />
                        <RootTable DataKeyField="SalesOrder" GridLineStyle="NotSet" Caption="Valuations">
                            <Columns>
                                <ISWebGrid:WebGridColumn Caption="Warehouse Update"
                                    Name="WarehouseUpdate" Width="120px" EditType="CheckBox" Bound="False" 
                                    NewRowEditType="Checkbox" ColumnType="CheckBox" DataType="System.Checkbox">
                                </ISWebGrid:WebGridColumn>
                                <ISWebGrid:WebGridColumn Caption="Sales Order" DataMember="SalesOrder" Name="SalesOrder"
                                    Width="100px" EditType="NoEdit">
                                </ISWebGrid:WebGridColumn>
                                <ISWebGrid:WebGridColumn Caption="Customer" DataMember="Customer" Name="Customer"
                                    Width="100px" EditType="NoEdit">
                                </ISWebGrid:WebGridColumn>
                                <ISWebGrid:WebGridColumn Caption="Order Status" DataMember="OrderStatus" Name="OrderStatus"
                                    Width="100px" EditType="NoEdit">
                                </ISWebGrid:WebGridColumn>
                                <ISWebGrid:WebGridColumn Caption="PO Number" DataMember="CustomerPoNumber" Name="CustomerPoNumber"
                                    Width="100px" EditType="NoEdit">
                                </ISWebGrid:WebGridColumn>
                                <ISWebGrid:WebGridColumn Caption="Order Date" DataMember="OrderDate" DataType="System.DateTime"
                                    Name="OrderDate" Width="100px" DataFormatString="dd/MM/yyyy" 
                                    EditType="NoEdit">
                                </ISWebGrid:WebGridColumn>
                                <ISWebGrid:WebGridColumn Caption="Shipping Date" DataMember="ReqShipDate" DataType="System.DateTime"
                                    Name="ReqShipDate" Width="100px" DataFormatString="dd/MM/yyyy" 
                                    EditType="NoEdit">
                                </ISWebGrid:WebGridColumn>
                                <ISWebGrid:WebGridColumn Caption="Ship Address 1" DataMember="ShipAddress1" Name="ShipAddress1"
                                    Width="100px" EditType="NoEdit">
                                </ISWebGrid:WebGridColumn>
                                <ISWebGrid:WebGridColumn Caption="Ship Address 3" DataMember="ShipAddress3" Name="ShipAddress3"
                                    Width="100px" EditType="NoEdit">
                                </ISWebGrid:WebGridColumn>
                                <ISWebGrid:WebGridColumn Caption="Ship Address 4" DataMember="ShipAddress4" Name="ShipAddress4"
                                    Width="100px" EditType="NoEdit">
                                </ISWebGrid:WebGridColumn>
                                <ISWebGrid:WebGridColumn Caption="Ship Postal Code" DataMember="ShipPostalCode" Name="ShipPostalCode"
                                    Width="100px" EditType="NoEdit">
                                </ISWebGrid:WebGridColumn>
                            </Columns>
                        </RootTable>
                        <LayoutSettings AllowAddNew="No" AllowBatchUpdate="true" AllowDelete="No" AllowColumnMove="No" AllowEdit="Yes"
                            AllowExport="Yes" AllowFilter="No" AllowGrouping="Yes" AllowSelectColumns="Yes"
                            AllowSorting="Yes" EditOnClick="True" RowLostFocusAction="NeverUpdate" 
                            AutoHeight="True" RowHeightDefault="25px">
                        </LayoutSettings>
                    </ISWebGrid:WebGrid>
    </form>
</body>
</html>
All times are GMT -5. The time now is 3:30 AM.
Previous Next