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

I can´t sort the columns

3 Answers 109 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Benigno Benavides Siller
Top achievements
Rank 1
Benigno Benavides Siller asked on 08 Jan 2008, 11:41 PM
Hi

I´m using Visual studio 2008, framework 3.5 and the new version of Prometheus.

I have a RadGrid  in a content page with the next code in asp.

<

telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="true" >

<MasterTableView Width="100%" AllowMultiColumnSorting="true" />

<ClientSettings ReorderColumnsOnClient="true" AllowColumnsReorder="true" >

<ClientEvents OnColumnResized="ColumnResized" />

</ClientSettings>

</telerik:RadGrid>



The RadGrid gets the values  in code behind when I click on a button.

My problem is when I want to sort the columns , the columns dissapear. In fact, de RadGrid dissapear.
I was trying to use an AjaxManager like this:

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
          <AjaxSettings >
          <telerik:AjaxSetting AjaxControlID="RadGrid1"   >
               <UpdatedControls >
               <telerik:AjaxUpdatedControl  ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"  />
               </UpdatedControls>
                 </telerik:AjaxSetting>
           </AjaxSettings>
          </telerik:RadAjaxManager>
         
          <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"
              Width="75px">
              <img alt="Loading..." src='<%= originalAttribute="src" originalPath="'<%=" RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
                  style="border: 0px;" />
          </telerik:RadAjaxLoadingPanel>


But I can´t get what I want.

Any suggestion?

Thanks

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 09 Jan 2008, 07:32 AM
Hello Benigno,

Can you post a bit more info about how the grid is bound in your case? You should use advanced data-binding with NeedDataSource or DataSourceID for automatic sorting.

All the best,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Benigno Benavides Siller
Top achievements
Rank 1
answered on 09 Jan 2008, 02:58 PM
This is my code in Visual basic:


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

defineTable()

End Sub



Public

Sub defineTable()

 

Dim graphicD As New graphicDAO

Dim scriptString As String

Din graphicV as New graphicVO 

 

 

graphicV= graphicD.getInformation()

 

If graficaV.getError = True Then

scriptString =

"<script language=javascript type=text/javascript>var message='ERROR';alert(message); window.location='Default.aspx';</script>"

Response.Write(scriptString)

 

ElseIf graphicV.getError = False Then

If graphicV.getIsEmpty = True Then

Me.lblMessage.Visible = True

Else

Me.lblMessage.Visible=False
Me
.RadGrid1.DataSource = graficaV.getInformation

Me.RadGrid1.DataBind()

 

End If

End If

End Sub

I have two classes called graphicDAO and graphicVO. IN the class graphicDAO I use a function ,getInformation() and with this function  I get the values for the Grid  returned as  a property of the  object (graphicV.getInformation) .

Thanks





 

 

 

0
Sebastian
Telerik team
answered on 09 Jan 2008, 03:12 PM
Hello Benigno,

From your code snippets I see that you use simple binding to bind the grid content (calling DataBind()). As suggested in our previous reply, I suggest you modify your binding logic to use advanced binding through the NeedDataSource event. See these articles for more info:

http://www.telerik.com/demos/aspnet/Grid/Examples/Programming/NeedDataSource/DefaultCS.aspx

http://www.telerik.com/help/aspnet/grid/?grdEventSequence.html

Note that you can refresh the grid content at some page of the lifecycle assigning new data source and invoking its Rebind() method.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Benigno Benavides Siller
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Benigno Benavides Siller
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or