or
| protected void btnExport_Click(object sender, ImageClickEventArgs e) |
| { |
| DataTable dtExport = ExecTools.General.GetResCodeTreeExport(Application["ExecData"].ToString()); |
| Telerik.Web.UI.RadGrid ExportGrid = new RadGrid(); |
| ExportGrid.AutoGenerateColumns = true; |
| ExportGrid.DataSource = dtExport; |
| ExportGrid.DataBind(); |
| ExportGrid.ExportSettings.Excel.FileExtension = "xls"; |
| ExportGrid.ExportSettings.FileName = "ResCodes"; |
| ExportGrid.ExportSettings.ExportOnlyData = true; |
| ExportGrid.ExportSettings.IgnorePaging = false; |
| ExportGrid.ExportSettings.OpenInNewWindow = true; |
| ExportGrid.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML; |
| ExportGrid.MasterTableView.ExportToExcel(); |
| } |
one a use the code
RadToolTipManager1.TargetControls.Add(lblLink.ClientID, IDPessoa,
true);
the HyperLink that surround the target object becomes unclicable.
other problem that have is that when i positon the tolltip to be in the topleft of the element it comes out in the wrong position
var
focussedEditor = $find("<%=Radeditor1.ClientID %>");
focussedEditor.setFocus();
Kind of worked but it sets the entire editor into focus and not exclusively the textfield.Property RadDockableObjectCommand is not present in Q2 2008. Is there any equivalent for the same.
To add more details I have the following line of code
RadDockableObjectCommand dockCommand = new RadDockableObjectCommand("Delete", "Delete", "DeleteBtn.gif", true);
| public partial class _Default : System.Web.UI.Page |
| { |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| if (!Page.IsPostBack) |
| { |
| Calendar.SelectedDate = DateTime.Now; |
| } |
| } |
| private void GetDays() |
| { |
| } |
| private void CreateSelectedCollection(Telerik.Web.UI.Calendar.Collections.DateTimeCollection coll, bool rebindgrid) |
| { |
| Dictionary<DateTime, Entry> dict = new Dictionary<DateTime, Entry>(); |
| StringBuilder b = new StringBuilder(); |
| for (int i = 0; i < coll.Count; i++) |
| { |
| dict.Add(coll[i].Date, new Entry(coll[i].Date, true, -1)); |
| b.Append("'"); |
| b.Append(coll[i].Date.ToString("yyyy-MM-dd")); |
| b.Append("'"); |
| if (i != coll.Count - 1) |
| b.Append(","); |
| } |
| checkdates(b.ToString(), dict, rebindgrid); |
| } |
| private void checkdates(string p, Dictionary<DateTime, Entry> dict, bool rebindgrid) |
| { |
| using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["TimesheetConnectionString"].ConnectionString)) |
| { |
| conn.Open(); |
| SqlCommand comm = new SqlCommand("SELECT * FROM tblEntries WHERE Date IN( " + p + " )", conn); |
| SqlDataReader reader = comm.ExecuteReader(); |
| while (reader.Read()) |
| { |
| if (dict.ContainsKey((DateTime)reader["Date"])) |
| { |
| dict[(DateTime)reader["Date"]].From = (DateTime)reader["From_"]; |
| dict[(DateTime)reader["Date"]].To = (DateTime)reader["To_"]; |
| dict[(DateTime)reader["Date"]].IsNewRecord = false; |
| dict[(DateTime)reader["Date"]].ID = int.Parse(reader["ID"].ToString()); |
| } |
| } |
| } |
| grid.DataSource = dict.Values; |
| if (rebindgrid) |
| grid.Rebind(); |
| } |
| protected void update(object source, Telerik.Web.UI.GridCommandEventArgs e) |
| { |
| Hashtable t = new Hashtable(); |
| GridEditableItem editedItem = e.Item as GridEditableItem; |
| e.Item.OwnerTableView.ExtractValuesFromItem(t, editedItem); |
| } |
| protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) |
| { |
| if (e.CommandName == "UpdateAll") |
| { |
| foreach (GridEditableItem editedItem in grid.EditItems) |
| { |
| Hashtable newValues = new Hashtable(); |
| e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem); |
| updateorinsert((string)newValues["To"], (string)newValues["From"], (bool)newValues["IsNewRecord"], (string)newValues["Date"], (string)newValues["ID"]); |
| editedItem.Edit = false; |
| } |
| } |
| grid.Rebind(); |
| } |
| private void updateorinsert(string to, string from, bool isnew, string date, string id) |
| { |
| using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["TimesheetConnectionString"].ConnectionString)) |
| { |
| conn.Open(); |
| if ((isnew)) |
| { |
| SqlCommand comm = new SqlCommand("INSERT INTO tblEntries (Date, To_, From_) VALUES (@Date, @To, @From)", conn); |
| comm.Parameters.AddWithValue("@Date", DateTime.Parse(date).ToString("yyyy-MM-dd")); |
| comm.Parameters.AddWithValue("@To", DateTime.Parse(to).ToString("yyyy-MM-dd HH:mm")); |
| comm.Parameters.AddWithValue("@From", DateTime.Parse(from).ToString("yyyy-MM-dd HH:mm")); |
| int result = comm.ExecuteNonQuery(); |
| } |
| else |
| { |
| SqlCommand comm = new SqlCommand("UPDATE tblEntries SET Date = @Date, To_ = @To, From_ = @From WHERE ID = @Id", conn); |
| comm.Parameters.AddWithValue("@Date", DateTime.Parse(date).ToString("yyyy-MM-dd")); |
| comm.Parameters.AddWithValue("@To", DateTime.Parse(to).ToString("yyyy-MM-dd HH:mm")); |
| comm.Parameters.AddWithValue("@From", DateTime.Parse(from).ToString("yyyy-MM-dd HH:mm")); |
| comm.Parameters.AddWithValue("@Id", int.Parse(id)); |
| int result = comm.ExecuteNonQuery(); |
| } |
| conn.Close(); |
| } |
| } |
| TimeSpan a; |
| protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) |
| { |
| if (e.Item is GridDataItem) |
| { |
| GridDataItem dataItem = e.Item as GridDataItem; |
| TimeSpan tmp; |
| if (TimeSpan.TryParse(dataItem["Span"].Text, out tmp)) |
| a += (tmp); |
| } |
| if (e.Item is GridFooterItem) |
| { |
| GridFooterItem footerItem = e.Item as GridFooterItem; |
| footerItem["Span"].Text = "total: " + a.Hours + " h" + a.Minutes + " m"; |
| } |
| } |
| protected void RadGrid1_PreRender(object sender, System.EventArgs e) |
| { |
| // Force all rows to be in edit mode (rebind is called) |
| foreach (GridItem item in grid.MasterTableView.Items) |
| { |
| if (item is GridEditableItem) |
| { |
| GridEditableItem editableItem = item as GridDataItem; |
| editableItem.Edit = true; |
| } |
| } |
| grid.Rebind(); |
| } |
| /// <summary> |
| /// Needdatasource event handler |
| /// </summary> |
| /// <param name="source"></param> |
| /// <param name="e"></param> |
| protected void need(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
| { |
| CreateSelectedCollection(Calendar.SelectedDates, false); |
| } |
| /// <summary> |
| /// Dateselected event handler |
| /// </summary> |
| /// <param name="sender"></param> |
| /// <param name="e"></param> |
| protected void fire(object sender, SelectedDatesEventArgs e) |
| { |
| CreateSelectedCollection(e.SelectedDates, true); |
| } |
| //protected void save() |
| //{ |
| //} |
| } |
| <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AJAXEnabledWebApplication1._Default" %> |
| <%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml" > |
| <head runat="server"> |
| <title>Untitled Page</title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <asp:ScriptManager ID="ScriptManager1" runat="server" /> |
| <div> |
| <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true"> |
| <ContentTemplate> |
| <telerik:RadCalendar MultiViewColumns="6" AutoPostBack="true" runat="server" ID="Calendar" UseColumnHeadersAsSelectors="false" UseRowHeadersAsSelectors="true" OnSelectionChanged="fire" ShowRowHeaders="true" EnableMultiSelect="true" /> |
| </ContentTemplate> |
| </asp:UpdatePanel> |
| <asp:UpdatePanel runat="server" ChildrenAsTriggers="true"> |
| <ContentTemplate> |
| <telerik:RadGrid Skin="Vista" OnItemDataBound="RadGrid1_ItemDataBound" ShowFooter="true" AllowSorting="true" |
| OnItemCommand="RadGrid1_ItemCommand" OnPreRender="RadGrid1_PreRender" OnNeedDataSource="need" |
| OnUpdateCommand="update" AutoGenerateColumns="false" runat="server" ID="grid" |
| AllowMultiRowEdit="true"> |
| <ExportSettings> |
| <Excel FileExtension="xls" Format="ExcelML" /> |
| <Csv FileExtension="txt" RowDelimiter="NewLine" ColumnDelimiter="semicolon" /> |
| <Pdf Title="Timerapport" Producer="TimeSys" PaperSize="a4" PageTitle="TimeRapport" |
| AllowPrinting="true" AllowCopy="true" AllowAdd="true" FontType="Embed" /> |
| </ExportSettings> |
| <MasterTableView EditMode="inplace" CommandItemDisplay="topAndBottom"> |
| <Columns> |
| <telerik:GridDateTimeColumn DataField="Date" HeaderText="Dato" ReadOnly="false"> |
| </telerik:GridDateTimeColumn> |
| <telerik:GridDateTimeColumn DataField="From" HeaderText="Fra" PickerType="TimePicker"> |
| </telerik:GridDateTimeColumn> |
| <telerik:GridDateTimeColumn DataField="To" HeaderText="Til" PickerType="TimePicker"> |
| </telerik:GridDateTimeColumn> |
| <telerik:GridCheckBoxColumn ReadOnly="false" DataField="IsNewRecord" Visible="false" /> |
| <telerik:GridBoundColumn ReadOnly="false" DataField="ID" Visible="false" /> |
| <telerik:GridBoundColumn ReadOnly="true" DataField="Span" UniqueName="Span" Visible="true" HeaderText="Antall timer" /> |
| <telerik:GridTemplateColumn DataField="TimeSp"> |
| <ItemTemplate> |
| <asp:Literal Text='<%# Eval("TimeSp") %>' runat="server" /> |
| </ItemTemplate> |
| <FooterTemplate> |
| </FooterTemplate> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| <CommandItemTemplate> |
| <asp:Button runat="server" ID="UpdateAll" Text="Update |
| All" CommandName="UpdateAll" /> |
| </CommandItemTemplate> |
| </MasterTableView> |
| </telerik:RadGrid> |
| </ContentTemplate> |
| </asp:UpdatePanel> |
| </div> |
| </form> |
| </body> |
| </html> |