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

access column CellIndex from server side

2 Answers 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
emrah
Top achievements
Rank 1
emrah asked on 06 Jan 2010, 01:45 PM

Hello,

in this demo,  i can use column swaaping option via client side,

http://demos.telerik.com/aspnet-ajax/grid/examples/client/clientsideevents/defaultcs.aspx

but i need save user column orders in databasei because when user enter the sytem later, user should see own grid template

my problem is i cant get column cell Index on server side

Java Script Function  :

function ColumnMouseOver(sender, eventArgs) {

 

 

var text = "";

 

text +=

" Display Order : ";

 

text +=

", Index: " + eventArgs.get_gridColumn().get_element().cellIndex;

 

document.getElementById(

"OutPut").innerHTML = text;

 

}

after the columns swapping events, i need all columns order Index  for saving data Base,
but i could'nt find "eventArgs.get_gridColumn().get_element().cellIndex;"  in server side.

all swaipping process running or client side, i think server side cant undesrtand swapping column orders.

and there is one button below the grid :

 

 

foreach (GridColumn columns in this.gridOrderColumn.Columns)

 

{

userTemplateDetail =

new UserTemplateDetail();

 

userTemplateDetail.UserTemplateId = userTemplateID;

userTemplateDetail.CurrentStateId = -1;

userTemplateDetail.OrderIndex = columns.OrderIndex ?? //  <--- i cant get CellIndex -- order index doesnt change when swapping

dbUserTemplateDetail.add(userTemplateDetail);

}

i can describe my point, and i need to help.

Thanks

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 06 Jan 2010, 02:33 PM
Hello Emrah,

Check out the following code library application which explains on how to store grid settings such that users can have their own personal settings. This should probably help you out.
Storing Multiple Grid settings in Database via Profile

Thanks
Princy.

0
Hus Damen
Top achievements
Rank 1
answered on 06 Jan 2010, 03:47 PM
Hi Emrah,

If you use AutoGenerateColumns = "true" then you should modify loop code like this:

foreach (GridColumn columns in this.gridOrderColumn.MasterTableView.AutoGeneratedColumns) 
... 

It also depends on which event you try to get the OrderIndex of the columns. Have you tried to access the index on the OnDataBound grid event?

I hope this helps.
Hus

Tags
Grid
Asked by
emrah
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Hus Damen
Top achievements
Rank 1
Share this question
or