or
protected void radButtonExcel_Click(object sender, EventArgs e){rptTreeList.ExportSettings.IgnorePaging = true;rptTreeList.ExportSettings.ExportMode = TreeListExportMode.RemoveAll;rptTreeList.Rebind();rptTreeList.ExportToExcel();}
<telerik:RadAsyncUpload ID="RadAsyncUpload1" Width="200px" AllowedFileExtensions=".xls" MultipleFileSelection="Disabled" runat="server" OnFileUploaded="RadAsyncUpload1_FileUploaded"> <FileFilters> <telerik:FileFilter Description="Excel(*.xls)" Extensions="xls" /> </FileFilters></telerik:RadAsyncUpload> ********** aspx:***************<telerik:GridBoundColumn DataField="date" HeaderText="תאריך" DataType="System.DateTime" SortExpression="date" UniqueName="Date" DataFormatString="{0:D}" HeaderStyle-Width="330px" ItemStyle-HorizontalAlign="Center"> <FilterTemplate> מתאריך <telerik:RadDatePicker ID="FromDate" Culture="he-IL" runat="server" Width="140px" ClientEvents-OnDateSelected="FromDateSelected" MinDate="07-04-1000" MaxDate="05-06-3000" DbSelectedDate='<%# startDate %>'/> <dateinput DateFormat="dd/MM/yyyy"></DateInput> עד תאריך <telerik:RadDatePicker ID="ToDate" Culture="he-IL" runat="server" Width="140px" ClientEvents-OnDateSelected="ToDateSelected" MinDate="07-04-1000" MaxDate="05-06-3000" DbSelectedDate='<%# endDate %>'/> <dateinput DateFormat="dd/MM/yyyy"></DateInput> <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"> <script type="text/javascript"> function FromDateSelected(sender, args) { var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>"); var ToPicker = $find('<%# ((GridItem)Container).FindControl("ToDate").ClientID %>'); var fromDate = FormatSelectedDate(sender); var toDate = FormatSelectedDate(ToPicker); if (toDate != '') { tableView.filter("Date", fromDate + " " + toDate, "Between"); } } function ToDateSelected(sender, args) { var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>"); var FromPicker = $find('<%# ((GridItem)Container).FindControl("FromDate").ClientID %>'); var fromDate = FormatSelectedDate(FromPicker); var toDate = FormatSelectedDate(sender); if (fromDate != '') { tableView.filter("Date", fromDate + " " + toDate, "Between"); } } function FormatSelectedDate(picker) { var date = picker.get_selectedDate(); var dateInput = picker.get_dateInput(); var formattedDate = dateInput.get_dateFormatInfo().FormatDate(date, dateInput.get_displayDateFormat()); return formattedDate; } </script> </telerik:RadScriptBlock> </FilterTemplate> </telerik:GridBoundColumn>code behind cs: if (e.CommandName == RadGrid.FilterCommandName) { Pair filterPair = (Pair)e.CommandArgument; switch (filterPair.Second.ToString()) { case "date": this.startDate = ((e.Item as GridFilteringItem)[filterPair.Second.ToString()].FindControl("FromDate") as RadDatePicker).SelectedDate; this.endDate = ((e.Item as GridFilteringItem)[filterPair.Second.ToString()].FindControl("ToDate") as RadDatePicker).SelectedDate; break; default: break; } }
public class UserControl1 : WebControl { private RadListBox _RlbItemSelect = new RadListBox(); private RadListBox _RlbItemDestination = new RadListBox(); private Panel _ListDiv = new Panel(); private Button _Button = new Button(); private Label _Label1 = new Label(); private Button _Button2 = new Button(); HtmlGenericControl _TestList = new HtmlGenericControl("ul"); HtmlButton _TestButton = new HtmlButton(); void _Button_Click(object sender, EventArgs e) { _Label1.Text = "Postback"; _RlbItemSelect.Items.Add(new RadListBoxItem("This is another item, added after postback")); } protected override void OnInit(EventArgs e) { base.OnInit(e); _Label1.ID = "_Label1"; _Label1.Text = "Initial Load"; _Button.Text = "RefreshPage"; _Button.ID = "_Button"; _Button.Click += _Button_Click; this.Page.Form.Controls.Add(_Button); this._ListDiv.Controls.Add(_Label1); this.Controls.Add(_ListDiv); this._ListDiv.Controls.Add(new LiteralControl("<br/><br/><span id style=\"text-align:left;\">Title</span><br/>")); this._RlbItemSelect.ID = "_RlbItemSelect"; this._RlbItemSelect.Height = Unit.Pixel(200); this._RlbItemSelect.Width = Unit.Pixel(800); this._RlbItemSelect.AllowTransfer = true; this._RlbItemSelect.AllowReorder = false; this._RlbItemSelect.AllowTransferOnDoubleClick = true; this._RlbItemSelect.TransferToID = "_RlbItemDestination"; this._RlbItemSelect.ButtonSettings.Position = ListBoxButtonPosition.Bottom; this._RlbItemSelect.ButtonSettings.HorizontalAlign = ListBoxHorizontalAlign.Center; this._RlbItemSelect.ButtonSettings.RenderButtonText = true; this._RlbItemSelect.CssClass += " PopDualListHgSelect"; this._RlbItemDestination.ClientIDMode = System.Web.UI.ClientIDMode.Static; this._RlbItemDestination.ID = "_RlbItemDestination"; this._RlbItemDestination.Height = Unit.Pixel(200); this._RlbItemDestination.Width = Unit.Pixel(800); this._RlbItemDestination.EmptyMessage = "Must choose at least one gateway pop"; this._RlbItemDestination.CheckBoxes = true; this._RlbItemDestination.CssClass += " PopDualListHgDestination"; this._RlbItemDestination.SelectionMode = ListBoxSelectionMode.Single; this._RlbItemDestination.OnClientItemChecking = "singleSelectionInHgDestLb"; this._RlbItemDestination.PersistClientChanges = true; this._RlbItemDestination.EnableViewState = true; this._ListDiv.Controls.Add(this._RlbItemSelect); this._ListDiv.Controls.Add(new LiteralControl("<br/>")); this._ListDiv.Controls.Add(this._RlbItemDestination); this._ListDiv.Controls.Add(new LiteralControl("<br/>")); if (!Page.IsPostBack) { _RlbItemSelect.Items.Add(new RadListBoxItem("This is item 1")); _RlbItemSelect.Items.Add(new RadListBoxItem("This is item 2")); _RlbItemSelect.Items.Add(new RadListBoxItem("This is item 3")); _RlbItemSelect.Items.Add(new RadListBoxItem("This is item 4")); } Page.ClientScript.RegisterClientScriptInclude("scripts/listBox.js", "scripts/listBox.js"); } }function singleSelectionInHgDestLb(sender, args) { var item = args.get_item(); var lb = item.get_listBox(); lb.trackChanges(); var items = sender.get_items(); var checked = item.get_checked(); var ele = $(item.get_element()); if (checked == false) { clearChecks(items); ele.closest(".rlbItem").find("label").SetHgSpanText(true); } else { ele.closest(".rlbItem").find("label").SetHgSpanText(false); } lb.commitChanges();}function clearChecks(items) { items.forEach(function (itm) { itm.set_checked(false); var ele = $(itm.get_element()); ele.closest(".rlbItem").find("label").SetHgSpanText(false); });}(function ($) { $.fn.SetHgSpanText = function (isPrimary) { var setText = "SECONDARY"; var color = "blue"; if (isPrimary) { setText = "PRIMARY"; color = "red"; } if ($(this).find(".hgInd").length) { $(this).find(".hgInd").text("(" + setText + ") "); $(this).find(".hgInd").attr("style", "color: " + color + "; font-size: 8pt"); } else { $(this).find(".rlbCheck").after("<span class='hgInd' style='color: " + color + "; font-size: 8pt' class='rlbSpan'>(" + setText + ") </span>"); } $(this).find(".rlbText").removeAttr("style"); };})(jQuery);$(function () { $("#main").on("DOMNodeInserted", ".PopDualListHgDestination .rlbList", function (e) { if ($(e.target).is(".rlbItem")) { var checked = $(e.target).find(".rlbCheck[checked='checked']").length > 0; $(e.target).find("label").SetHgSpanText(checked); } });});////This cleanup does method not work//$(function () {// $("#main").on("DOMNodeInserted", ".PopDualListHgSelect .rlbList", function (e) {// if ($(e.target).is(".rlbItem")) {// $(e.target).find(".hgInd").remove();// $(e.target).find(".rlbText").removeAttr("style");// }// });//});$(document).ready(function () { $("#main").find(".PopDualListHgDestination .rlbCheck[checked='checked']").closest("label").SetHgSpanText(true); $("#main").find(".PopDualListHgDestination .rlbCheck[checked!='checked']").closest("label").SetHgSpanText(false);});