Ajax control toolkit editor is not showing correctly - c#

i am new in asp.net and i am working on the thing where i had to add HTML Editor Extender (Ajax Toolkit). but it does not appear correctly.
Click [here] (http://s24.postimg.org/56f3vdv0l/error.png)!
I used this code...-->
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<cc1:Editor ID="Editor1" runat="server" width="600px" Height="200px"/>
<asp:Button ID="Button1" runat="server" Text="Submit" onclick="Button1_Click" /><br/><br/>
<asp:Label ID="Label1" runat="server"
Text=""></asp:Label>
</div>
</form>

After a lot of searching, I found my solution to the same problem... use this:
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager>
instead of:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
Good luck!
This would allow use of the Editor control, rather than extending the Textbox (which I actually like that method as well).

hi please check the htmlEditorExtender sample from ajax control site.
you need to assign it to a textbox so that it will be extended to a Realtime HTML Editor.
you need to assign toolbar properties to the html extender control.
hope this helps

Related

UpdatePanel working only in debug mode

The update panel control is not working in normal mode i.e. when i am browsing it without debugging while in debug mode it is working absolutely fine.
My code is as follows-
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:Timer runat="server" id="Timer1" Interval="5000"></asp:Timer>
<%-- web content here --%>
</ContentTemplate>
</asp:UpdatePanel>
Please suggest for working of the above in normal mode without debugging.
Thanks in advance.
`<head runat="server">
<title></title>
<meta http-equiv="refresh" content="10" />
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<%-- web content here --%>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
in .cs page i used
protected void Page_Load(object sender, EventArgs e)
{
UpdatePanel1.Update();
}`
i used simple meta tag in under the tag in desing page, its working fine for refresh page
The META tag will refresh the entire page, before calling the Page_Load method.
I also noticed that updatepanels stopped working for me too, after .NET4.5. Maybe its a bug in the framework, or maybe something is blocking it. Its even worse when you are using bootstrap with your project. As UpdatePanels are script driven, some hidden bootstrap script may be interfering with it.
So, if its not too much trouble, you could wire up all ur events using jQuery, and where you need to make server calls, you can use ajax to call a project-hosted webservice. This way, your page doesn't load at all, unless u want it to.

Why does using file upload in a user control with ajax update panel not work?

I'm trying to create a user control for upload and download attachment in my web application.
In my user control, i'm using asp.net update panel for upload and download files, and i use my user control in a <dive>...</dive> tag that display style is none.
Everywhere when i using this user control, i'm trying to set <dive>...</dive> tag display style to show user control, and i'm using below code for display this user control in modal popup mode :
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server" CancelControlID="CancelButton" DropShadow="true" PopupControlID="PanelMain" PopupDragHandleControlID="PanelHeader" TargetControlID="btnFileOperation" />
In my user control i write the same below code:
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:FileUpload ID="fileUploadImage" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Upload Image" OnClick="btnUpload2_Click" />
<br />
<asp:Label ID="lblMessage" runat="server" Text="Image uploaded successfully." Visible="false"></asp:Label><br />
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
Please wait image is getting uploaded....
</ProgressTemplate>
</asp:UpdateProgress>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnUpload" />
</Triggers>
</asp:UpdatePanel>
But when i want access to FileUpload.PostedFile or FileUpload.HasFile properties in code(click event of upload button), these properties are null.
What could be the reason for this problem? and How to fix it?
I spent hours on this very problem, and finally found the answer on a five-year-old asp.net forum post: UpdatePanel + FileUpload + PostBackTrigger doesn't seem to work. To boil it down, on my site.master page the <form> tag had simply been:
<form id="Form1" runat="server">
The post from 2007 suggested changing it to:
<form id="Form1" method="post" enctype="multipart/form-data" runat="server">
Works great! I don't understand why, but it does.
The bulk of the answers I found all over the net -- including several on StackOverflow -- suggested simply creating a postback trigger for the update panel. None of the variations of that worked for me. About five minutes before quitting time, I found this obscure page on the asp.net forums. One of the best feelings is getting a problem solved right before it's time to go home.
I hope this helps you.

In IE11,IE10 Page postbacks occur when button is clicked

In my code on running from local Postback did not occur on button trigger click,but when i run through production url and click button complete Postback occurs.How to handle page postback in IE11,IE10.In all the other browsers it works fine with no postback of page.I googled ut did not get the solution for IE.
keep your all controls into update panel
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</form>

Pop-up with radiobuttons

I have a registration page where i have a register button and when it is clicked i have to get a pop up with radio buttons like parent and child.How to do this without javascript?I am using c# and asp.net.
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True"
Visible="False">
<asp:ListItem>parent</asp:ListItem>
<asp:ListItem>child</asp:ListItem>
</asp:RadioButtonList>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<cc1:ModalPopupExtender ID="RadioButtonList1_ModalPopupExtender" runat="server" PopupControlID="form1"
DynamicServicePath="" Enabled="True" TargetControlID="Button1">
</cc1:ModalPopupExtender>
</div>
</form>
</body>
Easiest way to do this is using JQuery. I suggest you to give it a try.
You could just submit what the user has done so far, and direct to a different page with those radio buttons.
Or make a link to pop-up a new window to the radio buttons perhaps.
Or use css hoveron effect to mimic a popup block, thought this doesn't work like buttons.

Button in update panel is doing a full postback?

I'm following a simple example of how to use the update panel from here (http://www.asp.net/Ajax/Documentation/Live/tutorials/IntroductionUpdatePanel.aspx). Outside the update panel i've another html input control which calls a javascript function which displays an count to the user in an alert box. simple stuff. My problem is that the page behaves differently when running on IIS and on the inbuilt asp.net web server (cassini). Under IIS clicking the button within the update panel causes a full postback and so the count displayed to the user in the js function gets reset after that eachtime. under the inbuilt web server hitting the button inside the update panel behaves how i would expect it to and how i want it to in that it refreshes the label only so that the counter on the client side isn't reset.
.net 3.5 is the target framework and I'm running IIS 5.1.
I've seen posts elsewhere describing the same problem (http://forums.asp.net/t/1169282.aspx)
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
var count=0;
function incrementCounter()
{
count ++;
alert(count);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Panel Created"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
<input type="button" id="Button2" value="JS Clicker" onclick="incrementCounter();" />
</form>
</body>
</html>
Update:
Thanks Crossbrowser for your answer. My reply will take up to much room in the Add Comment window. Ok, so following this simple example here (http://www.asp.net/Ajax/Documentation/Live/tutorials/IntroductionUpdatePanel.aspx) you can see that the update mode is not set to conditional so I've reflected those changes. However my problem still persists. That is that the page when running on IIS causes a full postback. i.e. the progress bar in you browser loads, the screen flickers, client side count that i was maintaining is lost. Running the code on the inbuilt asp.net webserver does not. That is the crux of my problem. I've come across this problem by others (http://forums.asp.net/t/1169282.aspx).
So my question is what is different when running on IIS compared to the inbuilt asp.net one?
Updated Code:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
var count=0;
function incrementCounter()
{
count ++;
alert(count);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Panel Created"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
<input type="button" id="Button2" value="JS Clicker" onclick="incrementCounter();" />
</form>
</body>
</html>
Since you are using the .NET Framework 3.5 I will assume you are using Visual Studio 2008, and you say you are targeting IIS 5.1 for the production platform.
The local web server that is part of Visual Studio 2008 is based off of IIS 6/7 architecture, not IIS 5. So, to answer your question of what is different with IIS compared to the local web server... unfortunately, in this case, you are mixing apples and oranges.
Are you restricted to IIS 5.1?... ie client mandate or some other reason. If you are not, and you are developing with Visual Studio 2008 (.NET Framework 3.5) you really should be using IIS7 (or at least 6) as you would most likely not have this problem.
Again, IIS7 may not be an option for you.
Have you tried using a trigger? e.g.
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Panel Created"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Panel Refresh" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Label1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
Since your UpdatePanel's UpdateMode is set to conditional you have to specify a trigger.
Alternatively, you could define the property ChildrenAsTriggers to true.
UpdatePanel.UpdateMode reference
In IIS Manager, check the "Pages and Controls" settings for your site.
Specifically, the View State and Settings sections. Those look like they could affect how your page interacts with the server and when.
Did you try using the <asp:Button runat="server"> element instead of the HTML <input> element?

Categories

Resources