Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
224 views
Hello,

I'm getting the following javascript Ajax related error when I set up a custom iTemplate instead of using the Telerik GridTemplateColumn.  The error shows up when I click on the custom link I create instead of using the aspx GridTemplateColumn's link.

Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.

The error details say it is a 500 error.


If I use the GridTemplateColumn shown below, it works fine.

<Columns> 
     <telerik:GridTemplateColumn UniqueName="Delete" AllowFiltering='false'> 
          <HeaderStyle Width="45px" /> 
          <ItemStyle CssClass="c" /> 
          <ItemTemplate> 
               <asp:HyperLink ID="DeleteLink" runat="server" Text="Delete" /> 
          </ItemTemplate> 
     </telerik:GridTemplateColumn> 
</Columns> 

But when I convert it to an iTemplate using the following code, I receive the error.

Dim type As String = "Delete" 
Dim column As New GridTemplateColumn 
column.AllowFiltering = False 
column.HeaderStyle.Width = 45 
column.ItemStyle.CssClass = "c" 
column.ItemTemplate = New HyperlinkTemplate(type) 
column.UniqueName = type 
RadGrid1.MasterTableView.Columns.Add(column) 

My HyperlinkTemplate is the following class.

Public Class HyperlinkTemplate 
    Implements ITemplate 
    Private _type As Object 
 
    Public Sub New(ByVal type As String) 
        MyBase.New() 
        _type = type 
    End Sub 
 
    Public Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn 
        Dim hl As New HyperLink 
        hl.EnableViewState = False 
        hl.ID = _type & "Link" 
        hl.Text = _type 
        hl.Attributes("href") = "#" 
        container.Controls.Add(hl) 
    End Sub 
End Class 

I have an OnItemCreated event that runs the following code which adds an onclick event which I will show next and customizes the ID to make it unique:

Dim deleteLink As HyperLink = DirectCast(e.Item.FindControl("DeleteLink"), HyperLink) 
deleteLink.Attributes("onclick") = [String].Format("return Delete('{0}');", e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)(IDcolumnIsHere)) 
deleteLink.ID &= e.Item.ItemIndex 
 

The onclick code calls the RadAjaxManager I have set up.

function Delete(id) { $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Grid,Delete," + customValue + "," + id); } 


The custom column is added during the Page_Load event.

It never reaches the Ajax Handler I have set up unless I use the aspx GridTemplateColumn instead of my custom template.

Am I doing something wrong with the iTemplate or am I not initializing something I should be that integrates it with the RadGrid?  I've tried going through the various properties available to me for the column and the iTemplate, but I haven't had any luck making the error go away so I know I'm missing something... just not sure what.


Ivan Stoilkov
Top achievements
Rank 1
 answered on 08 Oct 2009
6 answers
826 views
Hi,

I am initially loading the grid in edit mode - and when doing that, RadGrid seems to ignore the value for the DataFormatString property of my GridBoundColumn
It works if I do not load the grid in edit mode.

How can I make it work when loading in edit mode?
Daniel
Telerik team
 answered on 08 Oct 2009
2 answers
200 views

I’m having a problem with the selection of rows in a Master/Detail Grid.

 

Scenario: I have a page with two grids that are connected via a Master/Detail relationship.  It is similar to http://demos.telerik.com/aspnet-ajax/grid/examples/programming/selectedvalue/defaultcs.aspx, except I have two grids instead of three and my page’s pre-render event codebehind looks like:


Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender  
            If RadGrid1.SelectedIndexes.Count = 0 Then 
                RadGrid1.SelectedIndexes.Add(0)  
            End If 
        End Sub 

 

When the page loads for the first time, the first row in the Master grid is selected, but not the first row in the Detail grid. 

 

I wanted to know how to select the first row in the Detail Grid of a Master/Detail Grid on the first load of the page if the Detail grid has any rows related to that particular Master grid item at Index(0).

jgill
Top achievements
Rank 1
 answered on 08 Oct 2009
4 answers
385 views
Hi
I got permission denied error and some more script errors in telerik.web.ui.webresource.axd file for the first time i request the page from the IIS server. Once I refresh the page, it works fine without any script error. This error doesnot happen if I run the code locally from my system. This error doesnot occur if I use automatically detect setting in LAN settings. But the error happens if check proxy server for lan and add the ip of the site to advanced settings (donot use proxy option).
Please provide the solution and reason for this.
regards
Bharath
Jon
Top achievements
Rank 1
 answered on 08 Oct 2009
2 answers
192 views
Hello, I'm having a bit of trouble trying to put nested controls in a databound RadPanel. What I want is basically the same as this example:

http://www.telerik.com/help/aspnet-ajax/panel_templatesoverview.html


However, the problem is that I do not know how many items I'm going to have until run time.

If I have

<telerik:RadPanelBar ID="RadPanelBar1" runat="server" ItemCreated="RadPanelBar1_ItemCreated">  
    <ItemTemplate>            
      <asp:TextBox ID="txtResponse" TextMode="MultiLine" runat="server" /><br /> 
      <asp:Button ID="btnSubmit" runat="server" Text="Submit" Visible="true" /> 
      <asp:LinkButton ID="lbAsk" runat="server" Visible="true" /> 
      <asp:LinkButton ID="lbNewEvisit" runat="server" Visible="true" /> 
                </ItemTemplate>                 
</telerik:RadPanelBar> 
 

and my codebehind looks like
protected void RadPanelBar1_ItemCreated(object sender, RadPanelBarEventArgs e)  
{  
      if (e.Item.Owner is RadPanelBar)  
      {  
           RadPanelItem i = new RadPanelItem();  
           e.Item.Items.Add(i);  
      }  
}  
 
/* Page Load Event and other stuff */ 
RadPanelBar1.DataSource = ds.Tables[0];  
RadPanelBar1.DataTextField = "dtEvisitStart";  
RadPanelBar1.DataBind();  
 
 

What happens is that the item template is created correctly for each item, with each item heading correct, however there's a duplicate set of controls attached to each item as seen on the attached image (each date should only have one set of controls).
I see similar behavior in static code if I remove the empty ItemTemplate place holder, but I can't seem to correct the problem for the dynamically bound panel. Any help greatly appreciated! Thank you.
Landon Martin
Top achievements
Rank 1
 answered on 08 Oct 2009
1 answer
118 views
Hi,

I am using a template manager and only want the user to select from existing templates.

How do i disable the upload and delete button in the template manager?

Thanks,
Phi
Rumen
Telerik team
 answered on 08 Oct 2009
5 answers
573 views
Is there a way to change / localize the message "Type the code from the image"?
Pero
Telerik team
 answered on 08 Oct 2009
5 answers
233 views
Hi,

In my implementation i have inserted a RadTreeview control inside RadCombobox which inturn is placed inside the RadGrid.
For one of my requirements i want that when user click on any node i want to attain handle of RadComboBox and do some operations on it.
But i am unable to find the parent conrol of Radtreeview.

Any ideas on how can this be done?

Regards,
Amit
Veselin Vasilev
Telerik team
 answered on 08 Oct 2009
1 answer
294 views
Hello Sir,

I am currently using telerik RadMenu in my project. In my project i want to create menu dynamically, and also i need templates for child items created dynamically.. i have gone through your forums.. and found out how to create menu dynamically as well as how to add templates dynamically.. but my requirement is that i need a menu item created dynamically along with its child items created dynamically using templates. And this template, contains DataList and other controls.... how can i do this...i need the child item loaded in a template format just as shown in the design mode in ur examples.........

Please help... 

regards,
jeby.
Yana
Telerik team
 answered on 08 Oct 2009
3 answers
149 views

Hi
In my rad schheduler i have enabledatepicker="true".But
In timelineview there is no records for current month the height of the scheduler is samll.At the time if i click the datepicker its not visible fully because the height of the scheduler is less than datepicker.

see this demo link change the numberofslot="1" in the above dropdown. and click the datepicker you can see the bottom of the datepicker not visible.
http://demos.telerik.com/aspnet-ajax/scheduler/examples/timelineview/defaultcs.aspx.


I want the datepicker visible fully

Regards
Vairamuthu
Peter
Telerik team
 answered on 08 Oct 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?