Gridpanel + datasource

  1. #1

    Gridpanel + datasource

    Hello everyone

    This is my first time and quite new to Coolite, nontheless, I find it very attractive, and I want to give it a try.

    Here's the deal:

    I've developed objects such as:

     public void listrecords(GridView listuser, string strquery)
        {
               configkey k = new configkey(); // retrieve configurations from web.config
                MySql.Data.MySqlClient.MySqlConnection cn = new MySql.Data.MySqlClient.MySqlConnection(k.key("constr", ""));
                MySqlDataAdapter da = new MySqlDataAdapter(strquery, cn);
                DataSet ds = new DataSet();
                da.Fill(ds);
                listuser.DataSource = ds;
                listuser.EmptyDataText = "Não existem registos";
                listuser.DataBind();
                cn.Close();
        }
    Which allows me to populate programatically a gridview with a MySQL recordset .

    As I said before I understand Coolite architecture, so is there a way to do the same thing with Store + Gridpanel?

    Thank's in advance
    Cheers
    Francis
    Last edited by geoffrey.mcgill; Oct 01, 2010 at 9:06 PM. Reason: please use [CODE] tags
  2. #2
    Hi Francis,

    Welcome!

    I think you just need to set the .DataSource property of the <ext:Store> to your "ds" variable, then call .DataBind().

    Example

    this.Store1.DataSource = ds;
    this.Store1.DataBind();
    The GridPanel requires a separate configuration to determine which Columns you require, but its all pretty straightforward. Many samples in the Examples Explorer.

    Here's a basic GridPanel to start with:

    https://examples1.ext.net/#/GridPanel/ArrayGrid/Simple/

    Hope this helps.
    Geoffrey McGill
    Founder

Similar Threads

  1. Replies: 0
    Last Post: Jul 03, 2012, 10:50 PM
  2. Replies: 2
    Last Post: Apr 11, 2012, 11:10 AM
  3. Replies: 5
    Last Post: Feb 01, 2012, 11:54 AM
  4. GridPanel and PostgreSQL datasource
    By TheVise in forum 1.x Help
    Replies: 4
    Last Post: Jan 24, 2011, 6:59 AM
  5. gridpanel.DataSource = Where are you?
    By unperson in forum 1.x Help
    Replies: 2
    Last Post: Sep 07, 2009, 10:52 PM

Posting Permissions