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

How to add the check box to the grid?

2 Answers 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sharath
Top achievements
Rank 1
sharath asked on 20 Jan 2015, 05:00 PM
Hello Team,

I want to add the checkbox to the gridview. Here the gridview is the user control. I tired to add the checkbox as usual for the grid. But it was showing the error. Am i I missing anything while adding. 

This is my user control.ascx code. I have not added the checkbox. Please suggest me where to add. I used the <asp: checkbox....</asp>. This method gave the error.
<%@ Control Language="C#" AutoEventWireup="false" CodeBehind="LocationGrid.ascx.cs"
    Inherits="Unisys.AppointmentManager.UserInterface.LocationGrid" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<table cellpadding="0" cellspacing="0">
    <tr runat="server" id="channelTypeRow" visible="false">
        <td style="width: 450px">
            <telerik:RadComboBox ID="cbChannelType" runat="server" AllowCustomText="True" Width="200px"
                OnSelectedIndexChanged="cbChannelType_SelectedIndexChanged" AutoPostBack="True" meta:resourcekey="cbChannelTypeResource1">
            </telerik:RadComboBox>
        </td>
        <td></td>
    </tr>
    <tr>
        <td style="width: 450px">
            <telerik:RadGrid ID="rgLocations" runat="server" AutoGenerateColumns="False"
                Height="100%" Width="100px" Culture="en-GB" GridLines="None" CellSpacing="0"
                ShowHeader="False" ViewStateMode="Enabled" BorderColor="#C3D9F9" BorderWidth="1px" meta:resourcekey="rgLocationsResource1">
                <ClientSettings>
                    <Selecting CellSelectionMode="None"></Selecting>
                </ClientSettings>
                <ExportSettings>
                    <Pdf>
                        <PageHeader>
                            <LeftCell Text=""></LeftCell>
                            <MiddleCell Text=""></MiddleCell>
                            <RightCell Text=""></RightCell>
                        </PageHeader>
                       <PageFooter>
                            <LeftCell Text=""></LeftCell>
                            <MiddleCell Text=""></MiddleCell>
                            <RightCell Text=""></RightCell>
                        </PageFooter>
                    </Pdf>
                </ExportSettings>
                <MasterTableView AllowAutomaticInserts="false" Width="100%" CommandItemDisplay="None"
                    CommandItemSettings-AddNewRecordText="Add a location" CommandItemSettings-ShowRefreshButton="False"
                    DataKeyNames="Id" NoMasterRecordsText="optional" ViewStateMode="Enabled"
                    GridLines="None" EditMode="InPlace" ShowHeadersWhenNoRecords="False">
                    <NoRecordsTemplate>
                        <div id="locationContainer" style="height: 24px; font-style: italic; font-family: Segoe UI, Arial, sans-serif; font-size: 12px;" onclick="CallChangeLocation();">
                            <span style="position: relative; left: 5px; top: 3px;"></span>
                        </div>
                    </NoRecordsTemplate>
                    <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="Id" UniqueName="Id" HeaderText="No" Display="false" meta:resourcekey="GridBoundColumnResource1"
                           <ColumnValidationSettings>
                                <ModelErrorMessage Text=""></ModelErrorMessage>
                            </ColumnValidationSettings>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Name" HeaderText="Location" UniqueName="Name"
                            HeaderStyle-HorizontalAlign="Left" meta:resourcekey="GridBoundColumnResource2">
                            <ColumnValidationSettings>
                                <ModelErrorMessage Text=""></ModelErrorMessage>
                            </ColumnValidationSettings>
                            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                            <ItemStyle HorizontalAlign="Left" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="CTID" HeaderText="No" Display="false" meta:resourcekey="GridBoundColumnResource3">
                            <ColumnValidationSettings>
                                <ModelErrorMessage Text=""></ModelErrorMessage>
                            </ColumnValidationSettings>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="CTName" HeaderText="No" Display="false" meta:resourcekey="GridBoundColumnResource4">
                            <ColumnValidationSettings>
                                <ModelErrorMessage Text=""></ModelErrorMessage>
                            </ColumnValidationSettings>
                        </telerik:GridBoundColumn>
                          <telerik:GridTemplateColumn>
                        <ItemTemplate>
                        <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" CausesValidation="false"
                        OnCheckedChanged="CheckBox1_CheckedChanged" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
                    </EditFormSettings>
                    <BatchEditingSettings EditType="Cell"></BatchEditingSettings>
                    <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                </MasterTableView>
            </telerik:RadGrid>
        </td>
        <td>
            <a id="changeLocationLink" class="actionlink" href="javascript:CallChangeLocation()"
                runat="server" title="<%$Resources: , Change_The_Locations%>">Change the location(s)</a>
        </td>
    </tr>
</table>



 












2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 20 Jan 2015, 05:25 PM
Hello Sharath,

Could you please share error detail?

Thanks,
Jayesh Goyani
0
sharath
Top achievements
Rank 1
answered on 21 Jan 2015, 04:37 PM
Hello Jay,

It was showing, it don't have definition for checkbox. But i've had declared it.
Tags
Grid
Asked by
sharath
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
sharath
Top achievements
Rank 1
Share this question
or