Forms Data Controls :: Column Reorder In Gridview?
Jun 8, 2010
I'm working on a GridView that has around 75 columns. I'm looking for a way the end user can set the order of columns in which he would like to view so that each time he logs in the order is retained.
View 2 Replies
Similar Messages:
Jul 8, 2010
I'm using following code to reorder listview columns programatically somehow it is showing incorrect behaviuor for certain scenarios. Please let me know if there is any alternative way -
[Code]....
using System;
using System.Xml.Serialization;
using System.Windows.Forms;
using System.Collections;
using System.Runtime.InteropServices;
namespace TradeDesk
{
/// <summary>
/// This class is used to save and restore the column width and order settings
/// for a ListView control. Unfortunately, there is no easy way to obtain the
/// order so a Windows message must be sent to the control. This class
/// encapsulates that functionality as well as the serialization/deserialization
/// of the settings.
/// </summary>
[Serializable]
public class ListViewSettings
{
[DllImport("user32.dll")]
static extern bool SendMessage(IntPtr hWnd, Int32 msg, Int32 wParam, ref LV_COLUMN lParam);
[StructLayoutAttribute(LayoutKind.Sequential)]
struct LV_COLUMN {
public UInt32 mask;
public Int32 fmt;
public Int32 cx;
public String pszText;
public Int32 cchTextMax;
public Int32 iSubItem;
public Int32 iImage;
public Int32 iOrder;
}
const Int32 LVM_FIRST = 0x1000;
const Int32 LVM_GETCOLUMN = LVM_FIRST + 95;
const Int32 LVM_SETCOLUMN = LVM_FIRST + 96;
const Int32 LVCF_ORDER = 0x0020;
[XmlElement("ListViewColumns", typeof(ListViewColumn))]
public ArrayList listViewCols = new ArrayList();
public ListViewSettings(ListView listView) {
try {
foreach(ColumnHeader column in listView.Columns) {
LV_COLUMN pcol = new LV_COLUMN();
pcol.mask = LVCF_ORDER;
bool ret = SendMessage(listView.Handle, LVM_GETCOLUMN, column.Index, ref pcol);
listViewCols.Add( new ListViewColumn( column.Text, column.Width, pcol.iOrder ));
}
}
catch {}
}
public void RestoreFormat(ListView listView) {
try {
listView.Hide();
for( int i=0; i<listViewCols.Count; i++ ) {
foreach( ColumnHeader column in listView.Columns ) {
if( column.Text == ((ListViewColumn)listViewCols[i]).header ) {
LV_COLUMN pcol = new LV_COLUMN();
pcol.mask = LVCF_ORDER;
pcol.iOrder = ((ListViewColumn)listViewCols[i]).order;
bool ret = SendMessage(listView.Handle, LVM_SETCOLUMN, column.Index, ref pcol);
column.Width = ((ListViewColumn)listViewCols[i]).width;
break;
}
}
}
listView.Show();
}
catch {}
}
}
[Serializable]
public struct ListViewColumn {
public string header;
public int width;
public int order;
public ListViewColumn(string colHeader, int colWidth, int colOrder) {
header = colHeader;
width = colWidth;
order = colOrder;
}
}
}
View 4 Replies
Oct 12, 2010
I want to display gridview column heading when mouse over to the particular column in the gridview.I am working in VisualStudio 2005 with MS.Net2.0 framework.I don't want to use ajax.
View 4 Replies
Oct 29, 2010
[Code]....
Main Gridview[Code]....
View 3 Replies
Jan 6, 2011
I have a gridview which is binded to a Sqldatasource. I would like to replace a column data field value to 'Not Applicable' if that column has got a value of 2 in database.
View 2 Replies
Oct 12, 2010
want to display gridview column heading when mouse over to the particular column in the gridview.
View 9 Replies
Jul 22, 2010
How to add a button at first column of gridview and get cell value in another column?
For example, add a button named it as "Click me". Once user clicks will get third column cell's (ID) value.
View 2 Replies
Mar 4, 2011
No sense in showing a competely blank column. how to make a GridView column invisible if every cell in that column is empty?
View 3 Replies
Jul 14, 2010
I have a gridview with 3 columns. In second column I want to display some text in 2 rows and then a gridview.
Here is my code:
[Code]....
The problem is my third row is displayed as a row under first column. How do I make it a separate column in my girdview. Not sure what is going wrong.
View 11 Replies
Jan 8, 2011
I am using GridView ,I want to do a validation like if i edit any one of the Cell in that column, it will through the validation when the sum of column value is more than 100. How can i do this validation?
View 10 Replies
Jul 6, 2010
I have tried several examples of reorder list with several types of data sources and can't get the list to reorder. I have copied Joe Stagner's code from his Video on Reorder Control with the same result. Here is the Video
http://www.asp.net/ajax/videos/how-do-i-the-ajax-toolkit-reorder-control. Page loads, but I can't drag items to reorder. I have tried this with explorer 8 and firefox 3.6, with and without security. Here is the markup, no code behind.
[Code]....
Some of the events don't seem to fire. DataBinding, DataBound, Load, and InsertCommand work ItemReorder does not, (not good for a reorder control). This control should work, but doesn't. I am able to insert data so it seems that the reorder or dragItem templates maybe causing problems. I have commented out but that doesn't help. Here is my only clue, I had to use the script manager from the .net4 Ajax Control Kit for my events to not complain about definitions. I was only using these events with debugger just to see if they are being called, no code in methods. But I am using the toolkit.dll that came with Joe's example. I tried it with .net4 only first, but that didn't work either that's when I installed the dll from Joe's example.
View 1 Replies
Mar 8, 2010
is it possible for reorder list to to allow user to drag n drop via column cell.
For example,
Column1 | Column2
------------------------------
Value1 |Value5
Value2 |Value6
Value3 |Value7
Value4 |Value8
Value 1 was drag n drop to the position of Value5. And Value5 ,Value6,Value7,Value8 position are reorder like Reorderlist in row.
View 3 Replies
Feb 15, 2010
I have the reorderlist and a DELETE as link button. So far so good as far as I can tell that when I clicked on the delete link button, it deletes photo value from the database per the ID PK. However, I want to be able to delete the right photo file on the server/disk (jpg, gif..) but I could not figure out the logic to do so.
View 1 Replies
Apr 27, 2016
I saw post [URL] .... which is converting rows into column item,quantity ,price. I have one other image field .how can bind image in this program?
View 1 Replies
Aug 16, 2013
As per my requirement, I am getting CompID, Company Name and URL from SQL database. I want to display just CompName and URL in gridvew. So, I need to hide the CompID in gridview. One way I can do BoundField field Visible to false but I need to retrive that compID id when user selected any of the row. if I set visible to false user wont see any compID in gridvew but I want access the selected compID also using SelectedRow.Cells[1].Text..
View 1 Replies
May 7, 2015
I am using item template and eval function in the gridview to display the records. Can I add a coulmn which is not in the table?
I have to add some columns which is not in the table and assign the values from code behind to that particular column
View 1 Replies
Feb 3, 2014
I have a grid view with 4 columns and 12 rows. Getting the row index is not problem; ;however, I cannot find a way to get the column index of the cell that i select.
View 1 Replies
Jul 9, 2010
how to implement Insert feature to a grid view?I need to use fields with scroll bar inside of a grid view. Is that possible through the template field?
View 23 Replies
Mar 8, 2011
I have one filed that is encrypted using Rajindal algorithm and stored in MSSQL db.When I retrieve that column in gridview it's displayed in encrypted. I have the code that decrypts it but the problem is:How can I all loop throw this column values in the gridview and decrypt them all and display it in the gridview decrypted.See my code below:
[Code]....
View 9 Replies
Feb 9, 2011
I'm facing a wierd problem with GridView and ObjectDataSource. I bind GridView to my business objects via ObjectDataSource. Everything was working fine until I decided to add a new field in my buisness object and wanted to add a column to GridView to show it. Somehow that column is NOT shown in the GridView's list of available columns. I have tried refreshing schema, rebinding, etc. I'm using GridView inside a user control which is used as a web part. Does that make a difference ?
View 3 Replies
Jan 28, 2010
I want to use a value of a column from a selected row in a gridview as default value of a dropdownlist on a form on the same page. how to get this done in VB?
View 4 Replies
May 9, 2010
How to Get Column value of gridview in c #
[Code]....
[Code]....
View 2 Replies
Mar 15, 2011
I need to get the value of some columns in a gridview control.
Ive tried:
[Code]....
But that doesn't work. I get an error 'Identifier Expected'
View 3 Replies
Jun 15, 2010
how to get first column value of each row in Gridview?
i am writing like this:
int Total=0;
for (int i = 0; i < GridView1.Rows.Count; i++)
{
Total += = Convert.ToInt32(GridView1.Rows[i].Cells[0].Text); //it does not have column value
}s
View 3 Replies
Jul 20, 2010
How to get the name of a particular column of a gridview ?
View 4 Replies