Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
111 views
I hav a rad grid having some n columns.
If i try to print the grid after grouping a particular column its not working..
Can i know the solution for this??
vijay
Top achievements
Rank 1
 answered on 04 Nov 2010
3 answers
143 views
Hello

I am using two GridDateTimeColumns with Time PickerControl, I am trying to add a compare validator to one of the controls to compare the time against another control however adding the compare validator to the griddatetimecolumn throws Object Reference not set to an instance of an object exception. Below is the code I am using

Protected Sub RadGridTransCalc_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGridTransCalc.ItemCreated  
 
            If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then  
                Dim item As GridEditableItem = CType(e.Item, GridEditableItem)  
                Dim editor As GridDateTimeColumnEditor = CType(item.EditManager.GetColumnEditor("END_TIME"), GridDateTimeColumnEditor)  
                Dim cell As TableCell = CType(editor.PickerControl.Parent, TableCell)  
                Dim validator As CompareValidator = New CompareValidator  
                editor.TextBoxControl.ID = "ID_for_validation" 
                validator.ControlToValidate = editor.PickerControl.ID  
                validator.ControlToCompare = "START_TIME" 
                validator.Operator = "GreaterThan" 
                validator.Type = ValidationDataType.Date  
                validator.ErrorMessage = "End time must be greater than start time" 
                cell.Controls.Add(validator)  
            End If  
 
End Sub 

 

On debugging I found that the following line is throwing the exception

 

Dim cell As TableCell = CType(editor.PickerControl.Parent, TableCell)  

does anyone had a similar issue ?? If so how did you solve it, Help!!!!!

Thanks,
Kevin
Chris
Top achievements
Rank 1
 answered on 03 Nov 2010
3 answers
138 views

I have a following code in my radgrid:

<CommandItemTemplate>
    <asp:LinkButton ID="ExportToPdfButton" runat="server" CommandName="ExportToPdf" CssClass="pdfButton" ></asp:LinkButton>
</CommandItemTemplate>

The radgrid is ajaxafied with a RadAjaxManager.

Use ItemCreated in I call RegisterPostBackControl so that when I click the PDF button it doesn't use ajax and pops up my PDF.

Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated
        If TypeOf e.Item Is GridCommandItem Then
            Dim btn As LinkButton = e.Item.FindControl("ExportToPdfButton")
            If Not btn Is Nothing Then
                RadScriptManager.GetCurrent(Page).RegisterPostBackControl(btn)
            End If
        End If
End Sub

This works fine the first time my page loads. I click the PDF, it opens up... all good. 
However, I have a series of combo boxes that are wired in the RadAjaxManager to rebind the grid when changed. When the radgrid gets changed through an ajax postback, and I click the PDF button, it then causes an ajax postback and the commanditem template disappears entirely, and of course.. the PDF is not created.

Any idea how I can make sure the PDF button always does a regular postback?
Greg
Top achievements
Rank 1
 answered on 03 Nov 2010
5 answers
215 views
Hi, after implementing URlrewrite, the telerik ajaxmanager not seems to responding.

got following error
Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 3.5.30428; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Tue, 23 Feb 2010 00:51:29 UTC


Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '
<!DOCTYPE html PUB'.
Line: 6
Char: 62099
Code: 0
URI: http://dev10nz.oslweb.co.nz/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a0d787d5c-3903-4814-ad72-296cea810318%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2009.3.1210.35%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3a21436984-11a2-4f37-85de-ba7b6084d96e%3a16e4e7cd%3a874f8ea2%3af7645509%3a24ee1bba%3a19620875%3a39040b5c%3ab7778d6c%3a1e771326%3aa7e79140%3aed16cbdc%3a3f6e8f3f%3ae330518b%3ac8618e41%3aaa288e2d


Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '
<!DOCTYPE html PUB'.
Line: 6
Char: 62099
Code: 0
URI: http://dev10nz.oslweb.co.nz/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a0d787d5c-3903-4814-ad72-296cea810318%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2009.3.1210.35%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3a21436984-11a2-4f37-85de-ba7b6084d96e%3a16e4e7cd%3a874f8ea2%3af7645509%3a24ee1bba%3a19620875%3a39040b5c%3ab7778d6c%3a1e771326%3aa7e79140%3aed16cbdc%3a3f6e8f3f%3ae330518b%3ac8618e41%3aaa288e2d

James Shelton Agar
Top achievements
Rank 2
 answered on 03 Nov 2010
1 answer
68 views
Hi all!

I'm a new guy and on the way to use RadGrid. Here is my problem

+ I created a RadGrid and used NeedDataSource Event to load the data.
+ It's good at this time. But I wonder when I click on the next button on paging, it refreshes all the page instead of only the RadGrid.

Thanks!

Andy.
Daniel
Telerik team
 answered on 03 Nov 2010
3 answers
142 views
Hi

I have a page set up as below. All methods are correctly wired to the grid in the .aspx page. as shown here

<telerik:RadGrid ID="FilesGrid" runat="server" AllowPaging="True"
                AllowSorting="True" AutoGenerateColumns="False" GridLines="None"
                onpageindexchanged="FilesGrid_PageIndexChanged"
                onsortcommand="FilesGrid_SortCommand" Skin="Outlook"
                style="font-style: italic"
                onitemdatabound="FilesGrid_ItemDataBound">
                <MasterTableView AllowNaturalSort="false">
                </MasterTableView>
        </telerik:RadGrid>

However I am getting very inconsistent behaviour. I am not sure if it is something silly I am doing or is a result of using a nhibernate dataset.
For most fields field that map directly to a read/write nhibernate property it all works ok. However some columns need to click twice to sort them. Then I have what is a calculated nhinernate property of type sting - this sorts but will only sort one way??
Then when I try to use the standard navigator to page, it will go to page 2 but gets stuck there.

Any ideas? Also how - if possible - would I use a linked nhibernate property to sort.ie Status.StatusDescription? If not possible could I implement custom sorting? But how to keep the sorted columns highlighted even when underlying field being sorted is different?

Any pointers as always gratefully appreciated. Really at end of my tether and this is slowing the project right down, if can't fix it will have to find another solution

Thanks in advance
Kieran

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NHibernate.Cfg;
using Telerik.Web.UI;
using NHibernate;

public partial class Files : BasePageMinor
{
    private string Sorting = string.Empty;
    private string Sortdir = string.Empty;


    protected void Page_Init(object sender, EventArgs e)
    {
        State.UseState = true;

        Master.SetPage();

    }


    protected void Page_Load(object sender, EventArgs e)
    {
        SetUpGrid();

    }

 
    private void SetUpGrid()
    {
        FilesGrid.MasterTableView.Columns.Clear();

        FilesGrid.MasterTableView.DataKeyNames = new string[] { "FileId", "FileRef" };

        GridBoundColumn _col;

        string sortField = State.FileOrderField??string.Empty;
        string sortDir = State.FileOrderDir ?? "asc";


        GridButtonColumn _imagecol = new GridButtonColumn();
        FilesGrid.MasterTableView.Columns.Add(_imagecol);
        _imagecol.UniqueName = "fileimagestatus";
        _imagecol.ButtonType = GridButtonColumnType.ImageButton;
        _imagecol.Resizable = false;
        _imagecol.ItemStyle.Width = 10;

        _col = new GridBoundColumn();
        FilesGrid.MasterTableView.Columns.Add(_col);
        _col.DataField = "BorrowStatusString";
        _col.UniqueName = "BorrowStatusString";
        _col.DataType = Type.GetType("System.String");
        _col.Display = false;

        

        foreach (FieldDisplay fd in new FileDisplay(s.GetParams()))
        {
            if (!(fd.Display == FieldShow.Show))
                continue;


            if (sortField == string.Empty)
                sortField = fd.nHibernateMapping;

            _col = new GridBoundColumn();
            FilesGrid.MasterTableView.Columns.Add(_col);
            _col.HeaderText = fd.HeaderDisplay;
            _col.DataField = fd.nHibernateMapping;
            _col.UniqueName = fd.nHibernateMapping;
            _col.DataType = Type.GetType(fd.DataType);
            _col.AllowSorting = true;
            if (fd.DataType.Equals("System.DateTime"))
                _col.DataFormatString = "{0:dd/MM/yyyy}";
            

        }
    if (!IsPostBack)
        SortGird(sortField, sortDir);
    }


    private void SortGird(string expression, string direction)
    {
        GridSortExpression sort = new GridSortExpression();
        sort.FieldName = expression;
        sort.SortOrder = (direction == string.Empty || direction == "asc") ? GridSortOrder.Ascending
            : GridSortOrder.Descending;
        FilesGrid.MasterTableView.SortExpressions.Add(sort);
        State.FileOrderDir = direction == string.Empty ? "asc" : direction;
        State.FileOrderField = expression;
    }

    

    protected void FilesGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        if (State.SearchGroup == QuickSearchGroup.loan)
            FilesGrid.DataSource = s.GetFilesLoans(State);
        else
            FilesGrid.DataSource = s.GetFiles(State);

    }
    protected void FilesGrid_PageIndexChanged(object source, GridPageChangedEventArgs e)
    {
        FilesGrid.CurrentPageIndex = e.NewPageIndex;
    }


    protected void FilesGrid_SortCommand(object source, GridSortCommandEventArgs e)
    {
        State.FileOrderDir = e.NewSortOrder == GridSortOrder.Descending ? "desc" : "asc";
        State.FileOrderField = e.SortExpression;

        if (!e.Item.OwnerTableView.SortExpressions.ContainsExpression(e.SortExpression))
        {
            GridSortExpression sortExpr = new GridSortExpression();
            sortExpr.FieldName = e.SortExpression;// StandardFields.GetnHibernatePropertyName(e.SortExpression);
            sortExpr.SortOrder = e.NewSortOrder;

            e.Item.OwnerTableView.SortExpressions.AddSortExpression(sortExpr);
        }


    }

    protected void FilesGrid_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem dataItem = e.Item as GridDataItem;
            object status = dataItem["BorrowStatusString"].Text;
            (dataItem["fileimagestatus"].Controls[0] as ImageButton).ImageUrl = string.Format("~/images/Borrow{0}.bmp", status);
        }

    }
}
Kieran
Top achievements
Rank 1
 answered on 03 Nov 2010
2 answers
123 views
I'm working on a project where I set the visible property on certain listboxitems to false using set_visible(false).  It works great, but if the user uses the up and down arrow to select a listboxitem, the control selects the "hidden" listboxitem which makes it appear that the up/down arrow selection is malfunctioning.

Is there a way to override this?

I propose that the up/down arrow functionality be changed to only select the next visible listboxitem.

Thanks!
Jon Shipman
Top achievements
Rank 1
 answered on 03 Nov 2010
4 answers
392 views
Hi,

Is there a possibility to filter a RadListBox Client side?
We would like to add a textbox above the ListBox which filters the listbox when you type something in the textbox.

Greetings Datamex.
Jon Shipman
Top achievements
Rank 1
 answered on 03 Nov 2010
3 answers
99 views
Hello,

We have discovered what appears to be a bug when using the MakeUrlsAbsolute=true content fitler.

If you go to your demo page in IE8:

I tried on demos.telerik.com, and it removed the first javascript if I set MakeUrlsAbsolute =true.  It appears that it is stripping out Javascript entirely.

http://demos.telerik.com/aspnet-ajax/editor/examples/builtincontentfilters/defaultcs.aspx

set ONLY the follow 3 properties =true:

EncodeScripts=true

MakeUrlsAbsolute=true

ConvertToXhtml=true

Click Set Built-In_Filters button, then paste the following js in the body.

<script type="text/javascript">
function OnClientLoad(editor, args)
{
   editor.get_filtersManager().add(new MyFilter());
}
</script>
  
SOME RANDOM TEXT (NON-JS)
  
 <script type="text/javascript">
function OnClientLoad(editor, args)
{
   editor.get_filtersManager().add(new MyFilter());
}
</script>
 

Rumen
Telerik team
 answered on 03 Nov 2010
3 answers
140 views
Hi, 
I am trying to use the ResourceHeaderTemplate to add additional functionality to my RadScheduler, but am faced with an issue.  I can't find a "ResourceHeaderClick" event.  Is there such a thing?  If not, is there an alternative way to accomplish what I'm trying to do? 

If you take a look at the attached image you'll see that I have placed two CheckBoxes and a TextBox in the ResourceHeaders.  What I would like to do is detect CheckChanged and TextChanged events of said controls, with access to the accompanying appointment to which they are resources.

Thanks,
-ChrisC.
ChrisC.
Top achievements
Rank 2
 answered on 03 Nov 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?