Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
385 views
Hi,

I have a RadGrid and i want to show aggregate 'Sum' for one particular column in the footer. This RadGrid's data source is a data table which pulls data from an excel file. Below is my aspx codes for the RadGrid.

<telerik:RadGrid ID="gvTestResult" runat="server" AllowSorting="true" 
            ShowFooter="true"> 
        <MasterTableView AutoGenerateColumns="false" EnableNoRecordsTemplate="true" >
                <Columns>
                    <telerik:GridBoundColumn DataField="SPEED" HeaderText="SPEED">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="DEMAND" HeaderText="DEMAND">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="AFTER_UTS" HeaderText="AFTER_UTS" Aggregate="Sum">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>























 It gives me Sum is not supported for type "System.Object"'  (refer to SumError.jpg)  at my gvTestResult.DataBind() step.

I also tried to replace GridBoundColumn to GridNumericColumn and it gives me 'Specified cast is not valid' error(refer to InvalidCast.jpg).

Any advice?

										
Pavlina
Telerik team
 answered on 08 Dec 2010
1 answer
93 views
If we add a file with forbidden extension and next try to upload , the validator signals that the action is denied. However, when we delete this file, the error message keeps appearing. Supposingly, user adds now file with correct extension but he will still get the info about wrong extension (until click on upload button that fires validation). This can be a bit confusing for users. What we would like to do is to plug additional (only client-side) validation whenever users deletes a file - we could now check if the problematic file is still selected and if not - hide the error message. The problem is - we have no onclientdeleted event defined in radupload. There is onclientdeleting (during that event we see all selected files including the one being deleted), but how we can determine whether that row (that file) is actually being deleted? 
Genady Sergeev
Telerik team
 answered on 08 Dec 2010
3 answers
108 views
Hello,

We're using Telerik rich text control for Sharepoint, version 5.7.3.0.

We've created a custom CSS class to style the bullets of a unordered list. This class is to be applied on the UL tag.
To use this class, the customer uses the following steps:
  1. Type or copy/paste the list of items
  2. Select all and click on the unordered list button
  3. Select the UL tag in the hierarchy (below the editor)
  4. Apply the custom class
We've noticed that the 3rd step doesn't work in IE7 or IE8 when there is only one item in the list. Clicking on the UL link doesn't change the selection, which stays on the LI element. And since the UL tag cannot be selected, the custom class cannot be applied to it.
I've attached a picture showing the editor after I've clicked on the UL link. As you can see in the hierarchy, the LI tag is still selected.

The workaround we've found is to created second list item to be able to apply the class on the UL, and to remove it afterward. Although it's working fine, it is quite annoying, and the customer wants a content creation procedure as dummy-proof as possible.

An easy fix would be appreciated. Also, let me know if the problem has been fixed in a newer version.

Kind regards,
Xavier Stévenne
Rumen
Telerik team
 answered on 08 Dec 2010
3 answers
163 views
Hi all,

I have reviewed custom command help and I understand how to create a simple custom command -- e.g. something that would display an alert when the custom command is clicked.

I would like to extend this to running non-javascript code. I have some C# which toggles a Microsoft Chart Control's legend and resizes the graph accordingly. I would like to have this be a custom command.

Do I need to use regular AJAX for this? My basic thought process is this:

- Assign a new Command to my Dock named ToggleLegend:
<Commands>
  <telerik:DockCommand
    Text="Toggle Legend"
    OnClientCommand="ToggleLegend" />
</Commands>

- Create the corresponding JavaScript:
<script type="text/javascript">
        function ToggleLegend(dock, args) {
MyAjaxedClassHere.ToggleLegend(ToggleLegend_CallBack);
}
 </script>

- Over in my C# Class:
[Ajax.AjaxMethod()]
private void ToggleLegend()
{
    //Code Here
}

I haven't tested this and I suspect it is an incorrect way of achieving my desired goal. Could someone confirm that this is the correct way of achieving this while using RAD Controls, or is there a nicer way?

Regards,

Sean Anderson
Pero
Telerik team
 answered on 08 Dec 2010
3 answers
186 views
Hi,

I need the ComboBox to show the first item in the list when clicked, rather than automatically scrolling down to the first selected item.

How do I do this?

Thanks,

Rob
Robert
Top achievements
Rank 1
 answered on 08 Dec 2010
8 answers
116 views
I have a radgrid with several pages, and on each page there are hyperlinked row values that navigate the user away from the grid to another page (like Google).  What I would like to do is persist the last page viewed so that when the user clicks the back button, I return to the last page viewed and not the first page.  Here's a sample page.

<%@ Page Language="vb" AutoEventWireup="false" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<script runat="server">
 
    Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
        Dim table As New System.Data.DataTable
        Dim i As Integer
        table.Columns.Add("ContactID")
        table.Columns.Add("FirstName")
        table.Columns.Add("LastName")
        table.Columns.Add("ContactType")
        table.Columns.Add("PostedDate")
        table.Columns.Add("Replied")
 
        For i = 1 To 50
            table.Rows.Add(i, i, i, i, DateTime.Now, i)
        Next
        RadGrid1.DataSource = table
         
    End Sub
     
    Protected Sub RadGrid1_PageIndexChanged(ByVal source As Object, ByVal e As Telerik.Web.UI.GridPageChangedEventArgs)
        RadScriptManager1.AddHistoryPoint("p", e.NewPageIndex)
    End Sub
 
    Protected Sub ScriptManager_Navigate(ByVal sender As Object, ByVal e As System.Web.UI.HistoryEventArgs) Handles RadScriptManager1.Navigate
        If e.State.Count <= 0 Then
            ' Default state
            RadGrid1.CurrentPageIndex = 0
        Else
            Dim key As String = e.State.AllKeys(0)
            If key = "p" Then
                Dim state As String = e.State(key)
                RadGrid1.CurrentPageIndex = CInt(state)
                RadGrid1.Rebind()
            End If
        End If
    End Sub
 
 
</script>
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
 
    <telerik:RadAjaxManager ID="RadAjaxManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1" EnableAJAX="true"
        runat="server">
        <AjaxSettings>
    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
             <UpdatedControls>  
                   <telerik:AjaxUpdatedControl ControlID="RadGrid1" />  
             </UpdatedControls>  
    </telerik:AjaxSetting>  
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
    </telerik:RadAjaxLoadingPanel>
 
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" GridLines="None"
        AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True"
        AllowMultiRowSelection="true" PageSize="25" PagerStyle-Mode="NextPrevAndNumeric" EnableViewState="true">
        <PagerStyle AlwaysVisible="True" Position="TopAndBottom" />
        <ClientSettings>
            <Selecting AllowRowSelect="true" />
        </ClientSettings>
        <GroupingSettings CaseSensitive="false" />
        <MasterTableView DataKeyNames="ContactID,Replied">
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <HeaderStyle Font-Bold="true" />
            <Columns>
                <telerik:GridBoundColumn DataField="ContactID" HeaderText="ContactID" Visible="false"
                    UniqueName="ContactID">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" UniqueName="FirstName"
                    Visible="true">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn HeaderText="LastName" UniqueName="TemplateColumn">
                    <ItemTemplate>
                        <a href='http://www.google.com'>
                            <%#Eval("LastName")%></a>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="ContactType" HeaderText="Contact Type" Visible="true"
                    UniqueName="ContactType" AllowFiltering="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="PostedDate" HeaderText="Posted Date" Visible="true"
                    UniqueName="PostedDate" AllowFiltering="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Replied" HeaderText="Replied" Visible="true"
                    UniqueName="Replied">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn HeaderText="Delete" UniqueName="Delete" AllowFiltering="false">
                    <ItemTemplate>
                        <asp:ImageButton ID="btnDelete" runat="server" ImageUrl="~/Images/deletes.gif" ToolTip="Delete"
                            CommandName="Deletes" Style="cursor: hand" />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Reply/View" UniqueName="View" AllowFiltering="false">
                    <ItemTemplate>
                        <asp:ImageButton ID="btnView" runat="server" ImageUrl="~/Images/views.gif" ToolTip="Reply/View"
                            CommandName="Reply" Style="cursor: hand" />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </telerik:GridTemplateColumn>
                <telerik:GridClientSelectColumn ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"
                    UniqueName="Chk_DeleteAll">
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" />
                </telerik:GridClientSelectColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    </form>
</body>
</html>

I've tried turning viewstate off on the grid but that doesn't seem to change the behavior.  Rebinding in the Navigate event doesn't update the grid (because it's ajaxed).  Maybe I'm overlooking something pretty simple and I'm open to alternative means of accomplishing the same behavior.  If anyone has some suggestions, I'm grateful.  Thanks.
Sebastian
Telerik team
 answered on 08 Dec 2010
5 answers
361 views
Hi,

I try to use a Radmenu inside a RadGrid's GridTemplateColumn.
The Result is shown on the attached Picture.
The Menuitems should do a Postback and depending on the selected Menuitem do some Action for the cuttent Row.

Unfortunately I have no idea on how to this.
Can anyone give me a hint, or maybe a better solution to implement this scenario.

Thank you

Thomas

Here is my current code snippet:

<telerik:RadAjaxManager ID="raManager" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="rgOrganisationAnsprechperson">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rgOrganisationAnsprechperson" LoadingPanelID="ralpLoading" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
  
<telerik:RadAjaxLoadingPanel id="ralpLoading" runat="server" Skin="WebBlue" ></telerik:RadAjaxLoadingPanel>   
<telerik:RadGrid ID="rgOrganisationAnsprechperson" 
    DataSourceID="odsOrganisationAnsprechperson" runat="server" PageSize="20" 
    AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="True" ShowGroupPanel="False"
    AutoGenerateColumns="false" GridLines="none" 
    onprerender="rgOrganisationAnsprechperson_PreRender" >
    <PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
    <MasterTableView Width="100%">
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <SelectFields>
                    <telerik:GridGroupByField FieldAlias="Organisation" FieldName="Organisationsname" FormatString="{0:D}"
                        ></telerik:GridGroupByField>
                </SelectFields>
                <GroupByFields>
                    <telerik:GridGroupByField FieldName="co_id" SortOrder="Descending"></telerik:GridGroupByField>
                </GroupByFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
        <Columns>
            <telerik:GridTemplateColumn>
                <ItemTemplate>
                    <telerik:RadMenu ID="RadMenu1" runat="server" EnableRoundedCorners="true" EnableShadows="true" ExpandAnimation-Type="None" CollapseAnimation-Type="None" ExpandDelay="0" CollapseDelay="0">
                        <Items>
                            <telerik:RadMenuItem Text="Edit" Selected="false">
                                <GroupSettings ExpandDirection="Right"/>
                                <Items>
                                    <telerik:RadMenuItem Text="Personen Daten">
                                    </telerik:RadMenuItem>
                                    <telerik:RadMenuItem Text="Einstellungen">
                                    </telerik:RadMenuItem>
                                    <telerik:RadMenuItem Text="Zugangsdaten">
                                    </telerik:RadMenuItem>
                                    <telerik:RadMenuItem Text="arbeitet nicht mehr bei Firma">
                                    </telerik:RadMenuItem>
                                </Items>
                            </telerik:RadMenuItem>
                        </Items>
                    </telerik:RadMenu>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridBoundColumn DataField="Name" HeaderText="Name" ></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Position" HeaderText="Position" ></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Admin" HeaderText="Admin" ></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Anzeigen" HeaderText="Anzeigen" ></telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
      
    <ClientSettings AllowGroupExpandCollapse="True" >
    </ClientSettings>
</telerik:RadGrid>
waruni
Top achievements
Rank 1
 answered on 08 Dec 2010
28 answers
1.3K+ views
Hello,  I need guidance as to how to improve client side performance when using a lot of rad controls on one page.  I am creating an application that will be used by several hundred police officers in a county with a population of 380k so as you can see it needs to be very reliable and fast.

One major requirement for this application is that it should have all of the fields on one page without the need to navigate between pages to enter the information needed.  This is mainly due to the fact that many police officers may have several weeks to 2 months in between using the application so it has to be easy to use and navigate.

Subsequently, there are 2 RadMenu's, 38 RadTextBox's, 12 RadMaskedTextBox's, 2 RadDateInput's, 16 RadComboBox's, 5 RadGrid's, 2 RadEditor's, 3 RadWindow's, and 1 RadAjaxManager currently on one page.  There may be a few more controls added but that should be 95% of the fields.

I enabled tracing and the server side complets in 1 second exactly every time.  The problem is at the client side.  Once the page loads into the browser there is a long pause and I'm assuming it's some sort of Telerik initialization javascript code running.  During this pause the mask shows in the RadMaskedTexBox's and the page will not respond to events...as soon as the pause is over the masks disappear (as I have HideOnBlur set to true) and then the page will respond to clicks and you can begin using the form.  The pause lasts around 6 to 8 seconds on my computer, however, it's a very fast computer and I'm afraid slower PC's will be even worse.

Is there any general guidance you can give me to reduce this client-side pause?  Thank you.
Svetlina Anati
Telerik team
 answered on 08 Dec 2010
4 answers
288 views
Hi,

I populate the RadDateTimePicker with a default date on the server side.

The control is rendered and the user can modify the date, but should be able to restore the control to its default value.

I couldn't find a client side function which covers this. I have tried to use the defaultValue of the HTML textbox element which I can get via
- $find(dtp.ClientID).get_textBox() -
but the value is stored in the wrong format to do a Date.parse(datetime_string) and I don't want to spend lots of time on this issue.

What would be the suggested way?

Thanks.

Kind regards,
Christoph
Christoph
Top achievements
Rank 1
 answered on 08 Dec 2010
5 answers
311 views
Hi Telerik Guys !

Im using RAD FILE EXPPLORER Control in one of my project.

I have implemented the ARCHIVE BUTTON in the tree context menu of the RAD FILE EXPLORER.

When I clicked on to the  "ARCHIVED" button, the FOLDER from the TREE CONTEXT MENU gets archived in the database but the folder does not gets deleted form the TREENODE. 

I can only delete/archive that folder when I refresh my entire webpage.

Please help how to delete/archive(not to show) that folder with in the TREE CONTEXT MENU in RADFILE EXPLORER.

Please help

Ajay 
Fiko
Telerik team
 answered on 08 Dec 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?