Hi,
I'm trying to Dynamically generate the RadContextMenu based on the contents of the Cell in RadGrid on which the user clicks. The menu items are stored in the SQL Sever database. Below is my client side code :
Now i want to pass the values current_Status, process_status and process_area to SQL server and get the list of actions to populate in the context menu.
Below are some snippets of the ASPX code:
Please help me achieve the desired functionality using either client side/server side code ? I am also willing to use XML files to load menu instead of database if feasible/possible.
Thanks,
Nishant
I'm trying to Dynamically generate the RadContextMenu based on the contents of the Cell in RadGrid on which the user clicks. The menu items are stored in the SQL Sever database. Below is my client side code :
function
RowContextMenu(sender, eventArgs) {
var
evt = eventArgs.get_domEvent();
if
(evt.target.tagName ==
"INPUT"
|| evt.target.tagName ==
"A"
) {
return
;
}
var
index = eventArgs.get_itemIndexHierarchical();
var
row = sender.get_masterTableView().get_dataItems()[index];
var
current_status = sender.get_masterTableView().getCellByColumnUniqueName(row,
"Current_Status"
).innerHTML;
var
process_status = sender.get_masterTableView().getCellByColumnUniqueName(row, sender.get_masterTableView().get_columns()[evt.target.cellIndex].get_uniqueName()).innerHTML;
var
process_area = //write code to get the column header of the selected cell
document.getElementById(
"radGridClickedRowIndex"
).value = index;
sender.get_masterTableView().selectItem(row.get_element(),
true
);
var
menu = $find(
"<%=RadMenu1.ClientID %>"
);
menu.show(evt);
evt.cancelBubble =
true
;
evt.returnValue =
false
;
if
(evt.stopPropagation) {
evt.stopPropagation();
evt.preventDefault();
}
}
Now i want to pass the values current_Status, process_status and process_area to SQL server and get the list of actions to populate in the context menu.
Below are some snippets of the ASPX code:
<
asp:SqlDataSource
ID
=
"ActionsDataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:MetadataCS %>"
ProviderName="<%$ ConnectionStrings:MetadataCS.ProviderName %>" SelectCommand="SELECT [Action] FROM [FileStatusActions] WHERE (([Process_Area] = @Process_Area) AND ([Current_Status] = @Current_Status) AND ([Process_Status] = @Process_Status))">
<
SelectParameters
>
<
asp:Parameter
Name
=
"Process_Area"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Current_Status"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Process_Status"
Type
=
"String"
/>
</
SelectParameters
>
</
asp:SqlDataSource
>
<
telerik:RadContextMenu
ID
=
"RadMenu1"
runat
=
"server"
OnItemClick
=
"RadMenu1_ItemClick"
OnClientShowing
=
"showContextMenu"
DataSourceID
=
"ActionsDataSource"
DataTextField
=
"Action"
DataValueField
=
"Action"
AppendDataBoundItems
=
"true"
EnableRoundedCorners
=
"true"
EnableShadows
=
"true"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Dynamic Menu"
/>
</
Items
>
</
telerik:RadContextMenu
>
Please help me achieve the desired functionality using either client side/server side code ? I am also willing to use XML files to load menu instead of database if feasible/possible.
Thanks,
Nishant