Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
168 views
Hello,

I have added a file explorer in my page with this code:

  <telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" Width="95%"   
                    EnableOpenFile="true" Skin="Vista" EnableCreateNewFolder="False" VisibleControls="TreeView, Grid" EnableEmbeddedSkins="true" > 
                    <Configuration SearchPatterns="*.*" /> 
</telerik:RadFileExplorer> 

But doesn't show sort icons in execution.

And in design mode the skin selector show an empty list.

Version Q1.2009

Thanks in advanced
Blas
Fiko
Telerik team
 answered on 22 Apr 2009
1 answer
295 views
Hi,

Using version 2009 Q1 SP1 (2009.1.402.35), I'm trying to dynamically set the content of a tooltip created from the ToolTipManager Client API to some DOM element. I get the following error when calling set_contentElement(): "this._contentCell is null".

Here is a sample code to reproduce the problem :

<script type="text/javascript"
   Sys.Application.add_load(function() { 
      window.toolTipManager = $find("<%= RadToolTipManager1.ClientID %>"); 
   }); 
 
   function PopupTooltipManager(anchor) 
   { 
      if (!window.toolTipManager) { 
         return; 
      } 
         
      //Find the tooltip for this element if it has been created 
      var tooltip = toolTipManager.getToolTipByElement(anchor); 
         
      //Create a tooltip if no tooltip exists for such element 
      if (!tooltip) { 
         tooltip = toolTipManager.createToolTip(anchor); 
          
         var contentElement = document.createElement('SPAN');   
         contentElement.innerHTML = 'Testing' 
         tooltip.set_contentElement(contentElement); 
      } 
 
      //show the tooltip 
      tooltip.show(); 
   } 
</script> 
 
 
<div onclick="PopupTooltipManager(this);">Create tooltip from manager</div> 
 
<telerik:RadToolTipManager ID="RadToolTipManager1" runat="server"
</telerik:RadToolTipManager> 

Am I going at this the wrong way? Can you provide any help ?

Thanks a lot,

Dominic.
Svetlina Anati
Telerik team
 answered on 22 Apr 2009
1 answer
137 views
I have a column that I'm displaying in the RadGrid which has text in the following format:

"Part1.Part2.Part3.Part4"

The number of parts is variable.

I'd love to be able to group their display in the grid based on everything but the last part in the string. For instance, consider the following values:

MyCompany.MyProduct.MyModule1.MySetting1
MyCompany.MyProduct.MyModule1.MySetting2
MyCompany.MyProduct.MyModule2.MySetting3
MyCompany.MyProduct.MyModule3.MySetting4

My grid would display like:

MyCompany.MyProduct.MyModule1
--> MyCompany.MyProduct.MyModule1.MySetting1
--> MyCompany.MyProduct.MyModule1.MySetting2
MyCompany.MyProduct.MyModule2
--> MyCompany.MyProduct.MyModule2.MySetting3
MyCompany.MyProduct.MyModule3
--> MyCompany.MyProduct.MyModule3.MySetting4

In otherwords, is there a way to create a grouping expression that grouped on a substring of the value of the column?
Yavor
Telerik team
 answered on 22 Apr 2009
1 answer
792 views
I am trying to create a webpage that allows the user to edit the values of a record in a usercontrol.  The webpage contains two comboboxes that allowing the user to pick a date and company.  The user must first select a date.  This action allows provides a parameter for the row source for the second combobx which is populated with companies.  When the user selects a company, the first and second comboboxes provide the parameters for a RadGrid which is populated with a the information for a single company.  To minimize the number of clicks the user has to perform, the RadGrid is made to open in Edit Mode, using a UserControl to display the data. In order to fill in the controls on the control with the values that should be edited, the RadGrid PreRender event is used to determine which values are in being passed to the Grid.  These values are stored in session variables named after the field that held them.  After the values have been stored the datagriditem containing it is placed in edit mode and the grid is rebound. After the rebind command the grid opens in Edit mode displaying the UserControl. The UserGrid controls are populated with the correct values during the RadGrid_ItemDataBound event using the values stored in the session variables.  I have not bound the controls on the usercontrol to the underlying as some of the controls will be multiselect listboxes which cannot be populated this way.

On the selection of the first company the UserForm is properly displayed in edit mode and the controls are properly filled out.  If a second company is selected while the first one is still in edit mode the datasource for the grad grid is properly updated with the data from the second company but the data from the first company is shown in the UserControl.  Upon selecting the second company the datasource for the RadGrid exhibited the selected event, the webpage went through the load event but the RadGrid did not go through the ItemDataBound event before the the RadGrid Prerender event happened.  Because the ItemDataBound event did not occur before the RadGrid_PreRender event the new values for the RadGrid were not entered into the session variables. Therefore the session variables held the values from the first company and these were entered into the UserControl on the RadGrid_PreRender event. 

Can you suggest a fix to this?  I've tried to get the values from the GridEditFormItem using the ExtractValues method but this doesn't work with a UserControl.  Is it possible to force the ItemDataBound event before the RadGrid_PreRender event so that the values can be?  In order to diagnose the problem I placed debug.print statements throughout the code.  The sequence of statements is  shown below:

--User clicks command to open webpage

Page_LoadComplete Event

--Page has just opened; only date control shows

--next is triggered by selecting date

Page PreInit on postback

Page_LoadComplete Event

--on postback control showing companies shows up

--next step is to select ala Mobile

Page PreInit on postback

cboActiveCompanies_SelectedIndexChanged event occurs Selected value = 100576

Load Complete

dsGetSinglePortfolioCompanyCashFlowInfo_Selecting event running for inst_id 100576

RadGrid1_ItemDataBound item is not GridEditFormItem

RadGrid1_ItemDataBound item is not GridEditFormItem

RadGrid1_ItemDataBound is GridEditFormItem in EditMode

RadGrid1_ItemDataBound item is not GridEditFormItem

MasterGrid prerender event with Item Count>0 and shouldedit = True

RadGrid PreRender Edit was just set to true - Rebind cmd is next

dsGetSinglePortfolioCompanyCashFlowInfo_Selecting event running for inst_id 100576

RadGrid1_ItemDataBound item is not GridEditFormItem

RadGrid1_ItemDataBound item is not GridEditFormItem

RadGrid1_ItemDataBound is GridEditFormItem in EditMode

RadGrid1_ItemDataBound item is not GridEditFormItem

RadGrid PreRender Edit: Session(Inst_id) set to 100576

RadGrid PreRender Edit: Session(RptDate) set to 12/31/2008 12:00:00 AM

RadGrid PreRender Edit: Session(CompanyNameCurrent) set to a La Mobile, Inc.

---At this point the form shows ala Mobile in the edit form as it should

---The next step is to select select a new company 2Wire

Page PreInit on postback

cboActiveCompanies_SelectedIndexChanged event occurs Selected value = 11880

Page_LoadComplete Event

MasterGrid prerender event with Item Count>0 and shouldedit = True

--This is the point where the RadGrid_ItemDataBound Event should occur but doesn't; any way to force it here?
RadGrid PreRender Edit: Session(Inst_id) set to 100576

RadGrid PreRender Edit: Session(RptDate) set to 12/31/2008 12:00:00 AM

RadGrid PreRender Edit: Session(CompanyNameCurrent) set to a La Mobile, Inc.

RadGrid PreRender Edit was just set to true - Rebind cmd is next

dsGetSinglePortfolioCompanyCashFlowInfo_Selecting event running for inst_id 11880

RadGrid1_ItemDataBound item is not GridEditFormItem

RadGrid1_ItemDataBound item is not GridEditFormItem

UserControl_databinding event

RadGrid1_ItemDataBound is GridEditFormItem in EditMode

RadGrid1_ItemDataBound Updating control for CompanyNameCurrent

RadGrid1_ItemDataBound item is not GridEditFormItem

The following shows the source code for the webpage :

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="CompanyValuationInfo.aspx.vb" Inherits="CompanyValuationInfo" %>  
 
<%@ Register src="AllTab115Instances.ascx" tagname="AllTab115Instances" tagprefix="uc1" %>  
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>  
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title>Company Valuation</title>  
    <script type="text/javascript">  
      
      function pageLoad() {  
      }  
      
    </script>  
    <style type="text/css">  
        .style1  
        {  
            width: 100%;  
        }  
        .style2  
        {  
            width: 349px;  
        }  
        .style3  
        {  
            width: 562px;  
        }  
        .style4  
        {  
            width: 609px;  
        }  
    </style>  
</head>  
<body>  
    <form id="form1" runat="server">  
    <telerik:RadScriptManager ID="ScriptManager1" runat="server"   
        EnableTheming="True">  
    </telerik:RadScriptManager>  
    <div>  
        <asp:SqlDataSource ID="dsActiveCompanies" runat="server"   
            ConnectionString="<%$ ConnectionStrings:ActiveString %>"   
            SelectCommand="stdprc_GetFinanciallyActivePortfolioCompanies"   
            SelectCommandType="StoredProcedure">  
            <SelectParameters>  
                <asp:ControlParameter ControlID="AllTab115Instances1" DefaultValue="1/1/1900"   
                    Name="AsOfDate" PropertyName="DateValue" Type="DateTime" />  
            </SelectParameters>  
        </asp:SqlDataSource>  
    </div>  
    <table class="style1">  
        <tr>  
            <td class="style2">  
                Select Reporting Date</td>  
            <td class="style4">  
                <uc1:AllTab115Instances ID="AllTab115Instances1" runat="server"   
                    NotBeforeDate="1/1/2004" />  
            </td>  
            <td class="style3">  
                <asp:Label ID="lblSelectCompanyToEdit" runat="server"   
                    Text="Select Company To Edit" Visible="False"></asp:Label>  
            </td>  
            <td>  
                <telerik:RadComboBox ID="cboActiveCompanies" Runat="server"   
                    DataSourceID="dsActiveCompanies" DataTextField="CompanyName"   
                    DataValueField="Inst_id" Skin="WebBlue" Visible="False"   
                    AutoPostBack="True">  
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>  
                </telerik:RadComboBox>  
            </td>  
        </tr>  
        </table>  
    <asp:SqlDataSource ID="dsGetSinglePortfolioCompanyCashFlowInfo" runat="server"   
        ConnectionString="<%$ ConnectionStrings:ActiveString %>"   
        SelectCommand="stdprc_GetSinglePortfolioCompanyCashFlowInfo"   
        SelectCommandType="StoredProcedure">  
        <SelectParameters>  
            <asp:ControlParameter ControlID="cboActiveCompanies" Name="Inst_id"   
                PropertyName="SelectedValue" Type="Int32" />  
            <asp:ControlParameter ControlID="AllTab115Instances1" DefaultValue="12/31/1900"   
                Name="RptDate" PropertyName="DateValue" Type="DateTime" />  
        </SelectParameters>  
    </asp:SqlDataSource>  
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"   
        DataSourceID="dsGetSinglePortfolioCompanyCashFlowInfo" GridLines="None"   
        Skin="WebBlue" Visible="False">  
<HeaderContextMenu>  
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>  
</HeaderContextMenu>  
 
<MasterTableView DataSourceID="dsGetSinglePortfolioCompanyCashFlowInfo"   
            datakeynames="Inst_ID,RptDate">  
<RowIndicatorColumn>  
<HeaderStyle Width="20px"></HeaderStyle>  
</RowIndicatorColumn>  
 
<ExpandCollapseColumn>  
<HeaderStyle Width="20px"></HeaderStyle>  
</ExpandCollapseColumn>  
    <Columns>  
        <telerik:GridBoundColumn DataField="Inst_id" DataType="System.Int32"   
            HeaderAbbr="Inst_id" ReadOnly="True" UniqueName="Inst_id">  
        </telerik:GridBoundColumn>  
        <telerik:GridBoundColumn DataField="RptDate" ReadOnly="True"   
            UniqueName="RptDate">  
        </telerik:GridBoundColumn>  
        <telerik:GridBoundColumn DataField="CompanyNameCurrent"   
            UniqueName="CompanyNameCurrent">  
        </telerik:GridBoundColumn>  
    </Columns>  
    <EditFormSettings EditFormType="WebUserControl"   
        UserControlName="CashFlowFields.ascx">  
    </EditFormSettings>  
</MasterTableView>  
 
<FilterMenu>  
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>  
</FilterMenu>  
    </telerik:RadGrid>  
    </form>  
<p>  
    &nbsp;</p>  
</body>  
</html>  
 
This is the aspx.vb code that goes with the web page:
Imports Telerik.Web.UI  
Imports VenRockClassLibrary  
Imports System.Diagnostics  
Partial Class CompanyValuationInfo  
    Inherits System.Web.UI.Page  
 
    Protected Sub Page_LoadComplete(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.LoadComplete  
        System.Diagnostics.Debug.WriteLine("Page_LoadComplete Event")  
    End Sub 
 
    Protected Sub Page_PreInit(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.PreInit  
        Dim Pg As Page = CType(sender, Page)  
        If Pg.IsPostBack Then                   'Always do this as Date combobox has been pressed at least once  
            Me.cboActiveCompanies.Visible = True 
            Me.lblSelectCompanyToEdit.Visible = True 
            System.Diagnostics.Debug.WriteLine("Page PreInit on postback")  
        End If 
    End Sub 
 
    Protected Sub cboActiveCompanies_SelectedIndexChanged(ByVal o As ObjectByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles cboActiveCompanies.SelectedIndexChanged  
        Session("AsOfDate") = Me.AllTab115Instances1.DateValue  
        'after user selects a company then make the company visible  
        RadGrid1.Visible = True 
 
        If cboActiveCompanies.SelectedIndex = -1 Then 
            System.Diagnostics.Debug.WriteLine("cboActiveCompanies_SelectedIndexChanged event occurs Selected index = -1")  
            Session("ShouldEdit") = False 
        Else 
            System.Diagnostics.Debug.WriteLine("cboActiveCompanies_SelectedIndexChanged event occurs Selected value = " & cboActiveCompanies.SelectedValue)  
            Session("ShouldEdit") = True 
        End If 
    End Sub 
 
 
 
    Protected Sub RadGrid1_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound  
 
        If (TypeOf e.Item Is GridEditFormItem) Then 
            If e.Item.IsInEditMode Then 
                System.Diagnostics.Debug.WriteLine("RadGrid1_ItemDataBound is GridEditFormItem in EditMode")  
                Dim ctl As Control, ctl_ID As String 
 
 
                Dim usrCtl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl)  
                'the next code block works because the controls are named after the fields in the stored procedures  
                'For example there is a control named Inst_id to refect the value of the Inst_ID field  
                For Each ctl In usrCtl.Controls  
                    Try 
                        ctl_ID = ctl.ID  
                        If Len(Session(ctl_ID)) > 0 Then 
                            System.Diagnostics.Debug.WriteLine("RadGrid1_ItemDataBound Updating control for " & ctl_ID)  
                            UpdateControlValue(ctl, Session(ctl_ID))  
                        End If 
                    Catch ex As Exception  
                        System.Windows.Forms.MessageBox.Show(ex.ToString)  
                    End Try 
                Next 
            Else 
                System.Diagnostics.Debug.WriteLine("RadGrid1_ItemDataBound is GridEditFormItem in EditMode")  
            End If 
        Else 
            System.Diagnostics.Debug.WriteLine("RadGrid1_ItemDataBound item is not GridEditFormItem")  
        End If 
    End Sub 
    Protected Sub UpdateControlValue(ByVal ctl As Web.UI.Control, ByVal Value As String)  
        'sub will ensure that the controls used to display the value of the various fields  
        'have the old value of the field displayed  
        Select Case True 
            Case TypeOf (ctl) Is RadTextBox  
                Dim nCtl As RadTextBox = CType(ctl, RadTextBox)  
                nCtl.Text = Value  
            Case TypeOf ctl Is RadComboBox  
                Dim nCtl As RadComboBox = CType(ctl, RadComboBox)  
                nCtl.SelectedValue = Value  
            Case TypeOf ctl Is ListBox  
                Dim nCtl As ListBox = CType(ctl, ListBox)  
                VRUtilities.SetMultipleItemsSelection(nCtl, Value)  
        End Select 
 
    End Sub 
 
    Protected Sub RadGrid1_PreRender(ByVal sender As ObjectByVal e As System.EventArgs) Handles RadGrid1.PreRender  
        Dim ShouldEdit As Boolean 
        'set a switch so that the items is only marked if the session variable is set to true  
        'this only happens when the SelectedIndex of cboActiveCompanies > -1  
        'it can also be undone by the cancel button  
        If Session("ShouldEdit") = True Then 
            ShouldEdit = True 
        Else 
            ShouldEdit = False 
        End If 
        'procedure places each value into a session variable which are then used used to populate  
        'the vallues   
        'if it is a postback and an active company has been selected  
        If RadGrid1.MasterTableView.Items.Count > 0 Then 
            If ShouldEdit Then 
                System.Diagnostics.Debug.WriteLine("MasterGrid prerender event with Item Count>0 and shouldedit = True")  
                Dim colCnt As Int16, ColNames As String(), j As Int16, GC As GridColumn, ColName As String 
                Dim TCell As TableCell, sText As String 
 
                Dim RG As RadGrid = CType(sender, RadGrid)  
 
                'RG.MasterTableView.Items(0).Edit = True  
                'System.Diagnostics.Debug.WriteLine("RadGrid PreRender Edit was just set to true - Rebind cmd is next")  
                'RG.Rebind()  
 
                Dim DGI As GridDataItem = RG.MasterTableView.Items(0)  
                'got through all of the columns find the control and save the value to   
                'a session variable  
                colCnt = RG.Columns.Count  
                ReDim ColNames(colCnt - 1)  
 
                For j = 0 To colCnt - 1  
                    GC = RG.Columns(j)          'get the Jth column  
                    ColName = GC.UniqueName     'get the unique name for the column  
                    ColNames(j) = ColName  
                    If ColName <> "EditCommandColumn" Then 
                        TCell = CType(DGI.Item(ColName), TableCell)    'get the tablecell for this column  
                        sText = TCell.Text  
                        sText = Replace(sText, "&nbsp;""")  
                        System.Diagnostics.Debug.WriteLine("RadGrid PreRender Edit: Session(" & ColName & ") set to " & sText)  
                        Session(ColName) = sText       'store the text in the cell as a session variable  
                    End If 
                Next j  
 
                RG.MasterTableView.Items(0).Edit = True 
                System.Diagnostics.Debug.WriteLine("RadGrid PreRender Edit was just set to true - Rebind cmd is next")  
                RG.Rebind()  
            Else 
                System.Diagnostics.Debug.WriteLine("MasterGrid prerender event with Item Count>0 and shouldedit = false")  
            End If 
        Else 
            System.Diagnostics.Debug.WriteLine("RadGrid PreRender with item count 0")  
        End If 
    End Sub 
 
    Protected Sub dsGetSinglePortfolioCompanyCashFlowInfo_Selected(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles dsGetSinglePortfolioCompanyCashFlowInfo.Selected  
        'System.Diagnostics.Debug.WriteLine("dsGetSinglePortfolioCompanyCashFlowInfo_Selected event finished.")  
    End Sub 
 
 
    Protected Sub dsGetSinglePortfolioCompanyCashFlowInfo_Selecting(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles dsGetSinglePortfolioCompanyCashFlowInfo.Selecting  
 
        'Dim SDSV As SqlDataSourceView = CType(sender, SqlDataSourceView)  
        'If SDSV.SelectCommand = "stdprc_GetSinglePortfolioCompanyCashFlowInfo" Then  
        '    Dim parm1 As Parameter = SDSV.SelectParameters.Item(0)  
        '    Dim parm2 As Parameter = SDSV.SelectParameters.Item(1)  
        'End If  
        Dim Cmd As System.Data.Common.DbCommand = CType(e.Command, System.Data.Common.DbCommand)  
        Dim parm1 As System.Data.Common.DbParameter = Cmd.Parameters(0)  
        Dim parm2 As System.Data.Common.DbParameter = Cmd.Parameters(1)  
        System.Diagnostics.Debug.WriteLine("dsGetSinglePortfolioCompanyCashFlowInfo_Selecting event running for inst_id " & parm1.Value)  
    End Sub 
End Class 
 

This is the souce code for the UserControl:
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="CashFlowFields.ascx.vb" Inherits="CashFlowFields" %>  
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>  
<style type="text/css">  
    .style1  
    {  
        width: 100%;  
    }  
</style>  
<table class="style1">  
    <tr>  
        <td>  
            <asp:Button ID="cmdUpdate" runat="server" Text="Update" />  
        </td>  
        <td>  
            <asp:Button ID="cmdCancel" runat="server" Text="Cancel" />  
        </td>  
    </tr>  
    <tr>  
        <td>  
            &nbsp;</td>  
        <td>  
            &nbsp;</td>  
    </tr>  
</table>  
<telerik:RadTextBox ID="CompanyNameCurrent" Runat="server" Height="20px"   
    Skin="WebBlue" Width="311px">  
</telerik:RadTextBox>  
 
This is the aspx.vb code that goes with the UserControl.
Imports VRUtilities  
Imports Telerik.Web.UI  
Partial Class CashFlowFields  
    Inherits System.Web.UI.UserControl  
    Private Shared m_DataItem As Object = Nothing 
    Protected Sub cmdUpdate_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles cmdUpdate.Click  
        Dim btn As Button = CType(sender, Button)  
        Dim usrCtl As UserControl = CType(btn.Parent, ASP.cashflowfields_ascx)  
        Dim ctl As Control, ctl_id As String, PriorVal As String, CurrVal As String 
        For Each ctl In usrCtl.Controls  
            If Not TypeOf ctl Is Button And Not TypeOf ctl Is LiteralControl Then 
                ctl_id = ctl.ID  
                PriorVal = Session(ctl_id)  
                CurrVal = VRUtilities.GetControlsValue(ctl)  
                If CurrVal <> PriorVal Then 
                    MsgBox("New values for " & ctl_id & " change from " & PriorVal & " to " & CurrVal)  
                Else 
                    MsgBox("Same values for " & ctl_id & " as " & PriorVal & " = " & CurrVal)  
                End If 
            End If 
        Next 
    End Sub 
    Protected Sub cmdCancel_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles cmdCancel.Click  
 
        CancelEditView()  
 
 
    End Sub 
    Protected Sub CancelEditView()  
 
        Try 
            Dim RG As Telerik.Web.UI.RadGrid = CType(Me.Page.FindControl("RadGrid1"), Telerik.Web.UI.RadGrid)  
            Dim GTV As Telerik.Web.UI.GridTableView = CType(RG.MasterTableView, Telerik.Web.UI.GridTableView)  
            GTV.ClearEditItems()  
 
            'Dim cBx As RadComboBox = CType(Me.Page.FindControl("cboActiveCompanies"), RadComboBox)  
            'cBx.SelectedIndex = -1  
            Session("ShouldEdit") = False 
            System.Diagnostics.Debug.WriteLine("cmdCancel_Click event has set System(shouldedit) to false")  
        Catch ex As Exception  
            System.Windows.Forms.MessageBox.Show(ex.ToString)  
        End Try 
 
    End Sub 
 
    Public Shared Property DataItem() As Object 
        Get 
            Return m_DataItem  
        End Get 
        Set(ByVal value As Object)  
            m_DataItem = value  
        End Set 
    End Property 
 
    Protected Sub Page_DataBinding(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.DataBinding  
        System.Diagnostics.Debug.WriteLine("UserControl_databinding event ")  
    End Sub 
End Class 
 

So if you're still with me, my problem is how can I populate the usercontrol with the values returned by the datasource for the radgrad. I also need to keep track of the values placed in the usercontrol controls as when the Update command is triggered I only want to update the record if the values were changed.

Thanks,  I'm three days into this and it seems intractable at the moment.
Georgi Krustev
Telerik team
 answered on 22 Apr 2009
1 answer
142 views
(This is not a specific RadGrid issue, but I need to place it somewhere...)

We are having bad performance in some parts of our webapp, based on RadControls and UpdatePanels. It is mainly client rendering that takes time.
I've read lots of post here and elsewhere about turning client-features off etc, but what I would really like to do is to figure out what takes so long on the client. For instance, entering edit mode in a RadGrid with ~20 rows and 10 columns takes 10-15 seconds in IE6/7.
With IE8 and FF3 there are good profilers, but the performance problem is not nearly as bad in these browsers, and we need to target IE6/7. For these versions of IE, I haven't found any good performance tuning tool. I guess I could instrument the ajax .js-files manually, as well ad RadControls .js-files, but that would be really awkward to do, since I don't know where the bottleneck is.

So, my question is: Does anyone have any good recommendation on techniques to tune performance for client-side rendering (especially where UpdatePanels are used)?

Thanks!
/Fredrik
Pavlina
Telerik team
 answered on 22 Apr 2009
1 answer
241 views
I am trying to figure out how to do what I need and seem to find examples for all the various aspects (save one) but can't pull it all together.  Here's what I am trying to do:

  1. Programmatically build my grid with GridTemplateColumns (radio button lists, text boxes and dropdowns).  I've used these as an example: http://www.telerik.com/help/aspnet/grid/grdprogrammaticcreation.html.  I have no issue with creating the template columns - my columns get created.
  2. Default the grid to edit mode at all times.  I used this example: http://www.telerik.com/help/aspnet/grid/grddefaulteditmodeforgriditemsoninitialload.html
  3. The last item, and this is the part I haven't found an example for, is to have a button that is not a part of the grid or its associated ItemCommand that posts back and from that event get the changed items. Is this even possible?  The grid is really part of a larger form that needs to get saved when the save button is clicked.

What we are doing is creating a form/questionnaire for users to fill out that is dynamically built based on metadata from the database, hence everything being done programatically.

The problem I am running into occurs after page is posted back.  When the page posts back, the grid is set to nothing (this is VB) until it gets recreated in code.  After I define the grid structure in the PreInit event the Page Load event fires (I don't rebind at this point, I don't want to overwrite any changed values), but I can't see my edited values.  I thought that the grid would be loaded from view state by the time the page load event is done, but no luck.  Any ideas why I'm not seeing it?  My code is below.

Thanks,

Jeff

Imports Telerik.Web.UI 
 
Partial Public Class _Default 
    Inherits System.Web.UI.Page 
 
    Protected WithEvents rgOne As RadGrid 
 
    Private Sub Page_Init(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Init 
        DefineGridStructure() 
    End Sub 
 
    Private Sub rgOne_NeedDataSource(ByVal sender As ObjectByVal e As GridNeedDataSourceEventArgs) Handles rgOne.NeedDataSource 
 
        rgOne = CType(sender, RadGrid) 
 
        Dim newTable As DataTable = New DataTable() 
 
        Dim dc1 As New DataColumn 
 
        dc1.ColumnName = "ColumnA" 
        dc1.DataType = Type.GetType("System.String"
        newTable.Columns.Add(dc1) 
 
        Dim row1 As DataRow = newTable.NewRow() 
        row1.Item("ColumnA") = "Row 1 Value, Column A" 
 
        Dim row2 As DataRow = newTable.NewRow() 
        row2.Item("ColumnA") = "Row 2 Value, Column A" 
 
        newTable.Rows.Add(row1) 
        newTable.Rows.Add(row2) 
 
        rgOne.DataSource = newTable 
 
    End Sub 
 
    Private Sub DefineGridStructure() 
 
        rgOne = New RadGrid() 
 
        rgOne.AllowMultiRowEdit = True 
        rgOne.AutoGenerateColumns = False 
        rgOne.AutoGenerateEditColumn = False 
        rgOne.MasterTableView.EnableColumnsViewState = True 
        rgOne.EnableViewState = True 
 
        Dim templateBox As New TemplateTextBox("textOne"
        Dim templateColumn As New GridTemplateColumn() 
        templateColumn.EditItemTemplate = templateBox 
        templateColumn.DataField = "ColumnA" 
        templateColumn.HeaderText = "Column A" 
 
        rgOne.Columns.Add(templateColumn) 
 
        ph1.Controls.Add(rgOne) 
 
    End Sub 
 
    Private Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load 
        If Not Page.IsPostBack Then 
            rgOne.Rebind() 
        Else 
            For Each editedItem As GridEditableItem In rgOne.EditItems 
                Dim newValues As New Hashtable() 
                rgOne.MasterTableView.ExtractValuesFromItem(newValues, editedItem) 
            Next 
        End If 
    End Sub 
 
    Private Sub Page_PreRender(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.PreRender 
        For Each dataItem As GridDataItem In rgOne.Items 
            dataItem.Edit = True 
        Next 
        rgOne.Rebind() 
    End Sub 
End Class 
 
Class TemplateTextBox 
    Implements IBindableTemplate 
 
    Private m_CtrlName As String 
 
    Public Sub New(ByVal ctrlName As String
        MyBase.New() 
        m_CtrlName = ctrlName 
    End Sub 
 
    Public Function ExtractValues(ByVal container As System.Web.UI.Control) As System.Collections.Specialized.IOrderedDictionary Implements System.Web.UI.IBindableTemplate.ExtractValues 
        Dim od As New OrderedDictionary 
        Return od 
    End Function 
 
    Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements System.Web.UI.ITemplate.InstantiateIn 
        Dim box As New RadTextBox() 
        box.ID = m_CtrlName 
        container.Controls.Add(box) 
    End Sub 
End Class 
 

Pavlina
Telerik team
 answered on 22 Apr 2009
2 answers
105 views
This issue has happened more than a couple times now. It shows that Telerik did not test their software enough for new releases at all.

The 402 control suite fails on version 3.5, but ok on 3.5 SP1

The 408 control suite fails on version 3.5 and fails 3.5 SP1 under Medium Trust environment.

Please stick to the systems requirements published on your site, and TEST before release!
Beat
Top achievements
Rank 1
 answered on 22 Apr 2009
1 answer
130 views
I may have painted myself into a corner, or, being new to Telerik controls, just don't understand what I'm supposed to be doing.

I've inherited from GridBoundColumn to make my own ClientColumn. My ClientColumn class has a DisplayStyle property which determines how data is rendered in the grid. For example, if DisplayStyle is set to 1, then the column will display the ID of the client. If it's set to 2, it will display the name of the client.

I've got two of these columns in my grid, and each sets the DisplayStyle differently.

When the page initially displays, everything looks great. However, when the user pages to the next set of data, the ColumnCreating event fires. I presume that I am supposed to reinstantiate the columns, placing them in e.Column. However, the event doesn't appear to tell me which column I'm supposed to create. It only tells me the type (via the e.ColumnType property). I suppose I could make an assumption that ColumnCreating gets called in the order in which the columns appear, and count calls to ColumnCreating, but that feels extremely kludgey.

Is there a better way to handle this?
Tsvetoslav
Telerik team
 answered on 22 Apr 2009
4 answers
268 views
I have a 3 level hierarchy level grid which I use rad window popup for edit and insert. I need to send the parent ID of a detail row on insert. For example, I have the parent as provider, and the child as service. When inserting a new service, I need to send it's parent provider ID that it is being inserted under. I have the pop up set up correctly in the itemcreated function here:
 protected void providersGrid_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
 
        if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "Master"
        { 
              
                try 
                { 
                    int providerID = Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["provider_id"]); 
                    ImageButton editLink = (ImageButton)e.Item.FindControl("EditProviderLink"); 
                    if (Session["readonly"].ToString() == "Y"
                    { 
                        editLink.ImageUrl = "Images/viewSpelled.gif"
                        editLink.ToolTip = "View"
 
                    }                      
                    editLink.Attributes["href"] = "#"
                    editLink.Attributes["onclick"] = string.Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["provider_id"], e.Item.ItemIndex); 
                 
 
                } 
                catch (Exception e1) 
                { 
                } 
                try 
                { 
 
                    ImageButton editLink = (ImageButton)e.Item.FindControl("DeleteProviderLink"); 
                    if (Session["readonly"].ToString() == "Y"
                        editLink.Visible = false
                    else 
                    { 
                        editLink.Attributes["href"] = "#"
                        editLink.Attributes["onclick"] = string.Format("return ShowDeleteForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["provider_id"], e.Item.ItemIndex); 
                    } 
 
                } 
                catch (Exception e1) 
                { 
                } 
              
        } 
        if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "ServiceTableView"
        { 
              
                try 
                { 
 
                    ImageButton editLink = (ImageButton)e.Item.FindControl("EditServiceLink"); 
                   if (Session["readonly"].ToString() == "Y"
                    { 
                        editLink.ImageUrl="Images/viewSpelled.gif"
                        editLink.ToolTip="View"
           
                    } 
                    editLink.Attributes["href"] = "#"
                    int id =Convert.ToInt16( e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["service_id"]); 
 
                    editLink.Attributes["onclick"] = string.Format("return ShowEditServiceForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["service_id"], e.Item.ItemIndex); 
                } 
                catch (Exception e1) 
                { 
                } 
                try 
                { 
 
                    ImageButton editLink = (ImageButton)e.Item.FindControl("DeleteServiceLink"); 
                    if (Session["readonly"].ToString() == "Y"
                        editLink.Visible = false
                    else 
                    { 
                        editLink.Attributes["href"] = "#"
                        editLink.Attributes["onclick"] = string.Format("return ShowDeleteServiceForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["service_id"], e.Item.ItemIndex); 
                    } 
 
                } 
                catch (Exception e1) 
                { 
                } 
              
        } 
 
        if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "FeedTableView"
        { 
              
                try 
                { 
 
                    ImageButton editLink = (ImageButton)e.Item.FindControl("EditFeedLink"); 
                    if (Session["readonly"].ToString() == "Y"
                    { 
                        editLink.ImageUrl = "Images/viewSpelled.gif"
                        editLink.ToolTip = "View"
                    } 
                    editLink.Attributes["href"] = "#"
                    editLink.Attributes["onclick"] = string.Format("return ShowEditFeedForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["feed_id"], e.Item.ItemIndex); 
                 } 
                catch (Exception e1) 
                { 
                } 
                try 
                { 
 
                    ImageButton editLink = (ImageButton)e.Item.FindControl("DeleteFeedLink"); 
                    if (Session["readonly"].ToString() == "Y"
                        editLink.Visible = false
                    else 
                    { 
                        editLink.Attributes["href"] = "#"
                        editLink.Attributes["onclick"] = string.Format("return ShowDeleteFeedForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["feed_id"], e.Item.ItemIndex); 
                    } 
                } 
                catch (Exception e1) 
                { 
                } 
            } 
          
         
    } 

And I call the pop up from here but the ID is not set correctly ( will show how i set it and why it is wrong after this code:
function ShowInsertServiceForm() { 
             // get username from querystring to pass to next window 
             var urlArgs = cbeGetURLArguments(); 
             var userName = urlArgs.NAME; 
             var sync = urlArgs.SYNC; 
 
             var providerIDTxtBx = document.getElementById("currentProviderID"); 
             var pID = providerIDTxtBx.value; 
 
             var oWnd = window.radopen("editServiceForm.aspx?SYNC=" + sync + "&NAME=" + userName + "&pID=" + pID, "providerDialog"); 
 
             //set a function to be called when RadWindow is closed 
             oWnd.add_close(OnClientServiceClose); 
             var oArg = new Object(); 
 
             oArg.serviceID = -99; 
 
             //set the arguments that will be needed on the way back so they are not undefined 
             oWnd.argument = oArg; 
             return false
         } 
I set the ID (currentProviderID) in a textbox when the provider is expanded. I set it in the itemcommand onhierarchyexpanded, but it is not right, since the user can expand a number of different providers, and not insert a new service in the LAST exanded provider. So my question is, where do I capture the providerID (or serviceID for a feed - 3rd level down) before calling the radopen so that I can send the providerID in the querystring?

Thanks,
Laura

Tsvetoslav
Telerik team
 answered on 22 Apr 2009
4 answers
192 views
Hi,

I use a RadDatePicker and a RadCalendar. Is it possible to display an invalid message "Your datetime is invalid..." when the date is invalid ? The date can be empty. The user cannot go to the next page if the date is invalid. Is it easy to do it ?

Thank you in advance,

Suzi.

Suzi
Top achievements
Rank 1
 answered on 22 Apr 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?