GridPanel - Set Selection if DataRow Value Matches Specific Field/Column in grid/store?

  1. #1

    GridPanel - Set Selection Not On ID - but on Other Store field?

    Based upon the results of a datatable - I am trying to set the selection of a gridpanel - works great if the value in row[0] is equal to the store reader id - but in this case - in place of the below - is there a way that I can take a value from the datatable and match it to a specific field in the store/gridpanel - in this case, I have a field called AccountNumber - so if the returned row from the datatable matches field AccountNumber - then select...?

      foreach (DataRow row in dt.Rows) // Loop over the rows.
                    {
                        sm4.SelectedRows.Add(new SelectedRow(row[0].ToString()));
                    }

    So - In a simplified model of the dataset - in place of "ID" - I want to set selection based upon "Test"


        protected void LoadData()
        {
            Store store = this.GridPanel1.GetStore();
            store.DataSource = new object[] 
                { 
                    new SomeClass()
                    {
                        ID = "id1",
                        Test = "test1" 
                    },
                    new SomeClass()
                    {
                        ID = "id2",
                        Test = "test2" 
                    },
                    new SomeClass()
                    {
                        ID = "id3",
                        Test = "test3" 
                    }
                };
            store.DataBind();
        }
    Last edited by Tbaseflug; Feb 28, 2012 at 3:07 PM.

Similar Threads

  1. Replies: 3
    Last Post: Aug 01, 2012, 6:51 PM
  2. DataRow from GridPanel Store
    By ven in forum 1.x Help
    Replies: 0
    Last Post: Jun 21, 2011, 11:18 AM
  3. Replies: 2
    Last Post: Nov 26, 2010, 6:30 PM
  4. [CLOSED] Render gridpanel column depending on value other field store
    By CarWise in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 21, 2010, 2:50 PM
  5. Replies: 1
    Last Post: May 19, 2010, 5:07 PM

Posting Permissions