Telerik Forums
UI for WinForms Forum
8 answers
273 views
Hello,

Our firm checking several third party controls to buy.
I've downloaded the VS projects samples and converted it to VS 2010.
Project 15_CustomCells, If i'm tying to move scrollbar of the gridview, the application is crashing.
The exception details:

System.Reflection.TargetInvocationException was unhandled
  Message=Exception has been thrown by the target of an invocation.
  Source=mscorlib
  StackTrace:
       at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Delegate.DynamicInvokeImpl(Object[] args)
       at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
       at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
       at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
       at System.Windows.Forms.Control.WndProc(Message& m)
       at Telerik.WinControls.RadControl.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at _15_CustomCells.Program.Main() in J:\ third party controls .NET\Telerik\Telerik_RadControls_for_WinForms_VS_Projects\Grid\CS\RadGridView\15_CustomCells\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Reflection.TargetInvocationException
       Message=Exception has been thrown by the target of an invocation.
       Source=mscorlib
       StackTrace:
            at System.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct& signature, RuntimeType declaringType)
            at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
            at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
            at System.Activator.CreateInstance(Type type, Object[] args)
            at Telerik.WinControls.UI.GridDataRowElement.CreateCell(GridViewColumn column)
            at Telerik.WinControls.UI.CellElementProvider.CreateElement(GridViewColumn data, Object context)
            at Telerik.WinControls.UI.CellElementProvider.GetElement(GridViewColumn data, Object context)
            at Telerik.WinControls.UI.BaseVirtualizedContainer`1.UpdateElement(Int32 position, T data)
            at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureElements()
            at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureOverride(SizeF availableSize)
            at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
            at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
            at Telerik.WinControls.UI.GridVirtualizedRowElement.MeasureElements(SizeF availableSize, SizeF clientSize, Padding borderThickness)
            at Telerik.WinControls.UI.LightVisualElement.MeasureOverride(SizeF availableSize)
            at Telerik.WinControls.UI.GridRowElement.MeasureOverride(SizeF availableSize)
            at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
            at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
            at Telerik.WinControls.UI.VirtualizedStackContainer`1.MeasureElementCore(RadElement element, SizeF availableSize)
            at Telerik.WinControls.UI.ScrollableRowsContainerElement.MeasureElementCore(RadElement element, SizeF availableSize)
            at Telerik.WinControls.UI.VirtualizedStackContainer`1.MeasureElement(IVirtualizedElement`1 element)
            at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureElements()
            at Telerik.WinControls.UI.ScrollableRowsContainerElement.MeasureOverride(SizeF availableSize)
            at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
            at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
            at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayout()
       InnerException: System.NullReferenceException
            Message=Object reference not set to an instance of an object.
            Source=_15_CustomCells
            StackTrace:
                 at _15_CustomCells.ColorSwatchCellElement.SetContent() in J:\ third party controls .NET\Telerik\Telerik_RadControls_for_WinForms_VS_Projects\Grid\CS\RadGridView\15_CustomCells\ColorSwatchCellElement.cs:line 59
                 at Telerik.WinControls.UI.GridVirtualizedCellElement.Initialize(GridViewColumn column, GridRowElement row)
                 at _15_CustomCells.ColorSwatchCellElement..ctor(GridViewColumn column, GridRowElement row) in J:\ third party controls .NET\Telerik\Telerik_RadControls_for_WinForms_VS_Projects\Grid\CS\RadGridView\15_CustomCells\ColorSwatchCellElement.cs:line 11
            InnerException:

Regards,
Stas

Alexander
Telerik team
 answered on 19 Nov 2010
6 answers
165 views
Hello,

I've got this problem using GridView, where when ShowRowHeaderColumn is false my grid crashes with a null object reference exception somewhere from within GridView. The example below is the simplest test case of the problem I could find, it is a grid with 1 child subgrid, when opening the child level and selecting a row, then moving it out of view and back into view by scrolling the grid crashes. I don't think this problem is widespread, because surely someone else must be setting ShowRowHeaderColumn to false in a hierarchic grid and then I would have found something about this problem, so it must be something I do wrong. It is however the most simple example I could come up with, so I'm kinda stuck.

TestGridForm.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
using Telerik.WinControls.UI;
using Telerik.WinControls.Enumerations;
 
namespace RadGridViewProblems
{
    /*
     * Demonstate a gridview crash problem when quickly scrolling up and down and having row header column disabled, set
     * ShowRowHeaderColumn below to true and no crash anymore, reason why/workaround: unknown
     */
 
    public partial class TestGridForm : RadForm
    {
        public TestGridForm()
        {
            InitializeComponent();
 
            this.Load += new EventHandler(FormLoaded);
        }
 
        private void FormLoaded(object sender, EventArgs e)
        {
            //testGridView.ReadOnly = true;
            testGridView.AutoGenerateColumns = true;
 
            childGridViewTemplate = new GridViewTemplate();
            childGridViewTemplate.AutoGenerateColumns = true;
 
            //set ShowRowHeaderColumn here to true and no crash anymore
            testGridView.MasterTemplate.ShowRowHeaderColumn = true;
 
            //the one on the child template can be true/false, it doesn't matter
            childGridViewTemplate.ShowRowHeaderColumn = false;
 
            testGridView.MasterTemplate.Templates.Add(childGridViewTemplate);
 
            GridViewRelation relation = new GridViewRelation(testGridView.MasterTemplate);
            relation.ChildTemplate = childGridViewTemplate;
            relation.RelationName = "ParentChildren";
            relation.ParentColumnNames.Add("id");
            relation.ChildColumnNames.Add("parent_id");
 
            testGridView.Relations.Add(relation);
 
            LoadData();
        }
 
        private void LoadData()
        {
            List<MyParentClass> myParentList = new List<MyParentClass>();
            for(int i=1; i<=100; i++)
            {
                myParentList.Add(new MyParentClass() { id = i, name = i.ToString(), info = "blabla" });
            }
 
            List<MyChildClass> myChildList = new List<MyChildClass>();
            Random random = new Random(1);
            for(int i=1; i<=300; i++)
            {
                myChildList.Add(new MyChildClass() { parent_id = random.Next(1,100), id = i, name = i.ToString(), info = "blabla" });
            }
 
            testGridView.DataSource = myParentList;
            childGridViewTemplate.DataSource = myChildList;
        }
 
        private GridViewTemplate childGridViewTemplate;
    }
 
    public class MyParentClass
    {
        public int id { get; set; }
        public String name { get; set; }
        public String info { get; set; }
    }
 
    public class MyChildClass
    {
        public int parent_id { get; set; }
        public int id { get; set; }
        public String name { get; set; }
        public String info { get; set; }
    }
}

TestGridForm.Designer.cs
namespace RadGridViewProblems
{
    partial class TestGridForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
 
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if(disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows Form Designer generated code
 
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.testGridView = new Telerik.WinControls.UI.RadGridView();
            ((System.ComponentModel.ISupportInitialize)(this.testGridView)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
            this.SuspendLayout();
            //
            // testGridView
            //
            this.testGridView.Dock = System.Windows.Forms.DockStyle.Fill;
            this.testGridView.Location = new System.Drawing.Point(0, 0);
            //
            // testGridView
            //
            this.testGridView.Name = "testGridView";
            this.testGridView.Padding = new System.Windows.Forms.Padding(0, 0, 0, 1);
            //
            //
            //
            this.testGridView.RootElement.Padding = new System.Windows.Forms.Padding(0, 0, 0, 1);
            this.testGridView.Size = new System.Drawing.Size(833, 444);
            this.testGridView.TabIndex = 0;
            this.testGridView.Text = "radGridView1";
            //
            // TestGridForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(833, 494);
            this.Controls.Add(this.testGridView);
            this.Name = "TestGridForm";
            this.Padding = new System.Windows.Forms.Padding(0, 0, 0, 50);
            //
            //
            //
            this.RootElement.ApplyShapeToControl = true;
            this.Text = "Test Form";
            ((System.ComponentModel.ISupportInitialize)(this.testGridView)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
            this.ResumeLayout(false);
 
        }
 
        #endregion
 
        private Telerik.WinControls.UI.RadGridView testGridView;
 
    }
}

If someone could point me to my mistake (or who knows confirm it's a bug in GridView) that would be great.

Thanks
cheers
Frederik
Richard Slade
Top achievements
Rank 2
 answered on 19 Nov 2010
11 answers
856 views
Hello,

I've got a problem with the GridView I cannot explain, when I reassign the datasources for a hierarchic grid after having selected a child, the grid will always scroll to the bottom on trying to select children after the datasource is reset. It seems like it's internal offset list has been corrupted or something like that. I've made the most simple test case, so hopefully someone can reproduce this problem and tell me what I'm doing wrong. I've seen examples just reassign the datasource so that should be no problem, but maybe I'm missing some step. I did see someone reference this behaviour in another post Errors clicking on childrows of heirarchical gridview on the forum (the case 2), but no proposed solution was given. So I'm kinda stuck and any help would be very much appreciated.

TestGridForm2.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
using Telerik.WinControls.UI;
using Telerik.WinControls.Enumerations;
 
namespace RadGridViewProblems
{
    /*
     * Demonstate a gridview problem when setting the datasource a second time (or more) when a child row is clicked
     * the grid scrolls to the bottom, reason/workaround: unknown
     */
 
    public partial class TestGridForm2 : RadForm
    {
        public TestGridForm2()
        {
            InitializeComponent();
 
            this.Load += new EventHandler(FormLoaded);
        }
 
        private void FormLoaded(object sender, EventArgs e)
        {
            //testGridView.ReadOnly = true;
            testGridView.AutoGenerateColumns = true;
 
            childGridViewTemplate = new GridViewTemplate();
            childGridViewTemplate.AutoGenerateColumns = true;
 
            testGridView.MasterTemplate.ShowRowHeaderColumn = true;
            childGridViewTemplate.ShowRowHeaderColumn = false;
 
            testGridView.MasterTemplate.Templates.Add(childGridViewTemplate);
 
            GridViewRelation relation = new GridViewRelation(testGridView.MasterTemplate);
            relation.ChildTemplate = childGridViewTemplate;
            relation.RelationName = "ParentChildren";
            relation.ParentColumnNames.Add("id");
            relation.ChildColumnNames.Add("parent_id");
 
            testGridView.Relations.Add(relation);
 
            LoadData();
        }
 
        private void LoadData()
        {
            /*childGridViewTemplate.DataSource = null;
            testGridView.DataSource = null;*/
 
            List<MyParentClass> myParentList = new List<MyParentClass>();
            for(int i=1; i<=100; i++)
            {
                myParentList.Add(new MyParentClass() { id = i, name = i.ToString(), info = "blabla" });
            }
 
            List<MyChildClass> myChildList = new List<MyChildClass>();
            Random random = new Random(1);
            for(int i=1; i<=300; i++)
            {
                myChildList.Add(new MyChildClass() { parent_id = random.Next(1,100), id = i, name = i.ToString(), info = "blabla" });
            }
 
            childGridViewTemplate.DataSource = myChildList;
            testGridView.DataSource = myParentList;
        }
 
        private void resetButton_Click(object sender, EventArgs e)
        {
            LoadData();
        }
 
        private GridViewTemplate childGridViewTemplate;
    }
 
}


TestGridForm2.Designer.cs
namespace RadGridViewProblems
{
    partial class TestGridForm2
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
 
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if(disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows Form Designer generated code
 
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.testGridView = new Telerik.WinControls.UI.RadGridView();
            this.resetButton = new Telerik.WinControls.UI.RadButton();
            ((System.ComponentModel.ISupportInitialize)(this.testGridView)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.resetButton)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
            this.SuspendLayout();
            //
            // testGridView
            //
            this.testGridView.Dock = System.Windows.Forms.DockStyle.Fill;
            this.testGridView.Location = new System.Drawing.Point(0, 0);
            this.testGridView.Name = "testGridView";
            this.testGridView.Padding = new System.Windows.Forms.Padding(0, 0, 0, 1);
            //
            //
            //
            this.testGridView.RootElement.Padding = new System.Windows.Forms.Padding(0, 0, 0, 1);
            this.testGridView.Size = new System.Drawing.Size(833, 444);
            this.testGridView.TabIndex = 0;
            this.testGridView.Text = "radGridView1";
            //
            // resetButton
            //
            this.resetButton.Location = new System.Drawing.Point(90, 460);
            this.resetButton.Name = "resetButton";
            this.resetButton.Size = new System.Drawing.Size(130, 24);
            this.resetButton.TabIndex = 1;
            this.resetButton.Text = "Reset datasources";
            this.resetButton.Click += new System.EventHandler(this.resetButton_Click);
            //
            // TestGridForm2
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(833, 494);
            this.Controls.Add(this.resetButton);
            this.Controls.Add(this.testGridView);
            this.Name = "TestGridForm2";
            this.Padding = new System.Windows.Forms.Padding(0, 0, 0, 50);
            //
            //
            //
            this.RootElement.ApplyShapeToControl = true;
            this.Text = "Test Form";
            ((System.ComponentModel.ISupportInitialize)(this.testGridView)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.resetButton)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
            this.ResumeLayout(false);
 
        }
 
        #endregion
 
        private Telerik.WinControls.UI.RadGridView testGridView;
        private Telerik.WinControls.UI.RadButton resetButton;
 
    }
}

Thanks
Frederik
Fred
Top achievements
Rank 1
 answered on 19 Nov 2010
7 answers
150 views
I notice this happening after upgrading to SP3 -- when the mouse enters or exits the ribbon bar, or the form's titlebar, the ribbonbar flashes momentarily. I don't know if this is intentionally added or not, but I find it distracting. The subtle highlighting when the mouse enters a new chunk is sufficient.

Is there a way to turn this off?

Thanks,

Michelle
Peter
Telerik team
 answered on 19 Nov 2010
6 answers
354 views
hi,
I need to programatically hide the tab buttons but i can't find how to do this.
thanks,
Bahram
Stefan
Telerik team
 answered on 19 Nov 2010
13 answers
454 views
On ListControl with SelctionMode MultiSimple the SelectedIndexChanged event fires whenever an item is selected, but only fires on de-selection when the items are de-selected in the reverse order that they were selected in. It's as if when selecting items it forms a stack (firing the event on each select) and when de-selecting items the event only fires if the item on the top of the stack is de-selected).  Is there another event I should be using?
Peter
Telerik team
 answered on 19 Nov 2010
4 answers
129 views
Since Q3-2010 the font property on the RadButton doesn't work. However you can change the textboxitem element to set the font but can you explain why this is now the case ?

I haven't checked every rad control but the SpinEditor has the same issue...

Thanks


Paul.
Stefan
Telerik team
 answered on 19 Nov 2010
2 answers
120 views
Hi

Since the new release of Q3-2010 controls I cannot set the Drop Down size to a manual size. I used to use the "DropDownMinSize" property but now it doesn't work. Neither does any other size related property for that matter.

Am I doing something wrong or has the Q3-2010 release stopped this property working ?

Many thanks


Paul.
Peter
Telerik team
 answered on 19 Nov 2010
11 answers
280 views
Hi Guys,

I wonder if any one can shed some light on an issue I am having.

I have a form created from the RadForm template (2009 Q2), and if I turn off the ControlBox, MinimiseBox, MaximiseBox and then run the project the form renders with some of the desktop background in the form. If you add any one of these boxes back in the issue goes away. Is this expected behaviour? If so is there anyway around it? So far my only option seems to be leaving the ControlBox in place which the application does not really require.

I have attached a screen shot which shows the purple of my desktop wallpaper peeking through the form,

Thanks in advance.

Best regards,
Duane.

Edited: for spellos
Duane
Top achievements
Rank 1
 answered on 19 Nov 2010
11 answers
156 views
i am using the code given below to add a grid template .in this controls are
dgrdsubcategory -> RAD GRID
category is the table from database it returns 

Please Reply at earliest

dgrdSubCategory.AutoGenerateHierarchy = true;
            SqlDataAdapter sdaCatid = null;
            DataSet dsCatid = new DataSet();
            DataSet dsGrid = DBFunctions.FillRadDataGirdReturnDS("category where parentcatid IN (select catid from category where catname='" + TV1.SelectedNode.Text + "')", dgrdSubCategory);
 
            for (int i = 0; i < dsGrid.Tables[0].Rows.Count; i++)
            {
                DataRow drow = dsGrid.Tables[0].Rows[i];
                sdaCatid = FillDataset("category where parentcatid='" + drow["catid"] + "'");
                sdaCatid.Fill(dsCatid);
 
            }
            
 
            GridViewTemplate template = new GridViewTemplate();
            template.DataSource = dsCatid.Tables[0];
//i get values in the template variable
            dgrdSubCategory.MasterGridViewTemplate.ChildGridViewTemplates.Add(template);
 
            GridViewRelation relation = new GridViewRelation(dgrdSubCategory.MasterTemplate);
            relation.ChildTemplate = template;
            relation.RelationName = "SubCategory";
            relation.ParentColumnNames.Add("catid");
            relation.ChildColumnNames.Add("catid");
            dgrdSubCategory.Relations.Add(relation);
            radGrid1.DataSource = template;

///But though i have done this i dont get the corresponding result.
//It shows a "+" sign but nothing comes under it when clicked on "+"

public static SqlDataAdapter FillDataset(string strTableName)  { 
ds = new SqlDataAdapter();
sda=new SqlDataAdapter();
 conn = new SqlConnection();
conn.ConnectionString = ConfigurationSettings.AppSettings["conString"];
string strCmd = "select * from " + strTableName;
sqlcommand sqlCmd = new SqlCommand(strCmd, conn);
                sda = new SqlDataAdapter(sqlCmd);
                //sda.Fill(ds);
                //dgrdv.DataSource = ds.Tables[0];            
}
            catch (Exception excep)
            {
                MessageBox.Show("" + excep.Message + "  Stack Trace:" + excep.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return sda;
        }
lic static SqlDataAdapter FillDataset(string strTableName)
        {
            SqlDataAdapter ds = new SqlDataAdapter();
            SqlDataAdapter sda=new SqlDataAdapter();
            try
            {
                SqlConnection conn = new SqlConnection();
                conn.ConnectionString = ConfigurationSettings.AppSettings["conString"];
                string strCmd = "select * from " + strTableName;
                SqlCommand sqlCmd = new SqlCommand(strCmd, conn);
                sda = new SqlDataAdapter(sqlCmd);
                //sda.Fill(ds);
                //dgrdv.DataSource = ds.Tables[0];

            }
            catch (Exception excep)
            {
                MessageBox.Show("" + excep.Message + "  Stack Trace:" + excep.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return sda;
        }


dgrdSubCategory.AutoGenerateHierarchy = true;
            SqlDataAdapter sdaCatid = null;
            DataSet dsCatid = new DataSet();
            DataSet dsGrid = DBFunctions.FillRadDataGirdReturnDS("category where parentcatid IN (select catid from category where catname='" + TV1.SelectedNode.Text + "')", dgrdSubCategory);

            for (int i = 0; i < dsGrid.Tables[0].Rows.Count; i++)
            {
                DataRow drow = dsGrid.Tables[0].Rows[i];
                sdaCatid = FillDataset("category where parentcatid='" + drow["catid"] + "'");
                sdaCatid.Fill(dsCatid);

            }
            int count = dsCatid.Tables[0].Rows.Count;

            GridViewTemplate template = new GridViewTemplate();
            template.DataSource = dsCatid.Tables[0];
            dgrdSubCategory.MasterGridViewTemplate.ChildGridViewTemplates.Add(template);

            GridViewRelation relation = new GridViewRelation(dgrdSubCategory.MasterTemplate);
            relation.ChildTemplate = template;
            relation.RelationName = "SubCategory";
            relation.ParentColumnNames.Add("catid");
            relation.ChildColumnNames.Add("catid");
            dgrdSubCategory.Relations.Add(relation);
            radGrid1.DataSource = template;
dgrdSubCategory.AutoGenerateHierarchy = true;
            SqlDataAdapter sdaCatid = null;
            DataSet dsCatid = new DataSet();
            DataSet dsGrid = DBFunctions.FillRadDataGirdReturnDS("category where parentcatid IN (select catid from category where catname='" + TV1.SelectedNode.Text + "')", dgrdSubCategory);

            for (int i = 0; i < dsGrid.Tables[0].Rows.Count; i++)
            {
                DataRow drow = dsGrid.Tables[0].Rows[i];
                sdaCatid = FillDataset("category where parentcatid='" + drow["catid"] + "'");
                sdaCatid.Fill(dsCatid);

            }
            int count = dsCatid.Tables[0].Rows.Count;

            GridViewTemplate template = new GridViewTemplate();
            template.DataSource = dsCatid.Tables[0];
            dgrdSubCategory.MasterGridViewTemplate.ChildGridViewTemplates.Add(template);

            GridViewRelation relation = new GridViewRelation(dgrdSubCategory.MasterTemplate);
            relation.ChildTemplate = template;
            relation.RelationName = "SubCategory";
            relation.ParentColumnNames.Add("catid");
            relation.ChildColumnNames.Add("catid");
            dgrdSubCategory.Relations.Add(relation);
            radGrid1.DataSource = template;


 dgrdSubCategory.AutoGenerateHierarchy = true;
            SqlDataAdapter sdaCatid = null;
            DataSet dsCatid = new DataSet();
            DataSet dsGrid = DBFunctions.FillRadDataGirdReturnDS("category where parentcatid IN (select catid from category where catname='" + TV1.SelectedNode.Text + "')", dgrdSubCategory);

            for (int i = 0; i < dsGrid.Tables[0].Rows.Count; i++)
            {
                DataRow drow = dsGrid.Tables[0].Rows[i];
                sdaCatid = FillDataset("category where parentcatid='" + drow["catid"] + "'");
                sdaCatid.Fill(dsCatid);

            }
            int count = dsCatid.Tables[0].Rows.Count;

            GridViewTemplate template = new GridViewTemplate();
            template.DataSource = dsCatid.Tables[0];
            dgrdSubCategory.MasterGridViewTemplate.ChildGridViewTemplates.Add(template);

            GridViewRelation relation = new GridViewRelation(dgrdSubCategory.MasterTemplate);
            relation.ChildTemplate = template;
            relation.RelationName = "SubCategory";
            relation.ParentColumnNames.Add("catid");
            relation.ChildColumnNames.Add("catid");
            dgrdSubCategory.Relations.Add(relation);
            radGrid1.DataSource = template;
dgrdSubCategory.AutoGenerateHierarchy = true;
            SqlDataAdapter sdaCatid = null;
            DataSet dsCatid = new DataSet();
            DataSet dsGrid = DBFunctions.FillRadDataGirdReturnDS("category where parentcatid IN (select catid from category where catname='" + TV1.SelectedNode.Text + "')", dgrdSubCategory);

            for (int i = 0; i < dsGrid.Tables[0].Rows.Count; i++)
            {
                DataRow drow = dsGrid.Tables[0].Rows[i];
                sdaCatid = FillDataset("category where parentcatid='" + drow["catid"] + "'");
                sdaCatid.Fill(dsCatid);

            }
            int count = dsCatid.Tables[0].Rows.Count;

            GridViewTemplate template = new GridViewTemplate();
            template.DataSource = dsCatid.Tables[0];
            dgrdSubCategory.MasterGridViewTemplate.ChildGridViewTemplates.Add(template);

            GridViewRelation relation = new GridViewRelation(dgrdSubCategory.MasterTemplate);
            relation.ChildTemplate = template;
            relation.RelationName = "SubCategory";
            relation.ParentColumnNames.Add("catid");
            relation.ChildColumnNames.Add("catid");
            dgrdSubCategory.Relations.Add(relation);
            radGrid1.DataSource = template;


 dgrdSubCategory.AutoGenerateHierarchy = true;
            SqlDataAdapter sdaCatid = null;
            DataSet dsCatid = new DataSet();
            DataSet dsGrid = DBFunctions.FillRadDataGirdReturnDS("category where parentcatid IN (select catid from category where catname='" + TV1.SelectedNode.Text + "')", dgrdSubCategory);

            for (int i = 0; i < dsGrid.Tables[0].Rows.Count; i++)
            {
                DataRow drow = dsGrid.Tables[0].Rows[i];
                sdaCatid = FillDataset("category where parentcatid='" + drow["catid"] + "'");
                sdaCatid.Fill(dsCatid);

            }
            int count = dsCatid.Tables[0].Rows.Count;

            GridViewTemplate template = new GridViewTemplate();
            template.DataSource = dsCatid.Tables[0];
            dgrdSubCategory.MasterGridViewTemplate.ChildGridViewTemplates.Add(template);

            GridViewRelation relation = new GridViewRelation(dgrdSubCategory.MasterTemplate);
            relation.ChildTemplate = template;
            relation.RelationName = "SubCategory";
            relation.ParentColumnNames.Add("catid");
            relation.ChildColumnNames.Add("catid");
            dgrdSubCategory.Relations.Add(relation);
            radGrid1.DataSource = template;

 dgrdSubCategory.AutoGenerateHierarchy = true;
            SqlDataAdapter sdaCatid = null;
            DataSet dsCatid = new DataSet();
            DataSet dsGrid = DBFunctions.FillRadDataGirdReturnDS("category where parentcatid IN (select catid from category where catname='" + TV1.SelectedNode.Text + "')", dgrdSubCategory);

            for (int i = 0; i < dsGrid.Tables[0].Rows.Count; i++)
            {
                DataRow drow = dsGrid.Tables[0].Rows[i];
                sdaCatid = FillDataset("category where parentcatid='" + drow["catid"] + "'");
                sdaCatid.Fill(dsCatid);

            }
            int count = dsCatid.Tables[0].Rows.Count;

            GridViewTemplate template = new GridViewTemplate();
            template.DataSource = dsCatid.Tables[0];
            dgrdSubCategory.MasterGridViewTemplate.ChildGridViewTemplates.Add(template);

            GridViewRelation relation = new GridViewRelation(dgrdSubCategory.MasterTemplate);
            relation.ChildTemplate = template;
            relation.RelationName = "SubCategory";
            relation.ParentColumnNames.Add("catid");
            relation.ChildColumnNames.Add("catid");
            dgrdSubCategory.Relations.Add(relation);
            radGrid1.DataSource = template;
Richard Slade
Top achievements
Rank 2
 answered on 19 Nov 2010
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
Diagram, DiagramRibbonBar, DiagramToolBox
GanttView
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
ProgressBar
CheckedDropDownList
TrackBar
MessageBox
Rotator
SpinEditor
StatusStrip
CheckedListBox
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
DataEntry
ScrollablePanel
ScrollBar
WaitingBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Barcode
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
NavigationView
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
Licensing
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?