How to add the check box to the grid?

3 posts, 0 answers
  1. sharath
    sharath avatar
    12 posts
    Member since:
    Aug 2014

    Posted 20 Jan 2015 Link to this post

    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. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 20 Jan 2015 in reply to sharath Link to this post

    Hello Sharath,

    Could you please share error detail?

    Thanks,
    Jayesh Goyani
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. sharath
    sharath avatar
    12 posts
    Member since:
    Aug 2014

    Posted 21 Jan 2015 in reply to Jayesh Goyani Link to this post

    Hello Jay,

    It was showing, it don't have definition for checkbox. But i've had declared it.
Back to Top