Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
152 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
133 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
403 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
105 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
149 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
3 answers
266 views

Hi,
I am trying to use a RadTooltip with a RadDatePicker as shown below.
However, the tooltop never seems to pop up. I use vitually teh same markup for the
tooltip on other controls on the page and it seems to work fine. Is there something special I
need to do with the RadDatePicker?
Thansk ... Ed

<
telerik:RadDatePicker ID="txtCompletionDate" runat="server" Skin="Windows7" 
    Calendar-Skin="Vista" DateInput-DisplayDateFormat="MM/dd/yyyy" 
    Culture="English (United States)" 
    Calendar-ShowOtherMonthsDays="False" Calendar-ShowRowHeaders="False" Width="110">
    <DateInput DisplayDateFormat="MM/dd/yyyy"  CausesValidation="True" 
        style="text-align:right" ButtonsPosition="Right" DateFormat="MM/dd/yyyy" Skin="Vista"
        >
    </DateInput>
    <Calendar Skin="Windows7" UseColumnHeadersAsSelectors="False" 
        UseRowHeadersAsSelectors="False" ViewSelectorText="x">
        <SpecialDays>  
            <telerik:RadCalendarDay Repeatable="Today">  
                <ItemStyle BackColor="#FFFFCC" />  
            </telerik:RadCalendarDay>  
        </SpecialDays>  
    </Calendar>
    <DatePopupButton HoverImageUrl="" ImageUrl="" />
</telerik:RadDatePicker>
<telerik:RadToolTip ID="RadToolTipCompletionDate" runat="server" TargetControlID="txtCompletionDate" 
    Title="Admin"
    Text="Actual date of delivery in production from IT & BI."
    Skin="Windows7" AutoCloseDelay="20000"
/>
<asp:CompareValidator ID="cvCompletionDate"
    runat="server" ErrorMessage="Must be a valid date" Type="Date" 
    SetFocusOnError="True" Operator="DataTypeCheck" 
    ControlToValidate="txtCompletionDate" Display="Dynamic">
</asp:CompareValidator>
Ed Staffin
Top achievements
Rank 1
 answered on 03 Nov 2010
1 answer
119 views
How do i round the corners on a rad ajax panel?
Dimo
Telerik team
 answered on 03 Nov 2010
2 answers
96 views
Attached is a screen shot where the left is IE8 and the right is what it looks like in other major browsers (chrome, FF, etc).

How can I get this combo box to render correctly in IE?

Thanks,
--Jeff
Kalina
Telerik team
 answered on 03 Nov 2010
3 answers
158 views
Hi
i have 3 submit button on the page. all of them works on IE8. there is no problem.
but not working on Firefox.
one of them works. other 2 button not working
i have 3 different ajax panel.
all of them has a login controls.
pls help.
thanks
Jasenko
Top achievements
Rank 1
 answered on 03 Nov 2010
12 answers
277 views
Hello,
I have an MVC view where I want the functionality of presenting a dialog to upload a file. I was thinking about using a hidden RadAsyncUpload control, and customizing the UI. For example, i have a link with text '[Upload File'], and clicking this pops open the dialog, and I show the selected file path inside a div.
Is this possible? What relevant client-side methods would i need, e.g. to open the dialog?
Thanks!
Pete
Genady Sergeev
Telerik team
 answered on 03 Nov 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?