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

2 posts, 0 answers
  1. doug
    doug avatar
    25 posts
    Member since:
    Jan 2011

    Posted 15 Mar 2011 Link to this post

    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

     

  2. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 17 Mar 2011 Link to this post

    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
Back to Top