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

unselectable Columns and contextmenu problem

1 Answer 33 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Amine
Top achievements
Rank 1
Amine asked on 11 Oct 2012, 04:31 PM
Hello
i have some problem about gridvieuw
first :
how to make a columns to Unselectable stat?,i want to prevent the user to clicking on some columns
the second
to solve the first problem I use this method :
the main objectf is to click on specefic cells and capture the value to use in a sql query,so i need to capture the adequate value for the query works.
here is the code :
void GridViewKPI_MouseDown(object sender, MouseButtonEventArgs e)
        {
            RadContextMenu radContextMenu = new RadContextMenu();
 
            if (GridViewKPI.CurrentCell.Column.UniqueName == "Cell ID")
            {
                TBox_CellID.Text = GridViewKPI.CurrentCell.Value.ToString();
                 
                RadMenuItem copyItem = new RadMenuItem();
                copyItem.Header = "Show In chart";
                radContextMenu.Items.Add(copyItem);
                RadMenuItem pasteItem = new RadMenuItem();
                pasteItem.Header = "Show in Ho Stat";
                radContextMenu.Items.Add(pasteItem);
                RadMenuItem cutItem = new RadMenuItem();
                cutItem.Header = "Show in Map";
                radContextMenu.Items.Add(cutItem);
                RadContextMenu.SetContextMenu(this.GridViewKPI, radContextMenu);
 
            }
            //else radContextMenu.Items.Remove(copyItem);
        }
The code work fine ,the first time when i click in other cells nothing happens,and when i click in a  specefic cells (Cell ID in my case) the contextmenu appears normally and this is the main objectif,but after this when i reclick in the other cell the contextmenu appears also,and this is my problem,the contextmenu must appears only when i click in a specific columns.
so,how to prevent this to happen?
thanks a lot

1 Answer, 1 is accepted

Sort by
0
Amine
Top achievements
Rank 1
answered on 14 Oct 2012, 11:30 AM
Someone can answer me please!
Tags
GridView
Asked by
Amine
Top achievements
Rank 1
Answers by
Amine
Top achievements
Rank 1
Share this question
or