Hi
I have a RadGrid, I have now been tasked with putting a Right Click Context menu in place. What I need to figure out is:
1) How can I get a value from the either the DataItem or the DataKeyValues from client side for the row that has fired off the
context menu?
Any thoughts / pointers most appreciated
| http://www.telerik.com/help/aspnet-ajax/grdsavingsettingsonperuserbasis.html |
public class CustomRadNumericTextBoxControl : RadNumericTextBox, IPostBackEventHandler, INamingContainer
{
private string OnKeyPressFunctionName = "OnKeyPress";
protected override void OnPreRender(EventArgs e)
{
RegisterJavascripts();
this.Type = NumericType.Currency;
this.Culture = CultureInfo.CurrentCulture;
this.DataType = System.Type.GetType("System.Decimal");
this.NumberFormat.AllowRounding = true;
this.ClientEvents.OnKeyPress = OnKeyPressFunctionName;
base.OnPreRender(e);
EnsureChildControls();
}
public void RegisterJavascripts()
{
Page.ClientScript.RegisterClientScriptInclude(
Guid.NewGuid().ToString(),
Page.ClientScript.GetWebResourceUrl(GetType(),
"<<Embedded javascript resource file name>>"));
}
}
}


| void RadGrid1_ItemCommand2(object source, GridCommandEventArgs e) |
| { |
| if (e.CommandName == RadGrid.FilterCommandName && ((Pair)e.CommandArgument).Second.ToString() == "orderdatetime") |
| { |
| e.Canceled = true; |
| GridFilteringItem filterItem = (GridFilteringItem)e.Item; |
| string filterPattern = "3/1/2010"; |
| string filterPatternAssist = "4/1/2010"; |
| filterPattern = "" + filterPattern + " <= [orderdatetime] AND [orderdatetime] <= " + filterPatternAssist + ""; |
| GridBoundColumn dateColumn = (GridBoundColumn)e.Item.OwnerTableView.GetColumnSafe("orderdatetime"); |
| dateColumn.CurrentFilterFunction = GridKnownFunction.Between; |
| RadGrid1.MasterTableView.FilterExpression = filterPattern; // Expression expected |
| RadGrid1.Rebind(); |
| } |
| } |
Filtering a datetime column using a dropdown triggers the above function. The Rebind shows the error "Expression expected". How do I fix this ? This code is the same as all the examples I've found so far. The only difference is that I'm using a LINQ datasource.
Please advise.