Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
179 views
I have a grid that implements advanced databinding (ie it used the NeedDataSource event to bind the grid). This grid uses the command item template and has some controls in it. It also uses custom sorting (ie it handles the GridSortCommand). I handle all sorting at the database end of things, which is why I implement Custom Sorting. Everything works fine, except I have noticed that the NeedDataSource event fires before the GridSortCommand Event. This causes my datagrid to rebind, then I handle the sort event and specify the sort parameters and rebind the grid. So, the grid essentially binds twice which is not efficient. The reason I brought up the CommandItemTemplate, is that I noticed that when the grid ItemCommand event occurs, the NeedDataSource event never fires unless I explicitly call Grid.Rebind(). This second event sequence makes sense to me and I am able to create the custom binding parameters prior to rebinding the grid.

However, in the sort scenario, this does not work. My basic question is... how do I get custom sorting to work properly with advanced databainding. I am sure there is some good reason to have the NeedDatSource event automatically fire prior to sorting in a built-in sorting scenario. However, with custom sorting, this causes problems.
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
 answered on 12 Feb 2009
3 answers
212 views
Some nodes of my RadTreeView have warning images (ImageUrl property), and when I set tooltip on that nodes it is displayed only for node text, I would like to display it for images also.
Simon
Telerik team
 answered on 12 Feb 2009
3 answers
536 views
Hello
Does it have a way to get the screen resolution in code behind
because in my code behind I have code like that
 Private Sub RadGrid_BanqueCV_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid_BanqueCV.DataBound  
        Dim grid As RadGrid = TryCast(sender, RadGrid)  
        Dim gridItems As Integer = grid.MasterTableView.Items.Count  
        If gridItems < 5 Then 
            grid.Height = 450  
        Else 
            grid.Height = 450 + (gridItems * 20)  
        End If 
        If grid.Height.Value > 650 Then 
            grid.Height = 650  
        End If 
    End Sub 
 But instead to have fixed values I would like to have screen resolution value to set the height.
Thanks!
Pavlina
Telerik team
 answered on 12 Feb 2009
1 answer
191 views

Hi

I'm hoping I can resolve my problem here, if not I'll log a support call/ ticket.

I Have an application utilising the RAD Grid, the Grid consists of 4 dropdown lists with the values being populated from reference tables inside the main data set. (The grid has auto generate columns set to false).

The issue is that Every second line (the alternate line) doesn't render text - I've right clicked and 'Viewed Source" and in the table elements for the missing lines &nbsp is displayed additionally when I click the 'edit' link for a line where the data is missing the correct values are populated in the edit form, though when I click 'edit' for a line where the data is rendered no values are populated in the dropdown lists.

My first thought was a style sheet clash however given the table elements in View Source have &nbsp I don't believe this is the cause.

Another issue I've discovered is when I click 'edit' on a line that does render when the "ReadOnly" attribute is set to 'true' the RadGrid throws an application error stating: Object reference not set to an instance of an object


I've included the html from the aspx page below - showing the Rad Grid

  <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" 
        AutoGenerateColumns="False" AutoGenerateEditColumn="True" GridLines="None">  
        <HeaderContextMenu EnableTheming="True">  
            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
        </HeaderContextMenu> 
        <MasterTableView> 
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridDropDownColumn DataField="Delay_Code_ID" DataSourceID="dsdelaycodemapping" 
                    HeaderText="Code" ListDataMember="RRD_011_DELAY_CODE" ListTextField="Delay_DS" 
                    ListValueField="id" ReadOnly="True" UniqueName="column">  
                </telerik:GridDropDownColumn> 
                <telerik:GridDropDownColumn DataField="COAL_SYSTEM_REPORT_ID" DataSourceID="dsdelaycodemapping" 
                    HeaderText="Coal System" ListDataMember="RRD_008_DELAY_RESPONSIBILITY" ListTextField="DELAY_RESPONSIBILITY_NM" 
                    ListValueField="ID" UniqueName="column1">  
                </telerik:GridDropDownColumn> 
                <telerik:GridDropDownColumn DataField="REPORTING_SYSTEM_REPORT_ID" DataSourceID="dsdelaycodemapping" 
                    HeaderText="Reprting System" ListDataMember="RRD_008_DELAY_RESPONSIBILITY" ListTextField="DELAY_RESPONSIBILITY_NM" 
                    ListValueField="ID" UniqueName="column2">  
                </telerik:GridDropDownColumn> 
                <telerik:GridDropDownColumn DataField="QT_DELAY_CATEGORY_ID" DataSourceID="dsdelaycodemapping" 
                    HeaderText="QT Delay Category" ListDataMember="RRD_015_DELAY_CATEGORY" ListTextField="DELAY_CATEGORY_NM" 
                    ListValueField="ID" UniqueName="column3">  
                </telerik:GridDropDownColumn> 
            </Columns> 
        </MasterTableView> 
        <FilterMenu EnableTheming="True">  
            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
        </FilterMenu> 
    </telerik:RadGrid> 

The Code behind  (...this is taken from a smaller solution I created in order to re-create the problem).
Imports System.Web.UI  
Imports System.IO  
Imports System.Xml  
Imports QR.TELERIKRADGRID.DataObjects  
 
Partial Public Class Index  
    Inherits SiteBasePage 'Inherits System.Web.UI.Page  
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load  
        Try 
            If Me.IsPostBack = False Then 
 
                'Create an instance of our typed dataset and disable constraints.   
                Dim dsDelayCodeMapping As New dssDelayCodeMapping  
                dsDelayCodeMapping.EnforceConstraints = False 
 
                'Populate the dataset  
                dsDelayCodeMapping = Populate_DS(dsDelayCodeMapping)  
 
                'sets the RAD GRID DataSource  
                RadGrid1.DataSource = dsDelayCodeMapping  
            End If 
 
        Catch ex As System.Exception  
 
        End Try 
    End Sub 
 
    ''' <summary>  
    ''' Populates the Typed dataset from an XML document.   
    ''' The location of the XML Document will need to be set according to the individual machine that the solution  
    ''' is running on Modify the "strPath" value.   
    ''' </summary>  
    ''' <param name="dsDelayCodeMapping"></param>  
    ''' <returns></returns>  
    ''' <remarks></remarks>  
    Private Function Populate_DS(ByVal dsDelayCodeMapping As dssDelayCodeMapping) As dssDelayCodeMapping  
 
        'Specify the Location the XML document to read into the dataset.  
        Dim strPath As String = "D:\Projects\TELERIKRADGRID\TELERIKRADGRID\Web\" 
 
        'Read the XML Document into the dataset using the Generic readXML Function.   
        dsDelayCodeMapping.ReadXml(strPath & "XMLSTRING.xml")  
 
        Return dsDelayCodeMapping  
 
    End Function 
 
    ''' <summary>  
    ''' Required Function of RadGrid  
    ''' </summary>  
    ''' <param name="source"></param>  
    ''' <param name="e"></param>  
    ''' <remarks></remarks>  
    Private Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource  
 
        'Create an instance of our typed dataset and disable constraints.   
        Dim dsDelayCodeMapping As New dssDelayCodeMapping  
        dsDelayCodeMapping.EnforceConstraints = False 
 
        RadGrid1.DataSource = Populate_DS(dsDelayCodeMapping)  
 
    End Sub 
 
End Class 

If required I can Attach this smaller solution to any support ticket required, however I will be unable to do this until Wednesday.

Any assistance in the mean time will be greatly appreciated.

Cheers.
Daniel.

Pavlina
Telerik team
 answered on 12 Feb 2009
2 answers
123 views
I have a rad grid with a template column. The template column contains a div element which I use as a toggle to show/hide some content. I set the onclick attribute for the div tag in the grid's ItemDatabound event. The div tag's clientId is passed to the following javascript function and I have domething along the lines of :

function toggleOfferItem_CSOC(divClientId)  
        {  
            var div = document.getElementById(divClientId);  // this is null after ajax update
} 

When the page first loads and the grid is bound, everything works fine. Clicking on the div runs the javascript funciton and it does it's work. However, if I update the page with Ajax (the grid doesn't get rebound), then I get a null reference for the div within the javascript function. It would seem that the ajax update is changing the DOM structure of the page and since the grid isn't rebound, the Client ID which is passed to the javascript function is no longer valid.

So... is there a way to modify my javascript function to take this change into account?
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
 answered on 12 Feb 2009
1 answer
205 views
Hi
I have a RadGrid as follows:
Master (editable)
+ Detail1 (non-editable)
+ Detail2 (insert and editable)

In the MasterView is a status value. The following code works except for the FindControl of InitInsertButton.

Protected Sub invoiceGrid_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs)  
    If TypeOf e.Item Is GridDataItem Then  
        Dim _item As GridDataItem = e.Item  
        If (_item.OwnerTableView.Name = "InvoiceMasterView") Then  
            ' ... 8 line removed, very similar to following code ...  
        ElseIf (_item.OwnerTableView.Name = "InvoiceDetailAmounts") Then  
            Dim _parentItem As GridDataItem = _item.OwnerTableView.ParentItem  
            Dim _status As Integer = CInt(_parentItem("InvoiceStatus").Text)  
            If Not (Helper.GetStatusUpdatable(_status)) Then  
                Dim _ctl As Control = _item.OwnerTableView.FindControl("InitInsertButton")  
                If Not _ctl Is Nothing Then  
                    CType(_ctl, LinkButton).Enabled = False 
                End If  
                Dim _editCtl As LinkButton = CType(_item("AmountsEditCommandColumn").Controls(0), LinkButton)  
                If Not _editCtl Is Nothing Then  
                    _editCtl.Enabled = False 
                End If  
            End If  
        End If  
    End If  
End Sub  
 

How do I find the InitInsertButton control in the detail2 view in the ItemDataBound event?
Phil
Princy
Top achievements
Rank 2
 answered on 12 Feb 2009
1 answer
117 views
I am having an issue when inserting the first child in a parent/child grid.  The insert is sent to the DB and the stored procedure inserts the correct data and generates a guid for the key on the newly inserted row.  I know radGrid is getting this guid back, but I can't figure out how to get it in the ItemInserted event.  Code in the iteminserted:
            GridEditableItem scope = e.Item as GridEditableItem; 
            try 
            { 
               CalculateDates((Guid)scope.OwnerTableView.DataKeyValues[scope.ItemIndex]["ScopeID"]); 
            } 

The issue is that scope.ItemIndex is always -1 and DataKeyValues.Count == 0.  How else can I extract the new key?


Princy
Top achievements
Rank 2
 answered on 12 Feb 2009
2 answers
72 views
This happened after upgrading to 2008.3.1314.35.
Shinu
Top achievements
Rank 2
 answered on 12 Feb 2009
3 answers
140 views

How to implement "bulk update" operation in rad grids without storing data in session?

Shinu
Top achievements
Rank 2
 answered on 12 Feb 2009
1 answer
180 views
Hello-

I have a RadGrid setup on my ASPX page with a custom edit template.  If add a new record or edit an existing record this custom template displays with a number of text boxes.  TextBox1, TexBox2, etc.  I want to take the text that was entered in one of the boxes TextBox1 for example and create a physical folder with that name (text from the textbox).

I'm not sure on a few things:

1. How do i get at a textbox control in a custom template?
2. I need to be able to do this on a New Record and Update Record.

The application is to take data entered by the user to describe a photo album.  I then want to create a physical folder in two locations, this will be for thumbnails and fullsize photos to be shown the enduser.

Thanks!
Princy
Top achievements
Rank 2
 answered on 12 Feb 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?