or
GridEditableItem object
EditManger Property: The current EditFormType does not support the requested editing capabilities.| <telerik:RadGrid ID="TestimonialsGrid" runat="server" Skin="WebBlue" OnDataBound="TestimonialsGrid_DataBound" |
| OnNeedDataSource="TestimonialsGrid_NeedDataSource" AutoGenerateColumns="false" |
| ShowStatusBar="true" oninsertcommand="TestimonialsGrid_InsertCommand"> |
| <MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" PagerStyle-AlwaysVisible="true" |
| DataKeyNames="Testimonial_ID" EditMode="PopUp"> |
| <CommandItemSettings ShowAddNewRecordButton="true" AddNewRecordText="Add A New Testimonial" /> |
| <RowIndicatorColumn Visible="True"> |
| </RowIndicatorColumn> |
| <Columns> |
| <telerik:GridBoundColumn DataField="Testimonial_ID" Display="false" HeaderText="ID"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Testimonial_Name" Display="true" HeaderText="Name" |
| Groupable="true"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Testimonial_Email" Display="true" HeaderText="Email" |
| Groupable="true"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Testimonial_Text" Display="true" HeaderText="Text" |
| Groupable="true"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Testimonial_Approved" Display="true" HeaderText="Approved" |
| Groupable="true"> |
| </telerik:GridBoundColumn> |
| <telerik:GridDateTimeColumn DataField="Testimonial_CreateDate" Display="true" HeaderText="Create Date" |
| Groupable="true"> |
| </telerik:GridDateTimeColumn> |
| </Columns> |
| <EditFormSettings EditFormType="Template"> |
| <PopUpSettings Modal="True"></PopUpSettings> |
| <FormTemplate> |
| <table id="Table1" cellspacing="1" cellpadding="1" width="250" border="0"> |
| <tr> |
| <td align="right" valign="top"> |
| </td> |
| <td> |
| <asp:ValidationSummary ID="valSumTestimonial" runat="server" DisplayMode="BulletList" |
| HeaderText="Please correct the following error(s): " ShowSummary="false" ShowMessageBox="true" /> |
| </td> |
| </tr> |
| <tr> |
| <td align="right" valign="top"> |
| <asp:RequiredFieldValidator ID="reqValName" runat="server" ErrorMessage="Display Name is required." |
| Text="*" ControlToValidate="txtDisplayName" InitialValue="" SetFocusOnError="false" |
| Display="Dynamic"></asp:RequiredFieldValidator>Display Name: |
| </td> |
| <td> |
| <telerik:RadTextBox ID="txtDisplayName" runat="server" Text='<%# Bind( "Testimonial_Name") %>' |
| TextMode="MultiLine" Rows="3" Columns="50" MaxLength="500" EmptyMessage="(What you place will be displayed as the name) \\r\\n \r\n Suggestion: Name, company name and position, city, state."> |
| </telerik:RadTextBox> |
| </td> |
| </tr> |
| <tr> |
| <td align="right" valign="top"> |
| <asp:RequiredFieldValidator ID="reqValEmail" runat="server" ErrorMessage="Email is required." |
| Text="*" ControlToValidate="txtEmailAddress" InitialValue="" Display="Dynamic"></asp:RequiredFieldValidator><asp:RegularExpressionValidator |
| ID="regValEmail" runat="server" ErrorMessage="Email is in an incorrect format." |
| Text="*" ControlToValidate="txtEmailAddress" Display="dynamic" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>Email: |
| </td> |
| <td> |
| <telerik:RadTextBox ID="txtEmailAddress" runat="server" Text='<%# Bind( "Testimonial_Email") %>' |
| MaxLength="500" Width="315px" EmptyMessage="(Email is NOT shared or displayed on the website)"> |
| </telerik:RadTextBox> |
| </td> |
| </tr> |
| <tr> |
| <td align="right" valign="top"> |
| <asp:RequiredFieldValidator ID="reqValTestimonial" runat="server" ErrorMessage="Testimonial Message is required." |
| Text="*" ControlToValidate="txtTestimonial" InitialValue="" SetFocusOnError="false" |
| Display="Dynamic"></asp:RequiredFieldValidator>Testimonial: |
| </td> |
| <td> |
| <telerik:RadTextBox ID="txtTestimonial" runat="server" Text='<%# Bind( "Testimonial_Text") %>' |
| TextMode="MultiLine" Rows="10" Columns="50" MaxLength="500" EmptyMessage="Type Your Testimonial Here!"> |
| </telerik:RadTextBox> |
| </td> |
| </tr> |
| <tr> |
| <td align="right" valign="top"> |
| </td> |
| <td> |
| <telerik:RadCaptcha ID="RadCaptcha1" runat="server" Display="Dynamic" ProtectionMode="InvisibleTextBox"> |
| </telerik:RadCaptcha> |
| </td> |
| </tr> |
| </table> |
| <table style="width: 100%"> |
| <tr> |
| <td align="right" colspan="2"> |
| <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' |
| runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'> |
| </asp:Button> |
| <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" |
| CommandName="Cancel"></asp:Button> |
| </td> |
| </tr> |
| </table> |
| </FormTemplate> |
| </EditFormSettings> |
| <PagerStyle AlwaysVisible="True"></PagerStyle> |
| </MasterTableView> |
| <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True"> |
| <Selecting AllowRowSelect="True"></Selecting> |
| <Resizing AllowRowResize="True" AllowColumnResize="True" EnableRealTimeResize="True" |
| ResizeGridOnColumnResize="False"></Resizing> |
| </ClientSettings> |
| <GroupingSettings ShowUnGroupButton="true" /> |
| <PagerStyle Mode="NextPrevAndNumeric" Position="TopAndBottom" /> |
| </telerik:RadGrid> |
| private SQL oSQL = new SQL(); |
| private string gridMessage = null; |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| } |
| protected void TestimonialsGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
| { |
| LoadTestimonialsGrid(); |
| } |
| private void LoadTestimonialsGrid() |
| { |
| oSQL = Testimonial.GetAllTestimonials(); |
| TestimonialsGrid.DataSource = oSQL.SQL_DataReader; |
| } |
| protected void TestimonialsGrid_DataBound(object sender, EventArgs e) |
| { |
| oSQL.CloseConnection(); |
| //if (!string.IsNullOrEmpty(gridMessage)) |
| //{ |
| DisplayMessage(gridMessage); |
| //} |
| } |
| private void SetMessage(string message) |
| { |
| gridMessage = message; |
| } |
| private void DisplayMessage(string text) |
| { |
| TestimonialsGrid.Controls.Add(new LiteralControl(string.Format("<span style='color:red'>{0}</span>", text))); |
| } |
| protected void TestimonialsGrid_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) |
| { |
| if (e.CommandName == RadGrid.PerformInsertCommandName) |
| { |
| SetMessage("New Testimonial Added!"); |
| GridEditableItem editedItem = e.Item as GridEditableItem; |
| GridEditFormInsertItem e2 = e.Item as GridEditFormInsertItem; |
| GridEditFormItem e3 = e.Item as GridEditFormItem; |
| //Insert new values |
| Testimonial oTestimonial = new Testimonial(); |
| TextBox tb = e2.FindControl("txtDisplayName") as TextBox; |
| TextBox tb2 = e3.FindControl("txtDisplayName") as TextBox; |
| TextBox tb3 = e.Item.FindControl("txtDisplayName") as TextBox; |
| //TextBox tb4 = e2["Testimonial_Name"].Controls[0] as TextBox; |
| oTestimonial.Display_Name = (editedItem.FindControl("txtDisplayName") as TextBox).Text; |
| //oTestimonial.Email_Address = (editedItem.FindControl("txtEmailAddress") as TextBox).Text; |
| //oTestimonial.Message = (editedItem.FindControl("txtTestimonial") as TextBox).Text; |
| //oTestimonial.Approved = "N"; |
| //oTestimonial.Create_Date = DateTime.Now; |
| //oTestimonial.InsertTestimonial(); |
| } |
| } |
| <telerik:RadTextBox ID="txtDisplayName" runat="server" Text='<%# Bind( "Testimonial_Name") %>' TextMode="MultiLine" Rows="3" Columns="50" MaxLength="500" EmptyMessage="(What you place will be displayed as the name) \r\n Suggestion: Name, company name and position, city, state."> |
| </telerik:RadTextBox> |
| AND THIS |
| <telerik:RadTextBox ID="txtDisplayName" runat="server" Text='<%# Bind( "Testimonial_Name") %>' TextMode="MultiLine" Rows="3" Columns="50" MaxLength="500" EmptyMessage="(What you place will be displayed as the name) \\r\\n Suggestion: Name, company name and position, city, state."> |
| </telerik:RadTextBox> |
| <telerik:RadChart ID="RadChart1" runat="server" DataSourceID="gridDataSource1" Height="405px" |
| Width="243px"> |
| <Appearance Dimensions-Paddings="1px, 1px, 10px, 1px" BarWidthPercent="100"> |
| </Appearance> |
| <Series> |
| <telerik:ChartSeries DataYColumn="y1" Name="y1"> |
| <Appearance BarWidthPercent="100" ExplodePercent="0"> |
| <FillStyle FillType="Solid" GammaCorrection="False"> |
| </FillStyle> |
| <TextAppearance TextProperties-Font="Verdana, 7pt, style=Bold"> |
| </TextAppearance> |
| </Appearance> |
| </telerik:ChartSeries> |
| <telerik:ChartSeries DataYColumn="y2" Name="y2"> |
| <Appearance BarWidthPercent="100" ExplodePercent="0"> |
| <FillStyle FillType="Solid" GammaCorrection="False"> |
| </FillStyle> |
| <TextAppearance TextProperties-Font="Verdana, 7pt, style=Bold"> |
| </TextAppearance> |
| </Appearance> |
| </telerik:ChartSeries> |
| <telerik:ChartSeries DataYColumn="y3" Name="y3"> |
| <Appearance BarWidthPercent="100" ExplodePercent="0"> |
| <FillStyle FillType="Solid" GammaCorrection="False"> |
| </FillStyle> |
| <TextAppearance TextProperties-Font="Verdana, 7pt, style=Bold"> |
| </TextAppearance> |
| </Appearance> |
| </telerik:ChartSeries> |
| <telerik:ChartSeries DataYColumn="y4" Name="y4"> |
| <Appearance BarWidthPercent="100" ExplodePercent="0"> |
| <FillStyle FillType="Solid" GammaCorrection="False"> |
| </FillStyle> |
| <TextAppearance TextProperties-Font="Verdana, 7pt, style=Bold"> |
| </TextAppearance> |
| </Appearance> |
| </telerik:ChartSeries> |
| <telerik:ChartSeries DataYColumn="y5" Name="y5" YAxisType="Secondary"> |
| <Appearance BarWidthPercent="100" ExplodePercent="0"> |
| <FillStyle FillType="Solid" GammaCorrection="False"> |
| </FillStyle> |
| <TextAppearance TextProperties-Font="Verdana, 7pt, style=Bold"> |
| </TextAppearance> |
| </Appearance> |
| </telerik:ChartSeries> |
| </Series> |
| <Legend> |
| <Appearance Overflow="Auto" Position-AlignedPosition="Top"> |
| <ItemTextAppearance TextProperties-Font="Verdana, 7pt" |
| Position-AlignedPosition="Top"> |
| </ItemTextAppearance> |
| </Appearance> |
| </Legend> |
| <PlotArea> |
| <XAxis AutoScale="False" AutoShrink="False" LayoutMode="Normal" MaxItemsCount="1" |
| MaxValue="1" MinValue="1" Step="10" Visible="False"> |
| <Appearance MajorTick-Visible="False"> |
| <LabelAppearance Visible="False"> |
| </LabelAppearance> |
| </Appearance> |
| <Items> |
| <telerik:ChartAxisItem Value="1"> |
| </telerik:ChartAxisItem> |
| </Items> |
| </XAxis> |
| <YAxis> |
| <Appearance> |
| <TextAppearance TextProperties-Font="Verdana, 6.25pt"> |
| </TextAppearance> |
| </Appearance> |
| </YAxis> |
| <YAxis2 AxisMode="Extended" IsLogarithmic="True"> |
| <ScaleBreaks Enabled="True"> |
| </ScaleBreaks> |
| <Appearance> |
| <TextAppearance TextProperties-Font="Verdana, 6.25pt"> |
| </TextAppearance> |
| </Appearance> |
| </YAxis2> |
| <Appearance Position-AlignedPosition="Center" Dimensions-AutoSize="False" Dimensions-Height="300pt" |
| Dimensions-Margins="25%, 5%, 25%, 5%" Dimensions-Width="160px" Position-Auto="False" |
| Position-X="35" Position-Y="100"> |
| </Appearance> |
| </PlotArea> |
| <ChartTitle> |
| <TextBlock Text=""> |
| <Appearance TextProperties-Font="Verdana, 10pt"> |
| </Appearance> |
| </TextBlock> |
| </ChartTitle> |
| </telerik:RadChart> |
Is there a way to use the RadAjaxManager and the RadToolTipManager together?
I want to use ajax for inserting and editing the appointments in the scheduler (http://demos.telerik.com/aspnet-ajax/scheduler/examples/outlook2007/defaultcs.aspx)
and the tooltip to show the appointment details (http://demos.telerik.com/aspnet-ajax/scheduler/examples/radtooltip/defaultcs.aspx).
I have both examples up an running. But as far as i try to implement both features, the tooltip doesn't come up.
When i remove the RadAjaxManager the tooltips works fine.
| ..... |
| <div> |
| <script type="text/javascript"> |
| //<![CDATA[ |
| function hideActiveToolTip() { |
| var tooltip = Telerik.Web.UI.RadToolTip.getCurrent(); |
| if (tooltip) { |
| tooltip.hide(); |
| } |
| } |
| Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequestHandler); |
| function beginRequestHandler(sender, args) { |
| var prm = Sys.WebForms.PageRequestManager.getInstance(); |
| if (args.get_postBackElement().id.indexOf('RadScheduler1') != -1) { |
| hideActiveToolTip(); |
| } |
| } |
| function clientBeforeShow(sender, eventArgs) { |
| w = $telerik.$(window).width() / 2; |
| h = $telerik.$(window).height() / 2; |
| if ((sender._mouseX > w) && (sender._mouseY > h)) { |
| sender.set_position(Telerik.Web.UI.ToolTipPosition.TopLeft); |
| return; |
| } |
| if ((sender._mouseX < w) && (sender._mouseY > h)) { |
| sender.set_position(Telerik.Web.UI.ToolTipPosition.TopRight); |
| return; |
| } |
| if ((sender._mouseX > w) && (sender._mouseY < h)) { |
| sender.set_position(Telerik.Web.UI.ToolTipPosition.BottomLeft); |
| return; |
| } |
| sender.set_position(Telerik.Web.UI.ToolTipPosition.BottomRight); |
| } |
| //]]> |
| </script> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> |
| <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"> |
| <ajaxsettings> |
| <telerik:AjaxSetting AjaxControlID="Panel1"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </ajaxsettings> |
| </telerik:RadAjaxManager> |
| <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" Skin="Office2007" /> |
| <asp:Panel ID="Panel1" runat="server"> |
| <telerik:RadScheduler ID="RadScheduler1" runat="server" Culture="German (Germany)" |
| DataEndField="End" DataKeyField="ID" DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID" |
| DataSourceID="ObjectDataSourceAppointments" DataStartField="Start" DataSubjectField="Subject" |
| HoursPanelTimeFormat="Htt" ShowFooter="False" Skin="Office2007" StartInFullTime="True" |
| StartInsertingInAdvancedForm="True" ValidationGroup="RadScheduler1" SelectedView="MonthView" |
| ShowFullTime="True" CustomAttributeNames="Inhaber" EnableCustomAttributeEditing="True" |
| TimeZoneOffset="01:00:00" WorkDayEndTime="20:00:00" WorkDayStartTime="07:00:00" |
| Width="900px" FirstDayOfWeek="Monday" LastDayOfWeek="Sunday" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound" |
| OnAppointmentCreated="RadScheduler1_AppointmentCreated" OnDataBound="RadScheduler1_DataBound"> |
| <multidayview userselectable="false" /> |
| <timelineview userselectable="false" /> |
| <resourcetypes> |
| <telerik:ResourceType DataSourceID="ObjectDataSourceSegments" ForeignKeyField="SegmentID" |
| KeyField="ID" Name="Segment" TextField="SegmentName" /> |
| <telerik:ResourceType DataSourceID="ObjectDataSourceMedientyp" ForeignKeyField="MedientypID" |
| KeyField="ID" Name="Medientyp" TextField="MedientypName" /> |
| </resourcetypes> |
| <localization advancedalldayevent="All day"></localization> |
| <advancedform dateformat="dd.MM.yyyy" timeformat="HH:mm" enablecustomattributeediting="True" |
| modal="True"></advancedform> |
| </telerik:RadScheduler> |
| </asp:Panel> |
| <asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional"> |
| <ContentTemplate> |
| <telerik:RadToolTipManager runat="server" ID="RadToolTipManager1" Width="320" Height="210" |
| Animation="None" HideEvent="LeaveToolTip" Text="Loading..." RelativeTo="Element" |
| OnAjaxUpdate="RadToolTipManager1_AjaxUpdate" OnClientBeforeShow="clientBeforeShow" |
| Skin="Office2007" AutoTooltipify="false" /> |
| </ContentTemplate> |
| </asp:UpdatePanel> |
| ... |
| </div> |
| ... |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| RadScheduler1.AppointmentCreated += RadScheduler1_AppointmentCreated; |
| RadScheduler1.DataBound += RadScheduler1_DataBound; |
| } |
| protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e) |
| { |
| string clientID = e.Appointment.ClientID; |
| RadToolTipManager1.TargetControls.Add(clientID, e.Appointment.ID.ToString(), true); |
| } |
| protected void RadToolTipManager1_AjaxUpdate(object sender, ToolTipUpdateEventArgs e) |
| { |
| int aptId; |
| Appointment apt; |
| if (!int.TryParse(e.Value, out aptId))//The appoitnment is occurrence and FindByID expects a string |
| apt = RadScheduler1.Appointments.FindByID(e.Value); |
| else //The appointment is not occurrence and FindByID expects an int |
| apt = RadScheduler1.Appointments.FindByID(aptId); |
| AppointmentToolTip toolTip = (AppointmentToolTip)LoadControl("~/controls/AppointmentToolTip.ascx"); |
| toolTip.TargetAppointment = apt; |
| e.UpdatePanel.ContentTemplateContainer.Controls.Add(toolTip); |
| } |
| protected void RadScheduler1_DataBound(object sender, EventArgs e) |
| { |
| RadToolTipManager1.TargetControls.Clear(); |
| ScriptManager.RegisterStartupScript(this, typeof(Page), "HideToolTip", "hideActiveToolTip();", true); |
| } |
| } |
| } |