This is a migrated thread and some comments may be shown as answers.

[Solved] big problems using grid ... (selected value always null / checkbox as bool not working)

1 Answer 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 28 Jun 2014, 07:31 AM
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid3" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="PrivilegeTypeText"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid3" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="PrivilegeTypeText"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid3">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid3"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="PrivilegeTypeText"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
    </telerik:RadAjaxLoadingPanel>

    <h3>Module</h3>
    <telerik:RadGrid ID="RadGrid1" runat="server" Culture="de-DE" ShowStatusBar="True" AllowPaging="True" PageSize="5" Width="800px"
        DataKeyValues="Id, ModuleName, IsActive, NavigationPath"
        OnItemCommand="RadGrid1_ItemCommand" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemDataBound="RadGrid1_ItemDataBound" EnableViewState="true" ViewStateMode="Enabled">
        <MasterTableView Width="100%" AutoGenerateColumns="False" CommandItemDisplay="Top" EditMode="PopUp"
            NoDetailRecordsText="Keine Detaileinträge." NoMasterRecordsText="Keine Einträge." RetrieveNullAsDBNull="False" EnableViewState="true" ViewStateMode="Enabled">
            <CommandItemSettings AddNewRecordText="Neues Modul anlegen" CancelChangesText="Abbrechen" SaveChangesText="Änderungen speichern" ShowRefreshButton="False" />
            
            <Columns>

                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" ItemStyle-Width="30px">
                    <ItemStyle Width="30px"></ItemStyle>
                </telerik:GridEditCommandColumn>

                <telerik:GridBoundColumn DataField="Id" DataType="System.Guid" HeaderText="Modul Id" ReadOnly="true"
                    SortExpression="ModuleId" UniqueName="ModuleId">
                    <ColumnValidationSettings>
                        <ModelErrorMessage Text=""></ModelErrorMessage>
                    </ColumnValidationSettings>
                </telerik:GridBoundColumn>

                <telerik:GridBoundColumn DataField="ModuleName" DataType="System.String" HeaderText="Modul Name"
                    SortExpression="ModuleName" UniqueName="ModuleName">
                    <ColumnValidationSettings>
                        <ModelErrorMessage Text=""></ModelErrorMessage>
                    </ColumnValidationSettings>
                </telerik:GridBoundColumn>

                <telerik:GridCheckBoxColumn DataField="IsActive" HeaderText="Modul aktiviert"
                    SortExpression="ModuleIsActive" UniqueName="ModuleIsActive">
                </telerik:GridCheckBoxColumn>


                <telerik:GridBoundColumn DataField="NavigationPath" DataType="System.String" HeaderText="Modul Navigationspfad"
                    SortExpression="ModuleNavigationPath" UniqueName="ModuleNavigationPath">
                    <ColumnValidationSettings>
                        <ModelErrorMessage Text=""></ModelErrorMessage>
                    </ColumnValidationSettings>
                </telerik:GridBoundColumn>

                <telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton" ItemStyle-Width="30px">
                    <ItemStyle Width="30px"></ItemStyle>
                </telerik:GridButtonColumn>

            </Columns>
            <EditFormSettings>
                <EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
                <FormTemplate>
                    <table ID="Table2" cellspacing="2" cellpadding="1" width="100%">
                        style="border-collapse: collapse;">
                        <tr class="EditFormHeader">
                            <td colspan="2" style="font-size: small"><b>Modul Details</b></td>
                        </tr>

                        <tr>
                            <td>Modul Name:</td>
                            <td>
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ModuleName") %>' Width="400px" TabIndex="1"></asp:TextBox></td>
                        </tr>

                        <tr>
                            <td>Modul aktiviert:</td>
                            <td>
                                <asp:CheckBox ID="CheckBox1" runat="server" Text='<%# Bind("IsActive") %>' TabIndex="2"></asp:CheckBox></td>
                        </tr>
                        <tr>
                            <td>Modul Navigationspfad:</td>
                            <td>
                                <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("NavigationPath") %>' Width="200px" TabIndex="3"></asp:TextBox></td>
                        </tr>

                        <tr>
                            <td  colspan="2">
                                <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button>&nbsp;
                                <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                    CommandName="Cancel"></asp:Button>
                            </td>
                        </tr>
                    </table>

                </FormTemplate>
            </EditFormSettings>
        </MasterTableView>

        <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">
            <Selecting AllowRowSelect="true"></Selecting>
        </ClientSettings>
    </telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 02 Jul 2014, 12:15 PM
Hello Frank,

Could you please elaborate a little bit more on the issues which you are facing. I prepared a small sample based on your code and on my side when I select a value I could get it from the SelectedItems collection. Also please note that the CheckBox are enabled only in edit mode, otherwise they are disabled. If you want to enable them then you have to use a TemplateColumn with a CheckBox control as an ItemTemplate.

Regards,
Kostadin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Frank
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or