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

Value of type 'String' cannot be converted to 'Telerik.Web.UI.RadTextBox

1 Answer 72 Views
Documentation and Tutorials
This is a migrated thread and some comments may be shown as answers.
doug
Top achievements
Rank 2
doug asked on 15 Mar 2011, 07:25 PM
i am trying to sample the following demo code: (vb)
http://demos.telerik.com/aspnet-ajax/ajax/examples/manager/dynamicajaxsettings/defaultcs.aspx?product=grid

everything looks ok when i apply the code to a single page aspx and ascx.  But when i try to put the aspx code in a master.page it throws the following error.  Object ref. not set to an instance.....for the ascx line:

RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(editButton, Me.Page.FindControl("DivExternalForm"), TryCast(Me.Page.FindControl("RadAjaxLoadingPanel1"), RadAjaxLoadingPanel))

 

 

 

 



subroutine:

 

 

Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs)

 

 

 

 

If TypeOf e.Item Is GridDataItem Then

 

 

 

Dim editButton As ImageButton = TryCast(TryCast(e.Item, GridDataItem)("EditColumn").Controls(0), ImageButton)

 

 

 

 

RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(editButton, Me.Page.FindControl("DivExternalForm"), TryCast(Me.Page.FindControl("RadAjaxLoadingPanel1"), RadAjaxLoadingPanel))

 

 

 

 

ElseIf TypeOf e.Item Is GridCommandItem Then

 

 

 

Dim insertButton As LinkButton = TryCast(TryCast(e.Item, GridCommandItem).FindControl("btnInitInsert"), LinkButton)

 

 

 

 

RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(insertButton, Me.Page.FindControl("ctl00_ContentPlaceHolder1_DivExternalForm"), TryCast(Me.Page.FindControl("RadAjaxLoadingPanel1"), RadAjaxLoadingPanel))

 

 

 

 

End If

 

 

 

End Sub

thanks
Doug

 

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 17 Mar 2011, 12:58 PM
Hello Doug,

The described issue concerning following exception - Value of type 'String' cannot be converted to 'Telerik.Web.UI.RadTextBox is caused by the ID of the following RadTextBox:
<telerik:RadTextBox ID="Title" runat="server" ></telerik:RadTextBox>

To avoid the described error you need to set the different ID. For example:
<telerik:RadTextBox ID="Title1" runat="server" ></telerik:RadTextBox>

Additionally I am sending you a simple example. Please check it out and let me know if it helps you.

Regards,
Radoslav
the Telerik team
Tags
Documentation and Tutorials
Asked by
doug
Top achievements
Rank 2
Answers by
Radoslav
Telerik team
Share this question
or