This is a migrated thread and some comments may be shown as answers.

Improvement 'patch' for client-side binding works ok, but not when doing sorting

1 Answer 31 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 15 Dec 2010, 08:10 PM
Hi,

i've made change in radgrid javascript events to overcome limitations of dealing with ID="data field name" and it works nice for initial load:
<asp:HyperLink runat="server" Text="{Name}" bindfield="Name,ID" exportformats="html" OnPreRender="hlName_PreRender" />
<asp:Label runat="server" Text="{Name} for PDF" exportformats="pdf" bindfield="Name" />
<asp:Label runat="server" Text="{Name} for Excel" exportformats="excel" bindfield="Name" />
As you can see, i need more flexible way to manage fields. In your case, I cannot created 2 fields referencing the same datafield in the same ItemTemplate. Here I am having separate field sets for exporting into various formats. { } stands for Eval :)

I wonder why you have not used any custom attribute for WebControl, which would stand for DataField - you may add any - but instead sticked to ID and made serious usability limitations... :(

Anyway, now i have the problem with this: if I use ID="data field name" - sorting works as expected, but if I use my approach, without ID, correct data is returned from webmethod as before and dataSource is ok, but the grid is NOT sorted. Please, tell me what should i change in order it did sorting! :) I need it very much, but I don't have idea,  where in the code you check for ID to use it somehow for sorting...

1 Answer, 1 is accepted

Sort by
0
Alexander
Top achievements
Rank 1
answered on 16 Dec 2010, 01:08 PM
Time is running out :( I will try to use server-side properties to create HTML markup instead :)
So:
<asp:Label ID="Url" runat="server"/>
=>
Url = string.Format("<a href='Pages/Company.aspx?ID={0}'>{1}</a>", companyInfo.Name, companyInfo.ID)
inside WCF service. I will also use Attributes for markup of all fields and use them in server-side events for export preparation, etc.
Tags
Grid
Asked by
Alexander
Top achievements
Rank 1
Answers by
Alexander
Top achievements
Rank 1
Share this question
or