I was trying to use a calendar extender but for some reasons it not working?
Just put a simple TextBox and CalendarExtender, when I click inside the textbox it supposed to be popup the calendar, but I got nothing.
On the other hand, I tried the ConfirmButtonExteder and it work fine.
I don't know if something wrong, maybe I missing something in web.config? but why the ConfirmButtonExtender works?
I use VS 2012, ASP.NET C#, .NET Framework 4.5, Ajax toolkit 4.1.7.725 (latest one from official website) then Install the Ajaxtoolkit it from Nuget (version 4.5...) but still samething, the calendar is not popup, the confirmbuttonextender works just fine. I dont know why?
Here my code:
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="MainContent">
<p>
<ajaxToolkit:ToolkitScriptManager runat="server" ID="ScriptManager1" /
<asp:Button ID="Button1" runat="server" Text="Button" />
<ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="Button1"></ajaxToolkit:ConfirmButtonExtender>
<br />
<asp:TextBox runat="server" ID="Date1"/>
<br />
<ajaxToolkit:CalendarExtender ID="defaultCalendarExtender" runat="server" TargetControlID="Date1" />
</p>
</asp:Content>
Here's what you can do:
Check that AjaxControlToolkit.dll and AjaxControlToolkit.pdb are in your Bin Folder.
Place the assembly
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> above the page.
Make sure the ScriptManager is below the BodyContent of ContentPlaceHolder
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
Double-Check the TagPrefix and the TargetControlID of the CalendarExtender
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1">
Related
I am using HtmlEditorExtendor in my project but it says :
HtmlEditorExtender is not a know element .
I've Tried : Link 1
But nothing seems to work for me .
I've added all references but still it's not working .
Here is my code :
Assemble after page directive before the asp:Content :
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
Here is the code for script manager and htmlEditorExtendor :
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:TextBox ID="txt_description" runat="server" Width="100%" Height="250" />
<asp:HtmlEditorExtender ID="HtmlEditorExtender1" runat="server" TargetControlID="txt_description" EnableSanitization="false">
</asp:HtmlEditorExtender>
The same page has asp:UpdatePanel which is working fine but asp:HtmlEditorExtender is not working .
Kindly help.Thanks
It has been removed since version 15.1. You can just use the normal ScriptManager.
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
Source
<%# Control Language="C#" AutoEventWireup="true" CodeFile="UploadVideo.ascx.cs" Inherits="Controls_UploadVideo" %>
<h4>Select a video file to upload:</h4>
<asp:UpdatePanel ID="UpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:FileUpload id="fuUploadVideo"
runat="server">
</asp:FileUpload>
<br /><br />
<asp:Button id="btnUploadVideo"
Text="Upload file"
OnClick="btnUploadVideo_Click"
runat="server">
</asp:Button>
<hr />
<asp:Label id="UploadStatusLabel"
runat="server">
</asp:Label>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnUploadVideo" />
</Triggers>
If use the file upload control to select a video file then clicking the file upload button does not resolve a webpage. Everything is being run on my local machine.
If no file is selected then it goes to the website I expect. Does anyone know why this might be the case?
So far I'm aware, standard FileUpload doesn't work inside an UpdatePanel. You could use AsyncFileUpload control instead.
There's a lenghty post about this and indeed a FileUpload doesn't work inside an UpdatePanel. There are workarounds, and Claudio's solution will probably be the most easy for your situation.
I need help how to fix the error in my code. When I compile the code told me the error Validation (XHTML 1.0 Transitional): Element 'html' cannot be nested within element 'div'. If someone know, please help me?
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ManageUsers.aspx.cs" Inherits="probazaadmin.ManageUsers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form2" runat="server"></form>
<div>Users Account Management</div>
<p></p>
<b>- The total registered users is: <asp:Literal runat="server" ID="lblTotalUsers" /><br />
- The total online users at this moment: <asp:Literal runat="server" ID="lblOnlineUsers" /></b>
<p></p>
In order to display all users whose name begins with letter click on the link letter:
<p></p>
<asp:Repeater runat="server" ID="rptAlphabetBar"
OnItemCommand="rptAlphabetBar_ItemCommand">
<ItemTemplate><asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Container.DataItem %>'
CommandArgument='<%# Container.DataItem %>' />
</ItemTemplate>
</asp:Repeater>
<p></p>
Use the below feature to search users by partial username or e-mail:
<p></p>
<asp:DropDownList runat="server" ID="ddlUserSearchTypes">
<asp:ListItem Text="UserName" Selected="true" />
<asp:ListItem Text="E-mail" />
</asp:DropDownList>
contains
<asp:TextBox runat="server" ID="txtSearchText" />
<asp:Button runat="server" ID="btnSearch" Text="Search"
OnClick="btnSearch_Click" />
</body></html>
</asp:Content>
Your code shows you are:
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master"....
using a master page (which is where the HTML declaration is)
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
using the content page placeholder to add and entire HTML document - which you shouldn't do.
as stated, the master page is where HTML declarations go
ASP.net content sections are for content only.
Your code should be like this
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ManageUsers.aspx.cs" Inherits="probazaadmin.ManageUsers" %>
Users Account Management
- The total registered users is:
- The total online users at this moment:
In order to display all users whose name begins with letter click on the link letter:
<asp:Repeater runat="server" ID="rptAlphabetBar"
OnItemCommand="rptAlphabetBar_ItemCommand">
<ItemTemplate><asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Container.DataItem %>'
CommandArgument='<%# Container.DataItem %>' />
</ItemTemplate>
</asp:Repeater>
<p></p>
Use the below feature to search users by partial username or e-mail:
<p></p>
<asp:DropDownList runat="server" ID="ddlUserSearchTypes">
<asp:ListItem Text="UserName" Selected="true" />
<asp:ListItem Text="E-mail" />
</asp:DropDownList>
contains
<asp:TextBox runat="server" ID="txtSearchText" />
<asp:Button runat="server" ID="btnSearch" Text="Search"
OnClick="btnSearch_Click" />
</asp:Content>
Hi all I have an update panel that works lovely in my test solution but when I put it into the main project it does not work correctly.
I've made it very simple, but still no joy, it consists of:
the file upload control
a link button
the link button has an onclick method that takes the file and creates a byte array. For some reason the contentLength is -2 every time. It does not matter what type of file I am using. Every time!
This is very frustrating considering it works fine in my test solution.
Is there anything I am missing or should be looking at?
Thanks :)
EDIT:
I am using VS2008
CODE:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
</head>
<body>
<form id="form1" runat="server">
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:LinkButton ID="btnUpload" runat="server" ValidationGroup="uploadform" CssClass="uploadbutton" OnClick="btnUpload_Click">Upload</asp:LinkButton>
</form>
</body>
</html>
C#
protected void btnUpload_Click(object sender, EventArgs e)
{
var intDoccumentLength = FileUpload1.PostedFile.ContentLength;
// will crash here as content length is -2 for some reason~???
byte[] newDocument = new byte[intDoccumentLength];
}
Your test code must be doing complete postback which is not the case for Updatepanel part as part of main project. With updatepanel, file may not have been uploaded at point of time when you are checking its contentlenght; this is not true for complete postback where file always gets uploaded first. In this case, it will always through you an error. This can only be done using an ActiveX control of some kind.
This article may give you nice hint and direction: asp.net FileUpload event after choice is made and before submit for upload
The file up loader is not working well in the update panel so if you are using the update panel then you have to use the triggers in the update panel and you have to give the name of the control or button on which you are clicking to upload the file
<%# Page Language="C#" MasterPageFile="~/FullViewMasterPage.master" AutoEventWireup="true" CodeFile="Test1.aspx.cs" Inherits="Test1" Title="Untitled Page" %>
<%# Register TagPrefix="yaf" Namespace="YAF" Assembly="YAF" %>
<%# Register TagPrefix="yc" Namespace="YAF.Controls" Assembly="YAF" %>
<asp:Content ID="Content1" ContentPlaceHolderID="FullViewContentPlaceHolder" Runat="Server">
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:FileUpload id="fileUpload" runat="server" ></asp:FileUpload>
<asp:Button ID="Upload" runat="server" OnClick="Upload_Click" Text="Upload The Image" /><br />
</ContentTemplate>
</asp:UpdatePanel>
<br />
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Upload" EventName="Upload_Click" />
</Triggers>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:Label ID="lblTime3" runat="server" /><br />
</ContentTemplate>
</asp:UpdatePanel>
</form>
</asp:Content>
<code>
As FileUpload.PostedFile.InputStream.Length returns the same as FileUpload.PostedFile.ContentLength, did you check that your file size is lower than maxRequestLength (4MB by default) or specified in web.config :
<system.web>
<httpRuntime maxRequestLength="8192"/>
</system.web>
See : http://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.maxrequestlength.aspx
So, i'm new to ASP.NET and AJAX.
I am trying out the Beta library.
I setup a page and was using the Editor.
The loading of this page is well, slow.
There is nothing more than then, you can see it here
http://eski.internet.is/default.aspx but it will take a min to load.
Whats is the reason for the slow load, is it the AJAX library ?
Its about 7 mb, the .dll's. Is it downloading it everytime you load the page ?
No, it doesn't load the whole 7mb worth of .dlls - that's the code that generates the output.
For that site I'm getting this from YSlow:
HTTP Requests - 46
Total Weight - 304.9K
1 HTML/Text 121.9K
4 JavaScript File 161.7K
3 Stylesheet File 6.4K
38 Image 14.7K
Which isn't that much. It did seem to take a LONG time for the host to respond, however. What are the specs on your server and its internet connection?
In your web.config do you have debug="true"? If so, take that out as it can cause pages to take longer as it then generates debug information.
It doesn't seem to be hanging on any one component being served to the client. It seems to be either server load or something in your code. Can you provide the code that you are using to better help diagnose this?
This is the code that website http://eski.internet.is/default.aspx
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit.HTMLEditor" tagprefix="cc1" %>
<!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">
<div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" ScriptMode="Release"></asp:ToolkitScriptManager>
</div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:DropShadowExtender ID="TextBox1_DropShadowExtender" runat="server"
Enabled="True" TargetControlID="TextBox1">
</asp:DropShadowExtender>
<asp:CalendarExtender ID="TextBox1_CalendarExtender" runat="server"
Enabled="True" TargetControlID="TextBox1">
</asp:CalendarExtender>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="To Editor" />
<br />
<br />
<cc1:Editor ID="Editor1" runat="server" Width="500" />
<br />
<asp:Button ID="Button2" runat="server" Text="To Textbox"
onclick="Button2_Click" />
<br />
<br />
<asp:TextBox ID="TextBox2" runat="server" Height="161px" TextMode="MultiLine"
Width="600px"></asp:TextBox>
</form>
</body>
</html>