public virtual void CreateHeaderControls(IDotvvmRequestContext context, GridView gridView, Action<string> sortCommand, HtmlGenericControl cell, IGridViewDataSet gridViewDataSet) { if (HeaderTemplate != null) { HeaderTemplate.BuildContent(context, cell); return; } if (AllowSorting) { if (sortCommand == null) { throw new DotvvmControlException(this, "Cannot use column sorting where no sort command is specified. Either put IGridViewDataSet in the DataSource property of the GridView, or set the SortChanged command on the GridView to implement custom sorting logic!"); } var sortExpression = GetSortExpression(); var linkButton = new LinkButton(); linkButton.SetValue(LinkButton.TextProperty, GetValueRaw(HeaderTextProperty)); cell.Children.Add(linkButton); var bindingId = linkButton.GetValue(Internal.UniqueIDProperty) + "_sortBinding"; var binding = new CommandBindingExpression(h => sortCommand(sortExpression), bindingId); linkButton.SetBinding(ButtonBase.ClickProperty, binding); SetSortedCssClass(cell, gridViewDataSet); } else { var literal = new Literal(); literal.SetValue(Literal.TextProperty, GetValueRaw(HeaderTextProperty)); cell.Children.Add(literal); } }
public virtual void CreateFilterControls(IDotvvmRequestContext context, GridView gridView, HtmlGenericControl cell, IGridViewDataSet gridViewDataSet) { if (FilterTemplate != null) { var placeholder = new PlaceHolder(); cell.Children.Add(placeholder); FilterTemplate.BuildContent(context, placeholder); } }
public virtual void CreateHeaderControls(DotvvmRequestContext context, GridView gridView, Action<string> sortCommand, HtmlGenericControl cell) { if (AllowSorting) { if (sortCommand == null) { throw new Exception("Cannot use column sorting where no sort command is specified. Either put IGridViewDataSet in the DataSource property of the GridView, or set the SortChanged command on the GridView to implement custom sorting logic!"); } var sortExpression = GetSortExpression(); var linkButton = new LinkButton() { Text = HeaderText }; cell.Children.Add(linkButton); var bindingId = linkButton.GetValue(Internal.UniqueIDProperty) + "_sortBinding"; var binding = new CommandBindingExpression((o, i) => { sortCommand(sortExpression); return null; }, bindingId); linkButton.SetBinding(ButtonBase.ClickProperty, binding); } else { var literal = new Literal(HeaderText); cell.Children.Add(literal); } }