CKEditor disappears on partial postback - ckeditor

I have a page that shows a ckeditor in an update panel. My page is as follows:
<form id="form1" runat="server">
<cc1:ToolkitScriptManager runat="server" ID="ToolkitScriptManager" EnablePartialRendering="true"></cc1:ToolkitScriptManager>
<div>
<asp:Label ID="Label1" runat="server" Text="Hello"></asp:Label><br />
<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<script src="../../../../../ckeditor/ckeditor.js" type="text/javascript"></script>
<asp:TextBox class="ckeditor" ID="tbEditorHeader" runat="server" ClientIDMode="Static" TextMode="MultiLine" Columns="80" Rows="4"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
Has anyone seen this issue? Any known solutions?
Thanks for the help!!

Related

Updatepanel wont call the control event method

I have a web page that has a masterpage. It has two drop downs. On Selected index chagne of dropdown1, I am calling the dropdown1_selectedindex changed. But nothing happens when I change the selection in the first drop down. I have placed the script manager in the master page. Update panel in the control page. The update panel encloses both the drop downs. Pelase help me. I am a starter and I thought this will be pretty straight forward. What am I missing here?
This is the .aspx
<%# Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.master" CodeBehind="Emailer.aspx.cs" Inherits="ServiceAlertEmailerGUI.Emailer" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<%-- <h2>
Welcome to ASP.NET!
</h2>--%>
<%-- <p>
To learn more about ASP.NET visit www.asp.net.
</p>--%>
<%-- <p>
You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&clcid=0x409"
title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>.
</p>--%>
<script type="text/javascript">
function HandleIT() {
alert("called");
}
</script>
<asp:Label ID="Label1" runat="server" Text="Status:"></asp:Label>
<asp:RadioButton ID="RadioButton1" Text="New Alert" GroupName="Status" runat="server" />
<asp:Label ID="Label2" runat="server" Text="Select Application: "></asp:Label>
<asp:UpdatePanel runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="ddApplicationList" runat="server"
OnSelectedIndexChanged="ddApplicationList_SelectedIndexChanged">
</asp:DropDownList>
<br />
<asp:RadioButton ID="RadioButton2" GroupName="Status" Text="Update" runat="server" />
<asp:Label ID="Label3" runat="server" Text="Select Service: "></asp:Label>
<asp:DropDownList ID="ddServcieList" runat="server" >
</asp:DropDownList>
</ContentTemplate>
<%--
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddApplicationList" EventName="ddApplicationList_SelectedIndexChanged" />
</Triggers>
--%>
</asp:UpdatePanel>
<br />
<asp:RadioButton ID="RadioButton3" GroupName="Status" Text="Resolved" runat="server" /><br />
<asp:RadioButton ID="RadioButton4" GroupName="Status" Text="Resolved (No Email)" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Build Template" Width="144px" />
<br />
<asp:RadioButton ID="RadioButton5" GroupName="Status" Text="Root Cause" runat="server" /><br />
<br />
</asp:Content>
Here is master page
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="ServiceAlertEmailerGUI.SiteMaster" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<title></title>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form runat="server">
<asp:ScriptManager ID="AjaxManager" EnablePageMethods ="true" EnablePartialRendering = "true" runat="server">
</asp:ScriptManager>
<div class="page">
<div class="header">
<div class="title">
<h1>
Service Alert Emailer
</h1>
</div>
<%-- <div class="loginDisplay">
<asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
<AnonymousTemplate>
[ Log In ]
</AnonymousTemplate>
<LoggedInTemplate>
Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>!
[ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/"/> ]
</LoggedInTemplate>
</asp:LoginView>
</div>--%>
<div class="clear hideSkiplink">
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
<Items>
<asp:MenuItem NavigateUrl="~/Default.aspx" Text="Emailer"/>
<%--<asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/>--%>
</Items>
</asp:Menu>
</div>
</div>
<div class="main">
<asp:ContentPlaceHolder ID="MainContent" runat="server"/>
</div>
<div class="clear">
</div>
</div>
<div class="footer">
</div>
</form>
</body>
</html>
Thanks guys for trying to help.
I figured out the mistake in the trigger. In the trigger, eventname should be the event name SelectedIndexChanged rather that ddApplicationList_SelectedIndexChanged.
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddApplicationList" EventName = "SelectedIndexChanged"/>
</Triggers>
sorry I lost the other link that gave me this answer.

I converted a website to VB2012 from 2012 Now I get this error Server tag not well formed

I have been trying to reopen the source, rebind the source with no avail.
<form id="form1" runat="server">
<div>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="FindAll" TypeName="REPORT SYNTAX" OldValuesParameterFormatString="original_{0}">
<SelectParameters>
<asp:Parameter Name="match" Type="Object" />
</SelectParameters>
</asp:ObjectDataSource>
<rsweb:reportviewer width="1200" id="ReportViewer" runat="server" font-names="Verdana".
font-size="8pt" interactivedeviceinfos="(Collection)"
waitmessagefont-names="Verdana" waitmessagefont-size="14pt">
<localreport reportpath=".\Reports\REPORT SYNTAX.rdlc">
<%--<DataSources>
<rsweb:ReportDataSource Name="DummyDataSource" DataSourceId="ObjectDataSource1"></rsweb:ReportDataSource>
</DataSources>--%>
</localreport>
</rsweb:reportviewer>
</div>
</form>

JQuery Validate - DropDown

I'm using the JQuery Validate plugin to validate my form. I'm able to validate text boxes but not DropDown. Can someone let me know how to validate dropdown?
<asp:FormView ID="fv_LeaveRequest" runat="server" DataKeyNames="REQ_ACTION_ID">
<InsertItemTemplate>
<label>Leave Type</label>
<asp:DropDownList ID="ddl_LeaveType" runat="server">
</asp:DropDownList>
<label>Leave Date</label>
<asp:TextBox ID="tb_leaveDate" runat="server" CssClass="date"></asp:TextBox>
<asp:Button ID="LeaveReqBtn" runat="server" Text="Submit Leave Request" CommandName="CustomInsert"
CssClass="button-position" />
</InsertItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="Edit" runat="server" Text="Edit / Change Request" CommandName="Edit" CssClass="button-position btn-padding" />
<label>Leave Type</label>
<asp:DropDownList ID="ddl_LeaveType" runat="server">
</asp:DropDownList>
<label>Leave Date</label>
<asp:TextBox ID="tb_leaveDate" runat="server" CssClass="date"></asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:LinkButton ID="Cancel" Text="Cancel" CommandName="Cancel" runat="server" CssClass="button-position btn-padding" />
<label>Leave Type</label>
<asp:DropDownList ID="ddl_LeaveType" runat="server">
</asp:DropDownList>
<label>Leave Date</label>
<asp:TextBox ID="tb_leaveDate" runat="server" CssClass="date"></asp:TextBox>
</EditItemTemplate>
$("#form1").validate({
rules: {
LeaveType: "required",
LeaveDate: "required"
},
messages: {
LeaveType: "Select a value from DropDown",
LeaveDate: "This field is required"
}
});

ASP.NET validation not working inside ASP FormView

The ASP.NET validation does not seem to work inside ASP:FormView. Can someone let me know what I'm doing wrong? Thank you.
Here is the code.
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="ValidationSummary1" />
<asp:FormView ID="fv_LeaveRequest" runat="server" DataKeyNames="REQ_ACTION_ID">
<InsertItemTemplate>
<label>Leave Type</label>
<asp:DropDownList ID="ddl_LeaveType" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="This field is required" ValidationGroup="ValidationSummary1" Text="Required" ControlToValidate="ddl_LeaveType"></asp:RequiredFieldValidator>
<asp:Button ID="LeaveReqBtn" runat="server" Text="Submit Leave Request" CommandName="CustomInsert"
CssClass="button-position" ValidationGroup="ValidationSummary1" CausesValidation="true" />
</InsertItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="Edit" runat="server" Text="Edit / Change Request" CommandName="Edit" CssClass="button-position btn-padding" ValidationGroup="ValidationSummary1" />
<label>
Leave Type</label>
<asp:DropDownList ID="ddl_LeaveType" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="This field is required"
ValidationGroup="ValidationSummary1" Text="Required" ControlToValidate="ddl_LeaveType"></asp:RequiredFieldValidator>
</ItemTemplate>
<EditItemTemplate>
<asp:LinkButton ID="Cancel" Text="Cancel" CommandName="Cancel" runat="server" CssClass="button-position btn-padding"
ValidationGroup="ValidationSummary1" />
<label>
Leave Type</label>
<asp:DropDownList ID="ddl_LeaveType" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="This field is required"
ValidationGroup="ValidationSummary1" Text="Required" ControlToValidate="ddl_LeaveType"></asp:RequiredFieldValidator>
</EditItemTemplate>
</asp:FormView>
You need to add one attribute for Initial Value to your RequiredFieldValidators. When you're using a RequiredFieldValidator with a DropDownList, you need to add InitialValue="0".

Question about AJAX Update Panel

Here is the problem im having. I have 5 buttons on my form that appear next to each other (horizontal). 3 out of the 5 buttons had to be put in an update panel b/c these buttons have to do AsyncPostBack, the other 2 buttons need to be outside to do a postback. Everything works the way I would like accept that all the buttons dont appear on the same line. Is there anything I can do put get these 5 buttons to appear on the same line, given the different functionality of these buttons?
The UpdatePanel renders a <div> you need to style this div so that that it displays inline Notice the Style="display:inline" in the following code. There's other ways to accomplish this depending on your layout but this is the most straightforward.
<asp:UpdatePanel ID="UpdatePanel1" runat="server" Style="display:inline">
<ContentTemplate>
<asp:Label ID="labelText" runat="server" Text="Label" />
<asp:Button ID="Button1" runat="server" Text="Button1" />
<asp:Button ID="Button2" runat="server" Text="Button2" />
<asp:Button ID="Button3" runat="server" Text="Button3" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="Button4" runat="server" Text="Button4" />
<asp:Button ID="Button5" runat="server" Text="Button5" />
You don't have to have your buttons inside the UpdatePanel to make this work. You would simply need to define them as AsyncPostBackTriggers. You don't have to worry about breaking your layout then.
<div class="toolbar">
<asp:Button ID="Button1" runat="server" Text="Button1" />
<asp:Button ID="Button2" runat="server" Text="Button2" />
<asp:Button ID="Button3" runat="server" Text="Button3" />
</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="labelText" runat="server" Text="Label" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="Button3" EventName="Click" />
</Triggers>
</asp:UpdatePanel>

Resources