Wednesday, August 29, 2012

How to change the columns in the grid based on the table selected from the dropdown

How to change the columns in the grid based on the table selected from the dropdown

Hi,

  I am having page in silverlight with dropdown and silverlight datagrid,  datagrid with dymanic columns  based on the table name selected from the dropdown. Now the problem is i have on read only table and only for this i want to reorder the columns

Example :

Normal Table : Col A,Col B,Col C,Col D

Readonly Table : Col A,Col D,Col C,Col B

   If it is Possible, Provide me the Solution Asap.

Thanks and Regards

Ragavendran.S

Answers & Comments...

Answer: 1

Hi sraghavann,

sraghavann

I am having page in silverlight with dropdown and silverlight datagrid,  datagrid with dymanic columns  based on the table name selected from the dropdown.

To achieve this, you can set the itemsource for the DataGrid dynamically according to the item selected in the dropdown( such as a Combobox).

sraghavann

Now the problem is i have on read only table and only for this i want to reorder the columns

If you want to reorder the columns of the DataGrid, you can do this by set DataGrid.CanUserReorderColumns Property, true if the user can reorder columns; otherwise, false.

http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid.canuserreordercolumns(v=vs.95).aspx

If I misunderstand you, please elaborate your issue more clearly.

Best Regards,



Answer: 2

Hi,

  I have 5 table which is coming from the DB and populating the dropdown. Based on the table selected in the dropdown the grid will be loaded with the appropriate columns. I have one "Readonly Table" in that 5 tables, when the user selects the ReadOnly table the grid will change the column order while loading itself.I am converting the DB columns to XML format and I am Loading the all the grid columns.

Example:

Normal Tables

ID  StartDate  EndDate  User  Value1 Value2

ReadOnly Table

ID  User  StartDate  EndDate  Value1  Value2

  Note: I want to do this reorder of the columns after the user selects the table name from the dropdown,the columns should reorder automatically in the grid and I don't want the user the reorder manually



Answer: 3

sraghavann

I have one "Readonly Table" in that 5 tables, when the user selects the ReadOnly table the grid will change the column order while loading itself.

To achieve the goal, you can let another DataGrid( define the columns order according to your needs) to show the datas in particular, when you select the table name("Readonly Table" ), hide the original table and show this table, when the selection changed hide this table show the original table.

Best Regards,



Answer: 4

hi sraghavann

Fill the Grid with all columns and make the User  Columns Visibility to collapsed and Visible...


Thanks & Regards
Mastan Narravula
Mark as Answer", if it helped you or it might help others too.






No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog