[CLOSED] Checkbox selection model is not working as expected.

  1. #1

    [CLOSED] Checkbox selection model is not working as expected.

    Hi,

    I have a gridpanel which has to be loaded on a view button click. Below is the event code:

      private void BindTier2()
            {
                int tmMonth;
                int tmYear;
    
                tmMonth = string.IsNullOrEmpty(CmbMonth.SelectedItem.Value) ? -1 : int.Parse(CmbMonth.SelectedItem.Value);
                tmYear = string.IsNullOrEmpty(CmbYear.SelectedItem.Value) ? -1 : int.Parse(CmbYear.SelectedItem.Value);
    
                PBView objPBViews = new AP3.Core.Bll.Mbm.PBView();
                DataTable dtTierMapping = new DataTable();
                dtTierMapping = objPBViews.GetETmetricsTier2Mapping(tmMonth, tmYear);
    
                str2TierMapping.RemoveAll();
                
      
    
                str2TierMapping.DataSource = dtTierMapping;
                str2TierMapping.DataBind();
    
                RowSelectionModel sm = this.grdTier2Mapping.SelectionModel.Primary as RowSelectionModel;
                sm = this.grdTier2Mapping.SelectionModel.Primary as RowSelectionModel;
                sm.SelectedRow = new SelectedRow(2);
                sm.SelectedRows.Add(new SelectedRow(0));
                sm.SelectedRows.Add(new SelectedRow(2));
            }
    I have a checkbox selection model in the gridpanel and I want some of the rows to be automatically checked while loading. If I call the above function in a page load it is working fine. But When I call the same function inside a view button click event only the grid is loading but the check boxes are not being checked. Please help.
    Last edited by Daniil; Apr 30, 2015 at 4:22 PM. Reason: [CLOSED]
  2. #2
    Hi @arjunrvasisht,

    During a DirectEvent you should also call
    sm.UpdateSelectedRows();
    at the end.

    It should not be called on the initial Page_Load, though.
    Last edited by Daniil; Apr 30, 2015 at 11:23 AM.
  3. #3
    That fixed my problem. Thanks :)

Similar Threads

  1. Replies: 1
    Last Post: Apr 30, 2014, 8:03 PM
  2. Replies: 2
    Last Post: Apr 21, 2014, 8:24 AM
  3. Replies: 1
    Last Post: Dec 04, 2013, 10:53 AM
  4. Replies: 10
    Last Post: Apr 19, 2013, 3:16 PM
  5. Replies: 4
    Last Post: Oct 06, 2010, 9:08 AM

Tags for this Thread

Posting Permissions