Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello,

I want to insert data into hierarchial radgrid...ie when is exapnd button i should be able to see the data after expansion...

im getting no display in child radgrid..in the child column..
can anyone tell me how to proceed???This the code im using..and i want this without using datasource.
Thank You



C#
protected void RadGrid_Details_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
        {
            var Value= e.DetailTableView.ParentItem;
               string ID = Value.GetDataKeyValue("ID").ToString();
               e.DetailTableView.DataSource = GetDataTable("SELECT * FROM databsename WHERE ID = '" + ID + "'");
                   
        }

        public DataTable GetDataTable(string query)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString());

            SqlDataAdapter da = new SqlDataAdapter("select * from databasename ", con);
            DataSet ds = new DataSet();
            da.Fill(ds, "databasename");
            RadGrid_Details.DataSource = ds;

            DataTable myDataTable = new DataTable();

            con.Open();
            
                da.Fill(myDataTable);
         
          
            return myDataTable;
        }
Posted
Updated 24-Mar-15 17:55pm
v5
Comments
Richard Deeming 24-Mar-15 15:20pm    
Your code is vulnerable to SQL Injection[^].

NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.
Member 11148509 24-Mar-15 22:18pm    
Sorry dint get u ..can u be a bit clear..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900