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

Adding Sort to dynamic column

8 Answers 185 Views
Grid
This is a migrated thread and some comments may be shown as answers.
RJ
Top achievements
Rank 1
RJ asked on 26 Jan 2010, 02:43 PM
Hi, I wanted to add sort to my dynamic column. Where can I find any documentation code on how to accomplish this. Any inputs would be appreciated.

Thanks in advance,
RJ

8 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 26 Jan 2010, 03:45 PM
Hello,

Where are you adding the columns? Please refer to the following article, for more information about how to acomplish this functionality:
Programmatic creation

Kind regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
RJ
Top achievements
Rank 1
answered on 26 Jan 2010, 06:52 PM
Hi Pavlina,

I used "Dynamically defining the structure of a statically-declared grid". Grid is defined on aspx but all of its columns are created dynamically. Just like I said, how can I make dynamic column have a sort for each column.
 
I already added code

boundColumn.SortExpression ="LastName"
boundColumn.HeaderButtonType = GridHeaderButtonType.TextButton

Just to make it work like the static column defined just like this one.

<telerik:GridBoundColumn SortExpression="LastName" HeaderText="LastName" HeaderButtonType="TextButton" DataField= "LastName" />

But to no avail. Header is not clickable.

Thanks again,
RJ

0
RJ
Top achievements
Rank 1
answered on 26 Jan 2010, 07:22 PM
Never mind seems like I just need to add is AllowSort="true" on Mastertableview..

Though I encounter another problem.
My design for my grid is always editable like an excel.

Whenever I click on sort it makes my grid row readonly..
though I already added code on Radgrid1_SortCommand

For i=0 to RadGrid1.MasterTableView.Items.Count() -1
 Me.RadGrid1.MasterTableView.Items(i).Edit = True
Next
RadGrid1.MasterTableView.Rebind()


code has been executed successfully but it did not reflect.

Thanks,
RJ


0
Accepted
Pavlina
Telerik team
answered on 27 Jan 2010, 09:28 AM
Hi,

Usually the edit mode of the items is not kept when changing the page - please take a look at this demo
To achieve the required functionality, you could save it using an approach similar to the approach in the following help article:
Persisting the selected rows server-side on sorting/paging/filtering/grouping

I hope this helps.

Kind regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
RJ
Top achievements
Rank 1
answered on 27 Jan 2010, 12:35 PM
Thanks a lot Pavlina, PreRender works.
0
Jason
Top achievements
Rank 1
answered on 01 Apr 2011, 08:41 PM
Please refer to the same article and let me know where the word "SORT" appears.

I was referring to the article in the second post.
0
kavitha
Top achievements
Rank 1
answered on 13 May 2011, 03:06 PM
I cannot find the link http://www.telerik.com/help/aspnet-ajax/grdprogrammaticcreation.html posted in the second post.
The pages show "An error occurs while processing your request".
Can somebody provide me a link to sort a gridview in which the columns are added programatically?
Thanks
0
Pavlina
Telerik team
answered on 13 May 2011, 05:00 PM
Hello Kavitha,

You can find the desired information in the link below:
http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html

Regards,
Pavlina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
RJ
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
RJ
Top achievements
Rank 1
Jason
Top achievements
Rank 1
kavitha
Top achievements
Rank 1
Share this question
or