Hi,
Is it possible to customize the EnableHeaderContextMenu? i.e.) There are four columns in a grid , suppose user hides the two columns.Next time when he see the grid it should only contains two columns which was selected previously but not all.
Is it possible to customize the EnableHeaderContextMenu? i.e.) There are four columns in a grid , suppose user hides the two columns.Next time when he see the grid it should only contains two columns which was selected previously but not all.
4 Answers, 1 is accepted
0
Hello Sathies,
You can access the items in the context menu on ItemCreated/ItemDataBound events:
Let us know if you need further assistance.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You can access the items in the context menu on ItemCreated/ItemDataBound events:
void HeaderContextMenu_ItemCreated(object sender, RadMenuEventArgs e) |
{ |
//your code |
} |
protected void RadGrid1_Load(object sender, EventArgs e) |
{ |
RadGrid1.HeaderContextMenu.ItemCreated += new RadMenuEventHandler(HeaderContextMenu_ItemCreated); |
} |
Let us know if you need further assistance.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

sathies
Top achievements
Rank 1
answered on 29 Dec 2008, 02:17 PM
Hello Daniel,
Thanks for your Reply.
I tried your code its working but i couldn't get access to the column names in the grid. Please help me in this regard.
Also give example for the above.
regard,
sathies
Thanks for your Reply.
I tried your code its working but i couldn't get access to the column names in the grid. Please help me in this regard.
Also give example for the above.
regard,
sathies
0

Shinu
Top achievements
Rank 2
answered on 30 Dec 2008, 09:27 AM
Hi Sathies,
You can try the following code snippet to access the Column names in the code behind.
CS:
Shinu
You can try the following code snippet to access the Column names in the code behind.
CS:
foreach (RadMenuItem item in RadGrid1.HeaderContextMenu.Items[7].Items) |
{ |
int count=RadGrid1.HeaderContextMenu.Items[7].Items.Count; |
for (int i = 0; i <= count-1; i++) |
{ |
string strName = RadGrid1.HeaderContextMenu.Items[7].Items[i].Value; |
string strColName = strName.Split('|')[1]; |
} |
break; |
} |
Shinu
0
Hello Sathies,
Please test the example attached to this post.
Let us know whether this helps.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Please test the example attached to this post.
Let us know whether this helps.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.