473,612 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

EnableSortingan dPagingCallback when


I have a gridview that is refreshes when a dropdown is selected outside
of it. Sorting is enabled on the gridview but not working.

I read that I should set EnableSortingan dPagingCallback to true to fix
the error:

The GridView 'GridView1' fired event Sorting which wasn't handled

However, I am now getting:

Callbacks are not supported on CommandField when the select button is
enabled because other controls on your page that are dependent on the
selected value of 'RatePlanGridVi ew' for their rendering will not
update in a callback. Turn callbacks off on 'RatePlanGridVi ew'.

Paging on the gridview appears to work fine, because I added these:

Protected Sub RatePlanGridVie w_PageIndexChan ged(ByVal sender As
Object, ByVal e As System.EventArg s) Handles
RatePlanGridVie w.PageIndexChan ged
.. and I rebind (but I don't see code to set the new page)

End If

Protected Sub RatePlanGridVie w_PageIndexChan ging(ByVal sender As
Object, ByVal e As GridViewPageEve ntArgs) Handles
RatePlanGridVie w.PageIndexChan ging
RatePlanGridVie w.PageIndex = e.NewPageIndex
RatePlanGridVie w.DataBind()
End Sub
I get the noted error under

Protected Sub RouteCodesList_ SelectedIndexCh anged
when I attempt to bind.
The gridview is configured as follows:

<asp:GridView ID="RatePlanGri dView" runat="server"
AutoGenerateCol umns="False" DataKeyNames="R outeCode"
Width="700px" SkinID="GridVie w"
AllowPaging="Tr ue" AllowSorting="t rue" ShowFooter="tru e"
PagerSettings-Mode="NumericFi rstLast">
Is there an event for sorting I should set, and will I have to take of
sorting myself?

Oct 23 '06 #1
2 6925
onsorting="Grid view_sorting"

and

Protected Sub GridView_Sortin g(ByVal sender As Object, ByVal e As
GridViewSortEve ntArgs)
...

End Sub

Can somebody point me in the right direction in how to finish this, I
presume with e.sortdirection and/or e.sortexpressio n. I found some C#
code I tried to convert, but vb.net knows nothing about
ConversionHelpe rs or CovertSortDirec tionToSQL. I am unclear about how
the sorting is even going to work.

Protected Sub RatePlanGridVie w_Sorting(ByVal sender As Object,
ByVal e As GridViewSortEve ntArgs)
Dim dataTable As DataTable =
CType(Conversio nHelpers.AsWork around(RatePlan GridView.DataSo urce,
GetType(DataTab le)), DataTable)
If Not (dataTable Is Nothing) Then
Dim dataView As DataView = New DataView(dataTa ble)
dataView.Sort = e.SortExpressio n + " " +
ConvertSortDire ctionToSql(e.So rtDirection)
RatePlanGridVie w.DataSource = dataView
RatePlanGridVie w.DataBind()
End If

Oct 23 '06 #2
The Grid displays with multiple rows. I select to sort of a particular
field and the below event is fired, but DataTable is Nothing so code is
skipped.
Protected Sub ChargeGridView_ Sorting(ByVal sender As Object, ByVal e
As GridViewSortEve ntArgs)
Dim dataTable As DataTable = CType(ChargeGri dView.DataSourc e,
DataTable)
If Not (dataTable Is Nothing) Then '****** (THIS IS ALWAYS
FALSE) ****
Dim dataView As DataView = New DataView(dataTa ble)
dataView.Sort = e.SortExpressio n + " " + e.SortDirection
Response.Write( e.SortExpressio n + " " + e.SortDirection )
ChargeGridView. DataSource = dataView
ChargeGridView. DataBind()
End If
End Sub

The GridView:

<asp:GridView ID="ChargeGridV iew" runat="server"
AutoGenerateCol umns="False" DataKeyNames="R outeCode"
Width="700px" SkinID="GridVie w"
AllowPaging="Tr ue" AllowSorting="t rue"
OnSorting="Char geGridView_Sort ing" ShowFooter="tru e"
PagerSettings-Mode="NumericFi rstLast">

Oct 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2648
by: Dynamo | last post by:
Hi, I am still confused as when to use single or double quotes. This works: echo "<td>" . $row . "</td>"; and this does not
4
12510
by: Nuno | last post by:
Is there any SQL Error? Or I have to use Select case in VB code to control SQL instead. Thank you for any ans. Nuno
2
18309
by: Halldór Ísak Gylfason | last post by:
In my application I have an iframe that is empty (and not visible) initially, however when a user presses a button a form is programmatically submitted and the target is set to the IFrame. I want to detect when the frame has been loaded with the result of the form submit. Of course I have tried some event handlers like onload, onactivate, onreadystatechange, but they do not work in this example. They only seem to work, when the "SRC"...
7
19947
by: sql-db2-dba | last post by:
Does DB2 just fudge it when it is an empty table? Is there a "formula" for average row size when you have variable length records. Or you really have to know what your application is packing into those varchar columns. Bill Leung leungb@aptea.com
4
5922
by: Peter Row | last post by:
Hi, I have created a UserControl which is subsequently hosted on a standard form. My control has a TabControl on it but it has no TabPages configured. At runtime I create X pages and put a single RichTextBox on each page. In my controls loaded event I call my Render() method which configures everything appropriately. When setting up the TabControl the first thing it says is (not real var names):
5
555
by: AAguiar | last post by:
I have an asp.net project where the code behind the aspx page calls a c# class which makes calls to a managed static C++ class. The C# class works fine when the asp net worker process starts, when it is invoked by pressing "F5", or when the web.config file is modified. In all these cases the web.config file contains <identity impersonate="false" />. The mysterious problem arrises when I set <identity impersonate="true"/> in the...
8
2562
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and courses are populated. When course is selected, lists of occurrences, groups and
44
8217
by: Smokey Grindle | last post by:
I have a list box on my form, but I need to databind it to a data table that is a private member of the form's class... so I basically have Public Class MyForm priate m_MyTable as new datatable End Class now where would I properly dispose of this? In the finalize method? I am loading the data for the table in a subroutine that is executed at form load, of course all the commands tied to it are wrapped in using blocks, but
0
8105
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8605
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8565
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8246
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7039
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6076
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5532
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4045
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
1413
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.