Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
361 views
When I integrate radGrid into my customized webcontrol, I meet a error: Script controls may not be registered before PreRender. the following is the source code:
    public class Grid : WebControl, IScriptControl
    {
        // Sub controls
        private RadGrid _radGrid;
        private ScriptManager sm;

        protected override void CreateChildControls()
        {
            Controls.Clear();

            this._radGrid = new RadGrid();
            this._radGrid.NeedDataSource += new GridNeedDataSourceEventHandler(this.radGrid_NeedDataSource);
           
            this.Controls.Add(this._radGrid);

            base.CreateChildControls();
        }

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            if (!this.DesignMode)
            {
                // Test for ScriptManager and register if it exists
                sm = ScriptManager.GetCurrent(Page);

                if (sm == null)
                    throw new HttpException("A ScriptManager control must exist on the current page.");

                sm.RegisterScriptControl(this);
            }

        }

        protected void radGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
                try
                {
                    DataTable tbl = new DataTable();
                    ....
                    DataView valuesView = tbl.DefaultView;
                    this._radGrid.DataSource = valuesView;
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                }
        }

        #region IScriptControl Members

        public IEnumerable<ScriptDescriptor> GetScriptDescriptors()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public IEnumerable<ScriptReference> GetScriptReferences()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        #endregion

        #region IScriptControl Members

        IEnumerable<ScriptDescriptor> IScriptControl.GetScriptDescriptors()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        IEnumerable<ScriptReference> IScriptControl.GetScriptReferences()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        #endregion
    }

And then I re-design my webcontrol inherited from RadWebControl, the same error occur.

Server Error in '/' Application.

Script controls may not be registered before PreRender.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Script controls may not be registered before PreRender.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: Script controls may not be registered before PreRender.]
System.Web.UI.ScriptControlManager.RegisterScriptControl(TScriptControl scriptControl) +236
System.Web.UI.ScriptManager.RegisterScriptControl(TScriptControl scriptControl) +99
Telerik.Web.UI.RadWebControl.RegisterScriptControl() +60
Telerik.Web.UI.RadWebControl.OnPreRender(EventArgs e) +64
System.Web.UI.Control.PreRenderRecursiveInternal() +86
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

How can I integrate radGrid into my customized webcontrol?

Ron Hary
Top achievements
Rank 2
 answered on 24 Jun 2008
3 answers
109 views
Hi!

Anybody knows how to set the skin of the GridDropDownColumn?
all the project uses the skin that is set-up in the webconfig like this:

<add key="Telerik.Skin" value="Vista"/>

But, the GridDropDownColumn is using the default one. Any workaround?

Thanks!
Diego
Top achievements
Rank 1
 answered on 24 Jun 2008
3 answers
109 views
I am checking the features available in Telerik for one of my client. If I am able to show them what they want then client will buy the product.
Main requirement of client is:
Add Windows Explorer type show/hide column on the ColumnContextMenu of radgrid column header. The hide/show column should work on onmouseout of the contextmenu instead of each click of column. So I tried using a Tooltip. Is there a way, I can access the checkboxlist I used in the ascx file (to be opened as a Tooltip), on mouseout event of the Tooltip. The show/hide column value has to be saved in the database, its not just client side.

Please reply as the decision to buy Telerik product depends on this requirement.

Thanks,
KM 
Maria Ilieva
Telerik team
 answered on 24 Jun 2008
3 answers
149 views

Please follow the code below.
I'm trying to generate a chart using the WebMethod and try to send the response (either the whole rendered output of RadChart or just the ChartImage.axd url) as a repsonse in an Ajax method.

How can I achieve? Or is this undoable?

[System.Web.Services.WebMethod()]  
    public static string GetChart1()  
    {  
        Telerik.Web.UI.RadChart chart = new Telerik.Web.UI.RadChart();  
         
        chart.ChartTitle.TextBlock.Text = "My title";  
        chart.DefaultType = ChartSeriesType.Line;  
        chart.Appearance.ImageQuality = Telerik.Charting.Styles.ImageQuality.HighQuality;  
        ChartSeries data1 = new ChartSeries("Page Views", ChartSeriesType.Line);  
        data1.AddItem(100);  
        data1.AddItem(25);  
        data1.AddItem(500);  
        data1.AddItem(1000);  
        data1.AddItem(5000);  
 
        ChartSeries data2 = new ChartSeries("Hits", ChartSeriesType.Line);  
        data2.AddItem(50);  
        data2.AddItem(100);  
        data2.AddItem(300);  
        data2.AddItem(2000);  
        data2.AddItem(4000);  
 
        chart.Series.Add(data1);  
        chart.Series.Add(data2);  
          
        //determine the output  
    } 

<script type="text/javascript">  
      
        function CreateChart1()  
        {  
            PageMethods.GetChart1(Chart1Render, OnFailure);  
        }  
      function Chart1Render(res)  
      {  
        $get("chart1").innerHTML = res;  
      }  
      function OnFailure(res)  
      {  
        alert(res);  
      }  
      
    </script> 
Giuseppe
Telerik team
 answered on 24 Jun 2008
3 answers
126 views
Hi,

I'm pretty happy with where I've managed to get with the Scheduler control so far but have couple of things still to learn. I have restricted the control to display in month view and I've got the appointment management working fine (inserting, modifying and deleting both individual and recurring appointments). However, if I have an appointment with a weekly recurrence and I try to view the next month it won't show the recurring appointments. The non-recurring appointments display fine.

I'm tempted to hide the header altogether and implement my own 'Next/Previous' functionality - reloading the calendar with each new month, as I know this will work, but I was hoping there was something I'm missing or that there is a quicker/easier way to do this.

On a seperate note, and I'm not too concerned about this, is there a way to restrict recurrence to just weekly and monthly without implementing a full AdvancedInsertTemplate and AdvancedEditTemplate? Is there some property I can set which will give me this level of control?

Thanks in advance.

Cheers,
Zac
T. Tsonev
Telerik team
 answered on 24 Jun 2008
1 answer
113 views
I have a question for including file.
I would like to include dropdwon menu ("menu.aspx" file) into all other aspx files in the project.
Could someone tell me how I do it?

Thank you in adcvance,
Atanas Korchev
Telerik team
 answered on 24 Jun 2008
5 answers
195 views
I'm trying to create a RadPanelBar from a single database table.

The table structure is like this:

Fields
----------
A.    id    (table record id)
B.    category  (text field)
C.    itemName  (description of item).

I'm wanting the "category" field to act as the "grouping" for the panelbar and the "itemName" to be all the sub-items within each grouping.

Is this possible?

For example...

some records in table...

id  /  category  /  itemName
----------------------------
A.    1    /    fruit    /    banana
B.    2    /    fruit    /    apple
C.    3    /    fruit    /    grape
D.    4    /    vegetable    /    carrot
E.    5    /    vegetable    /    squash

So I want on a panelbar...

FRUIT
  banana
  apple
  grape

VEGETABLE
  carrot
  squash


Any assistance would be appreciated.

Thank you.

Mark
Paul
Telerik team
 answered on 24 Jun 2008
7 answers
215 views
Hello everybody!

For two days we are encountering very strange behaviour with the radgrid! For two days now, every new radgrid that contains an editbuttoncolumn doesn't work! There is always a NullReferenceException if you click the Edit button.
Even the simplest radgrid that works perfectly well in another new clean solution doesn't work. The "old" radgrids in the solution perform as expected.
No new updates were made, it just started happening.

Here's the stacktrace:

[NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.]

   Telerik.Web.UI.GridEditFormItem.CellsDataBound(GridColumn[] columns) +183

   Telerik.Web.UI.GridEditFormItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows) +312

   Telerik.Web.UI.GridItemBuilder.CreateItems(GridGroupingContext group) +861

   Telerik.Web.UI.GridTableView.CreateItems(IEnumerator enumerator, GridColumn[] columns, ControlCollection controls) +167

   Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +890

   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +532

   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +59

   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +111

   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +29

   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149

   Telerik.Web.UI.GridTableView.PerformSelect() +23

   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70

   Telerik.Web.UI.GridTableView.DataBind() +321

   Telerik.Web.UI.GridTableView.Rebind() +79

   Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source) +361

   Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +171

   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35

   Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +147

   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35

   System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115

   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +132

   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7

   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11

   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746


this happens always when you click the edit of newly added radgrids. Even radgrids that are copied / paste from other, working, aspx pages don't work  in editmode.

Pls help us, this issue is very urgent as I can't go on with development!


Thx in advance & kind Regards
Markus
Top achievements
Rank 2
 answered on 24 Jun 2008
5 answers
121 views

First bug:

node.set_visible(false); //STILL DOESN'T WORK! You have to do this:
node.get_element().style.display=
'none';

Second bug:

//If you set text containing "?" or ")" or "(" (and probably other characters too)
node.set_text("Why Us? (Part 1)"); 


//...then later change the text, it DOESN'T WORK:
node.set_text("abc"); 

//You have to do this:

node.get_textElement().innerHTML = "abc"
//but then renaming the node by clicking on it twice does not work as expected..

If I have to stuff around with regular element.innerHTML and element.style.display Javascript functions, what's the point of using your controls?

Regards,
Nuri

N
Top achievements
Rank 1
 answered on 24 Jun 2008
1 answer
105 views
Hi guys,

I have seen your recent RadPromptAndNavigationalControls2\ForcingServerSideClick submission, and it's really cool.

However, I wonder if there's a way to achieve a similar result somewhat differently, for a more narrow purpose.

I have a tree, each level of which has a node "New element". I would like my user to click this node -- rename it (thereby providing the name for the new element) -- and get the tree with the newly created element added.

I think what I need to do is rename the node on the client and then send the new name to the server; but I can't seem to figure out how to do it. (I would also like to go to a specific address on the server, potentially different at each level -- can I put it in NavigateUrl or something? didn't seem to work for me.)

Thanks for your help!
Victor.
Atanas Korchev
Telerik team
 answered on 24 Jun 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?