GridClientSelectColumn select checkbox is not working

Thread is closed for posting
3 posts, 1 answers
  1. Sathish
    Sathish avatar
    4 posts
    Member since:
    Aug 2012

    Posted 13 Sep 2012 Link to this post

    Hi ,

    i am facing issue when  i am making check box checked in iteam databound but its not woeking,please help me to solve this issue.

    item databound code

      protected void grdExamDates_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
            {
                if (e.Item is GridDataItem && !(e.Item is GridDataInsertItem) && !e.Item.IsInEditMode)
                {
                    GridDataItem item = e.Item as GridDataItem;
                    AdminCheckExamDateView dataItem = item.DataItem as AdminCheckExamDateView;
                    CheckBox checkBox = (CheckBox)item["colSelect"].Controls[0];
                    if (dataItem.SELECTED_FLAG)
                        checkBox.Checked = true;
                    if (ExamCompleted || AdminCheckReadOnly)
                    {
                        if (checkBox != null)
                        {
                            checkBox.Enabled = false;
                        }                 
                    }
                   

                }
            }


    and design code
      <tempo:TempoGridControl ID="grdExamDates" runat="server" OnNeedDataSource="grdExamDates_NeedDataSource"
                                                AllowPaging="false"  OnItemDataBound="grdExamDates_ItemDataBound" ViewEntityType="CGI.ESG.TEMPO.ViewEntity.AdminCheckExamDateView,CGI.ESG.TEMPO.ViewEntity" >
                                                <TempoCommandItem Enabled="true" ShowAddItemButton="false" />
                                                <ClientSettings EnablePostBackOnRowClick="false">
                                                    <Resizing AllowColumnResize="true" />
                                                    <Selecting AllowRowSelect="true" EnableDragToSelectRows="true"/>
                                                    <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="84" />
                                              
                                                </ClientSettings>
                                                <MasterTableView CommandItemDisplay="Top" EditMode="InPlace" DataKeyNames="EXAM_ID, EXAM_TYPE_CODE">
                                                    <Columns>
                                                      <telerik:GridClientSelectColumn UniqueName="colSelect" HeaderStyle-Width="30px"/>                                          
                                                        <telerik:GridDateTimeColumn HeaderText="Exam Date" DataField="EXAM_START_DATE" HeaderStyle-Width="100px"
                                                            DataFormatString="{0:MM/dd/yyyy}">
                                                        </telerik:GridDateTimeColumn>
                                                        <telerik:GridBoundColumn HeaderText="Exam Type" UniqueName="colExamType" DataField="EXAM_TYPE_DESC">
                                                        </telerik:GridBoundColumn>
                                                    </Columns>
                                                </MasterTableView>
                                            </tempo:TempoGridControl>

  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 13 Sep 2012 Link to this post

    Hi Satish,

    Try the following code snippet to achieve your scenario.
    C#:
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
     if (e.Item is GridDataItem )
     {
        GridDataItem dataItem = e.Item as GridDataItem;
        if (dataItem.SELECTED_FLAG)
        {
           CheckBox checkBox = (CheckBox)dataItem["colSelect"].Controls[0];
           dataItem.Selected = true;
        }
     }
    }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sathish
    Sathish avatar
    4 posts
    Member since:
    Aug 2012

    Posted 13 Sep 2012 Link to this post

    Hi Princy,

    awesome!!! it working great,Thank you so much

    Regards,
    satihish Gai
Back to Top