Hi,
I'd like to be able to build my RowContextMenu at run-time based on the row being selected. Based on values in the selected row, I need to be able to modify my row context menu and JS calls to it.
How can I achieve this?
Thanks!
Hello Khaled,Please take a look at the attached sample which is changing visibility of the items on the client.
Hi Nikifor,
Based on my project needs I have to implement a different solution. I had the WebDataMenu items created in the markup. During the MouseDown event, I would check certain conditions in my grid and hide menu items as needed.
Thanks.
Hello Khaled,Please let me know if you have any further questions regarding this issue.
Hello Khaled,I took a quick look at your project. Did you have the chance to look at my working attachment? Since you are modifying another control which is outside the grid no changes would be saved. In my sample I disabled the ajax of the grid and put both – menu and grid in an update panel to ensure that when I update the menu from the grid’s event the changes will be saved. Please take a look at the following page - http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.aspx Another point is - no need to call Databind everytime the datarourse is set. The grid is calling automatically databind after you set datasource in page load. Databind should be called manually if you are setting a new datasource after the binding events have passed (render for example) or when you are making visual changes – for example hiding a column after the grid is bound. Your selection changed event was not triggered. Actually your selection was not persisted. The reason for this is that you call ClearDataSource to the grid which has to be called only when you are setting another datasource not the present one - http://help.infragistics.com/NetAdvantage/ASPNET/2012.2/CLR4.0?page=Infragistics4.Web.v12.2~Infragistics.Web.UI.GridControls.WebDataGrid~ClearDataSource.html . When you call this method you are clearing all the selection activation and other data which is persisted from our grid for the present datasource. After you remove this method the grid will start invoking the row selection changed server event in which you will be able to add the items in the menu. IF you follow my advice an add the grid and the menu in an update panel the menu will start to update its items when they are set from another control. Please note that the context menu is not showed if it does not have items at all and this is by desing. Regarding the row selection. Currently it is not possible to select a row because you have set cell click action to be cell not row so the property rowselectype – multiple is actually not working because you cant select a row.
I should also note that I need the right click the automatically select the row it happens on even if no row is currently selected.
Thank you.