ASPXGridView (devexpress) Hyperlink column sorting - asp.net

I have a DevExpress ASPx GridView control and am trying to implement sorting for the grid columns.
The gridView contains has integer values in one column, text in the rest. I also have a column which contains hyperlinks and is added through the code behind during run time.
I am using the Aspxgrid_CustomColumnSort event for sorting the grid.
I can achieve the sorting for the column which contains the integer values and texts successfully, however the same code is not working for the column with hyperlinks.
When I click on the column header the hyperlinks sorts in ascending order,
but when I click the header the second time the grid isnt getting sorted in the descending order, the hyperlinks are sorted in randomn order ( neither ascending nor descending)
And, further clicks on the header do not do anything.
Any advice/suggestion will be greatly appreciated.

Maybe this link will help: http://www.devexpress.com/Support/Center/p/B145444.aspx. In this page, someone had reported an issue using the GridViewDataHyperLinkColumn.

Related

Why is my dynamically created asp:table retaining information on Postback?

I have a cart page.
The top lines are the products.
Then the Subtotal, Shipping, discount, Total lines.
Obviously this is all dynamic.
I call the exact same LoadTable() Sub in my Page_LoadComplete event.
First time around it looks great.
But if I edit the data and postback then it goes crazy:
If I remove a product, and the result is that my table is 1 row shorter.
The last row of the table, instead of showing "TOTAL" and the total amount, it displays what was in the row before the postback (ie. repeating the line before it).
The table is loaded into asp:panel and the beginning of my Sub starts with:
pnlCurrentOrder.Controls.Clear()
Dim tblCurrentOrder As Table = New Table()
tblCurrentOrder.Rows.Clear()
I have given the Totals Row and cells IDs and when I look at the source, they do have the correct ID information, but they have the wrong data in the cells.
This is very strange to me, Does anyone know whats going on?
Thanks
Try EnableViewState="false" on your table, to make it not remember the previous values.

How to hide one column in grid while exploring to excel

I showed data in gridview.There are lot of column,so used scroll bar to grid.For finding out perticular record,used auto generated select button.Suppose I select one record,it become different in colour.When I exporting data to excel,it shows that coloured column and select button also in excel .So I want to hide that select button and color of row of selected column.Even when I am taking diffrent record,that time also showes one row colored.I want liked this when I am selecting one item from dropdownlist,gridview should get disappered and on button clicked gridview should appered.Gridview has paging and column are auto-generated.
It seems that you are using GridView's RenderControl to export the data. This method writes the current html of GridView. If you want exported data to be formatted other than the GridView's current format then, I suggest that you to use HTML Table method to export the data.

_SelectionChanged event doesn't recognize data with null fields

I'm having some problems with the _SelectionChanged event on an ASPX grid view using devexpress v9.3.
The ASPX Gridview that is on the page doesn't recognize rows where some cells have no value. I can select rows where all of the cells have been populated and the keyFieldName is returned, however if some of the rows have no data it wont return anything.
I know each row has been assigned data for the KeyFieldName as I have outputted this to the grid.
Can anyone help me please x
Found the issue. The grid view in my business logic was incorrect and I had applied the wrong variable to the keyfieldname.. Doh!

Edit first column of GridView

I've got very dynamic GridView and I need to allow to user to edit first column of it. After he edit first column of grid it must be updated on DataBase.
Is there any ways to handle it ?
My only idea is to put some changeable element to first cell of each Row so it must be able to set / get my values for each row but can't find yet any examples of it ...
Additional info :
GridView takes data from Object data source and all columns are dynamic (yes, maybe except first, but I add it in dynamic way) and load complete DataTable... \
Currently Using jQuery+Ajax methode on dynamic button but can't disable button's PostBack so with a PostBack it just disappears and dont make the event it must to make...
Since you have dymanic columns, for each column, specify the read-only property (If a column is read-only, it may only be looked at, and not edited when in the GridView's Edit-Mode).
So, the first column of would be readonly="false" (or omit it entirely) and the other columns read-only="true".

How to get proper row index values of grid view after sorting

I have an asp.net application in which I am using a grid view. Paging and sorting are applied to the grid view. One action what I am doing is on click of any grid view row, am getting the column values of the selected row and redirecting to the other page.
The problem is after the grid view is sorted, if I click on any of the row in ayy page (paging index), am getting only first page values even though the visible row is different.
I am getting the row values in gridview_rowcreated() method and putting in some variable. In sorting scenario, before sorting is done, the gridview_rowcreated() method is called but not after the sorting is done.
In case you still need an answer to this...
You should be using the gridview's SelectedIndexChanging event with something like the following:
gridView.Rows.Item(intNewIndex).Cells(# of column, zero-based).Text
This will give each cell's current value, you'll just have to loop through each cell and assign each cell's value to desired variable(s).
Hope this helps!!!

Resources