Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Issue regarding working objectlistview to show tree gridview like data

$
0
0

from this url http://objectlistview.sourceforge.net i download the objectlistview component. it is nice and i was trying to fill treelistview this way.

my datatable hold data like

SlNo   JID     EntryDate       RefundDate     Comments    Refund ActionBy   nLevel      CID
------ ------- --------------- -------------- ----------- ------ ---------- ----------- ------
4      41986   NULL            NULL           NULL        NULL   NULL       1           0
5      NULL    2013-12-17      2013-12-24     Cancel      0      tridip     2           41986
6      NULL    2013-12-17      2013-12-25     done        1      tridip     2           41986
7      NULL    2013-12-17      2013-12-24     no          0      tridip     2           41986
1      41985   NULL            NULL           NULL        NULL   NULL       1           0
2      NULL    2013-12-18      2013-12-25     testing     0      tridip     2           41985
3      NULL    2013-12-18      2013-12-25     done now    1      tridip     2           41985

i wrote the code this way to bind data

private void button1_Click(object sender, EventArgs e)
        {
            string connString = "Data Source=xxx.xx.xx.xx\\test;Initial Catalog=Test;User id=sa;Password=test;";
            string sql = "USP_RefundRequested";

            SqlConnection conn = new SqlConnection(connString);

            try
            {
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = new SqlCommand(sql, conn);
                da.SelectCommand.CommandType = CommandType.StoredProcedure;

                DataSet ds = new DataSet();
                da.Fill(ds, "Person");

                DataTable dt = ds.Tables["Person"];

                olvDataTree.KeyAspectName = "JID";
                olvDataTree.ParentKeyAspectName = "SlNo";
                olvDataTree.RootKeyValue = 0u;
                this.olvDataTree.DataSource = ds.Tables["Person"];
                olvDataTree.Columns[olvDataTree.Columns.Count - 1].Width = -2;

            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: " + ex);
            }
            finally
            {
                conn.Close();
            }
        }
no error occur but grid is not showing the data but i check datatable has the data. can any one tell me where i am making the mistake for which data is not coming. thanks



Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>