This is a migrated thread and some comments may be shown as answers.

script control error

1 Answer 32 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
subrahmanyam kameswara
Top achievements
Rank 1
subrahmanyam kameswara asked on 14 May 2010, 11:45 AM
I am creating radtree node and radgrid dynamically

when I am creating the radgrid dynamically and attaching to the treenode i am getting the script error.

---------------------------
Microsoft Internet Explorer
---------------------------
Script control '' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().Parameter name: scriptControl
---------------------------
OK   
---------------------------

below is the code for the controls i build, plz help me this is strange error which i never get.



using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using Telerik.Web.UI;
using System.Web.UI.HtmlControls;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
public partial class NewBusiness : System.Web.UI.Page
{
    private void AddChildNodes(RadTreeNode tNode1)
    {
        if (tNode1.Text == "POLICY")
        {
            BindPolicy(tNode1);
        }
        else if (tNode1.Text == "ENTITIES")
        {
            NodeTxt = BindGrids(tNode1, tNode1.Text, "~/XMLs/EntitiesInfo.xml");
            tNode1.Text = "ENTITIES" + " (" + NodeTxt + ")";

            if (!object.Equals(Session["Node"], null))
            {
                if (Session["Node"].ToString().Trim().Length > 0 && Session["Node"].ToString().Equals(tNode1.Text))
                {
                    tNode1.Expanded = true;
                }
            }
        }
        else if (tNode1.Text == "COVERAGE")
        {
            BindCoverage(tNode1);
        }
        else if (tNode1.Text == "VEHICLES")
        {
            NodeTxt = BindGrids(tNode1, tNode1.Text, "~/XMLs/Vehicle.xml");
            tNode1.Text = "VEHICLES" + " (" + NodeTxt + ")";
            if (!object.Equals(Session["Node"], null))
            {
                if (Session["Node"].ToString().Trim().Length > 0 && Session["Node"].ToString().Equals(tNode1.Text))
                {
                    tNode1.Expanded = true;
                }
            }

        }
        else if (tNode1.Text == "DRIVERS")
        {
            NodeTxt = BindGrids(tNode1, tNode1.Text, "~/XMLs/DriversInfo.xml");
            tNode1.Text = "DRIVERS" + " (" + NodeTxt + ")";
            if (!object.Equals(Session["Node"], null))
            {
                if (Session["Node"].ToString().Trim().Length > 0 && Session["Node"].ToString().Equals(tNode1.Text))
                {
                    tNode1.Expanded = true;
                }
            }

        }
        else if (tNode1.Text == "HISTORY")
        {
            NodeTxt = BindGrids(tNode1, tNode1.Text, "~/XMLs/CarrierInfo.xml");
            tNode1.Text = "HISTORY" + " (" + NodeTxt + ")";
        }

        else if (tNode1.Text == "RATE")
        {
            BindRate(tNode1);
        }
    }

    private string BindGrids(RadTreeNode tNode1, string NodeText, string xmlpath)
    {
        string strgrid = string.Empty;
        rdGrid = new RadGrid();

        RadScriptManager1.RegisterScriptControl(rdGrid);

        ds = new DataSet();
        ds.ReadXml(Server.MapPath(xmlpath));
        Session["ds"] = ds;

        rdGrid.AllowPaging = true;
        rdGrid.GridLines = GridLines.None;
        rdGrid.SelectedItemStyle.CssClass = "MySelectedClass";
        rdGrid.CommandItemStyle.Wrap = true;
        rdGrid.AlternatingItemStyle.BackColor = Color.White;
        rdGrid.PagerStyle.AlwaysVisible = true;
        rdGrid.AutoGenerateColumns = false;
        rdGrid.ItemStyle.Width = 30;
        rdGrid.Width = Unit.Pixel(240);
        rdGrid.DataSource = ds;

        GridBoundColumn sno = new GridBoundColumn();
        sno.DataField = "SNo";
        sno.HeaderText = "#";
        sno.HeaderStyle.Width = Unit.Pixel(10);
        sno.ItemStyle.Width = Unit.Pixel(10);
        sno.HeaderStyle.CssClass = "grdHdr";
        sno.FooterStyle.CssClass = "grdPager";
        sno.ItemStyle.CssClass = "grdItem";
        rdGrid.MasterTableView.Columns.Add(sno);

        GridBoundColumn Name = new GridBoundColumn();
        if (NodeText == "VEHICLES" || NodeText == "RVEHICLES")
        {
            Name.DataField = "VIN";
            Name.HeaderText = "VIN";
        }
        else if (NodeText == "HISTORY")
        {
            Name.DataField = "CarrierName";
            Name.HeaderText = "CarrierName";
        }
        else if (NodeText == "Locations")
        {
            Name.DataField = "Location";
            Name.HeaderText = "Location";
        }
        else if (NodeText != "Vehicles")
        {
            Name.DataField = "Name";
            Name.HeaderText = "Name";
        }

        Name.HeaderStyle.Width = Unit.Pixel(130);
        Name.ItemStyle.Width = Unit.Pixel(130);
        Name.HeaderStyle.CssClass = "grdHdr";
        Name.FooterStyle.CssClass = "grdPager";
        Name.ItemStyle.CssClass = "grdItem";
        Name.ItemStyle.Wrap = false;
        rdGrid.MasterTableView.Columns.Add(Name);

        if (NodeText != "Locations" && NodeText != "RVEHICLES")
        {
            GridButtonColumn delete = new GridButtonColumn();
            delete.HeaderStyle.Width = Unit.Percentage(5);
            delete.HeaderText = "Delete";
            delete.ButtonType = Telerik.Web.UI.GridButtonColumnType.ImageButton;
            delete.ImageUrl = "../Images/deleteicon_disabled.gif";
            delete.ConfirmDialogType = GridConfirmDialogType.RadWindow;
            delete.ConfirmText = "Are you sure want to delete Applicant?";
            delete.HeaderStyle.CssClass = "grdHdrDel";
            delete.ItemStyle.CssClass = "grdItemDel";
            delete.FooterStyle.CssClass = "grdPager";
            rdGrid.MasterTableView.Columns.Add(delete);
        }
        rdGrid.MasterTableView.ClientDataKeyNames = new String[] { "SNo" };
        rdGrid.ClientSettings.Selecting.AllowRowSelect = true;
        rdGrid.ClientSettings.ClientEvents.OnRowSelected = "RowSelected";

        rdGrid.DataSource = ds.Tables[0];
        rdGrid.DataBind();

        // rdGrid.NeedDataSource += new GridNeedDataSourceEventHandler(rdGrid_NeedDataSource);
        RadTreeNode tNode = new RadTreeNode();
        tNode.Controls.Add(rdGrid);
        tNode1.Nodes.Add(tNode);

        return ds.Tables[0].Rows.Count.ToString();
    }

}



1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 May 2010, 02:30 PM

Hi,

I saw some forum threads which discussed on similar scenarios and solution methods. Please go through following links, which might help you in solving this exception.

Script control 'RadProgressManager1' is not a registered script control

'Request is not available in this context' exception

selected radgrid row not displaying fieldset

-Shinu.

Tags
TreeView
Asked by
subrahmanyam kameswara
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or