Calendarextender is not displayed with masterpages - asp.net

I'm working with masterpages and after reading a lot of answers I can't find why my calendarextender doesn't appear
Here is my code
http://pastebin.com/m789f935e

did you check the setting in the webconfig file . do you have all the required settings for ajax . ?

Have you tried changing the TagPrefix in the
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
directive to something other than asp? Not sure how well referencing more than one assembly for a single TagPrefix is supported.
The info here and here sort of backs me up...sort of. Give it a shot and let us know how it goes.

I see you have more than one ScriptManager tag... one in the Master page and one in your VerFavoritos.aspx page. I suggest you add one ScriptManager in the Master, place it right after the tag and before anything else in the Master page. Remove any ScriptManager tags from the VerFavoritos.aspx page.
Hope this helps.

Do you have the AJAX Control Toolkit .dll in your References?
The entry in the web.config you are looking for is something along this line:
<add assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagPrefix="AjaxControlToolkit"/>
When this happens you can use the calendar extender with syntax like:
<AjaxControlToolkit:CalendarExtender ... />

Rebor.
My application have a page that displays a ModalPopUp (the modal pop up pf ajax toolkit).
Inside the PopUp i put a calendarExtender, but the calendar appears behind the PopUp, so, to solve it i need to associate my Calendar to a CSS, like this:
<cc1:CalendarExtender ID="txtProximoContato_CalendarExtender" runat="server" PopupButtonID="imgCalendarProxContato"
Enabled="True" CssClass="CalendarPopup" TargetControlID="txtProximoContato">
</cc1:CalendarExtender>
and the CSS class
.CalendarPopup
{
z-index: 10500 !important;
}
I dont know if it is your problem, but i hope this help you

To be honest the Ajax Control Toolkit has been superceded by things like jQuery. Seriously consider using jQuery UI or extjs instead - I've always found this library to buggy and badly supported.

I copied/pasted your code almost exactly as it was and the calendar extender appeared.
Follow these steps exactly and it should work for you
Uninstall and reinstall AJAX 1.0.
From within VS 2005, create an "AJAX Enabled Website" instead of a regular website (VS 2008 automatically creates this type of website).
Add a reference to AjaxControlToolkit and it should work.
If you are still having trouble
Send me your solution. I'll correct it and send it back to you.

Related

ASP.Net Page Template and using asp tag in rendered pages

I want to use page templating in ASP.Net (Visual Studio 2012 with .Net 4.0).
The base page emits the basic template inclusive of the body, html, form, and other tags. That means the rendered pages just have what goes inside the body part. The template adds the header and footer. Although I have not finalized a design, I am looking at a concept documented here. (Yes, I know that coding practice is to not give links to pages, which can go away, but I do not want to side track the question.)
The part of each page is:
<%# Page language="c#" Codebehind="AdvancedPageInheritance.aspx.cs" AutoEventWireup="true" Inherits="PageInheritanceSample.AdvancedPageInheritance" %>
Anything after that first line is part of the body.
If I drag and drop controls onto the form, VS2012 emits code such as:
<asp:CheckBox ID="CheckBox2" runat="server" OnCheckedChanged="CheckBox1_CheckedChanged" />
<asp:Button ID="Button2" runat="server" Text="Button" />
VS2012 automagically emits the warning, "Unrecognized tag prefix or device filter 'asp'."
One thought is to simply add in the body stuff programatically, but that is a page. I rather use the GUI.
How can I avoid the warning? Is there a better way to do templates? That author wrote the article 10-years ago, so things might have changed since then. The warnings are understandable, but in error, as there is a form, body, and html tags, just not directly visible.
(I just answered my question by catching a phrase in Vs2012 and researching it a bit. Master Pages are the answer. Obviously, Microsoft must have added that with either VS2008 or VS2010. I will leave this post, as others, like me, may not know the concept "Master Page" and may reserach page templates, just like I did. I hope that this post says other people time. Google should hopefully pick up on ASP.Net and Page Templates.)
Ideally you would use the MasterPage for laying out your main template.
Your Content pages would then have the appropriate <asp:Content /> controls, where you add your content. To add a content page you would add a new 'Web Form' item in Visual Studio and, by selecting the 'Select Master Page' checkbox, you can choose the master page the content page should use.
See Here for a tutorial on Master Pages
Then you would use a BasePage for site-wide code; for example anything that has logic needed on most pages. Your Content pages would inherit this BasePage
As a side-note, see this page Unrecognized tag prefix or device filter 'asp' in VS2012 with regards to your "Unrecognized tag prefix or device filter 'asp'." message

trying to disable the telerik editor control in asp

I was thinking to do this server side, but what i was wanting to do was disable the telerik control called the "Editor." Located at the site: telerick editor control.
My reasoning behind this was that I wanted to give a user the exact look and feel of the object while having everything disabled. I didnt want to use an image at all because it would be stretched, shrank, clicked, etc and wanted to maintain how the editor would look. I had an alternate option i COULD do but not only it would be ineffecient, but have holes to open up for injection.
Looking through the API for that i didnt see which way to accomplish that.
I was thinking to do jquery maybe on the client side to disable, but why do that when you can set the item itself be flagged as disabled and never be entirely sent to the client.
Thoughts? Ideas? How would you go about it? I didnt see methods or attributes that really led to what i was doing.
You can just set enabled="false" on the radEditor declaration in your aspx page:
http://www.telerik.com/help/aspnet-ajax/editor-disabling-radeditor.html
<telerik:RadEditor runat="server" ID="RadEditor1" Enabled="false">
<Content>
<strong>sample content</strong>
</Content>
</telerik:RadEditor>
On the Server Side you can do
RadEditor1.Enabled = false;
In jquery,
try
$("#RadEditor1").prop('disabled', true);

Html helpers (from asp.net mvc) in webpages

Is it possible to use MVC Helpers in webpages (cshtml) ?
I'm trying out some controls from infragistics, and would like to use the html helper method to create the grid (avoiding some javascript) but I can't seem to get any intellisense.
No, I'm unsure if it should work?
Update: I want to use the following line:
#Html.Infragistics().Grid(....
inside my MyWebPagesPage.cshtml
Thanks for any help
Larsi
You should be able to, just add
#using infrajistics.namespace
You could also add the namespace to ur web.config namespaces section so that you don't have to add the #using in each view
There are no helper method that would render Infragistics controls. Please take a look at this page, it has detailed instructions of using Infragistics controls in MVC pages.
There are some limitations though. Infragistics doesn't have separate controls for MVC, they are simply making their asp.net controls available, but there's a drawback.
As long as you focus on areas of the controls that do not initiate post backs or rely on ViewState, you soon find many behaviors and functions that work perfectly in an ASP.NET MVC application.
Sample usage would be:
<%# Register Assembly="Infragistics.Web.Mvc" Namespace="Infragistics.Web.Mvc" TagPrefix="cc1" %>
<%# Register Assembly="Infragistics35.Web.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>
<ig:WebDataGrid ID="wdg"
runat="server" Width="50%"
EnableViewState="false">
</ig:WebDataGrid>
No MVC helpers involved.

Error in ScriptResource.axd: "Object of type 'Sys.Extended.UI.AccordionBehavior' cannot be converted to type 'Sys.UI.Behavior'

I have an asp.net web site where I'm trying to resolve what looks like a problem with ASP.NET AJAX:
Microsoft JScript runtime error:
Sys.ArgumentTypeException: Object of
type
'Sys.Extended.UI.AccordionBehavior'
cannot be converted to type
'Sys.UI.Behavior'. Parameter name:
instance
I've googled around a lot, and looked at the code presented (see below, no idea what it means) but no luck.
I've tried changing scriptmanger scriptmode to release, and a bunch of other things too. Anyone have any ideas?
Details:
Visual Studio 2010
ASP.NET 4.0
Ajax control toolkit 4.0
jQuery 1.4.2
jQuery UI 1.8.5
JS Code the error occurs in, inside ScriptResource.axd:
dispose:function()
{
var c=this;
b.UI.Behavior.callBaseMethod(c,eb); --------- this line
var d=c._element;
if(d)
{
var f=c.get_name();
if(f)
d[f]=a;
var e=d._behaviors;
Array.remove(e,c);
if(!e.length)
d._behaviors=a;
delete c._element
}
}
Declaration of accordion control:
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="atlas" %>
(snip)
<atlas:Accordion ID="menu" runat="server" SelectedIndex="0"
ContentCssClass="accordionContent" FadeTransitions="true" FramesPerSecond="30"
TransitionDuration="250" AutoSize="None" Width="270">
</atlas:Accordion>
*Update: *
Added accordion control declaration as requested, is there anything else I can add that could be useful?
Does anyone have any idea about this error at all - am I right in thinking it's MS AJAX not playing nicely with other javascript (probably jQuery UI) on the page?
Are you using update panels on your page at all? If so, remember that once you add controls inside\outside of an update panel, the "scope" of objects included in a postback changes dramatically, as only objects wrapped within an UpdatePanel are included.
If this doesnt help, I apologize, but my experiences with ASP.NET AJAX have added a layer of complexity to the postback model with sites Ive implemented it on.

Register User Control Issue

I have a user control registered at the top of my page:
<%# Register Src="/Controls/User/Navbar.ascx" TagName="Navbar" TagPrefix="pmc" %>
and I reference it in my page like this:
<pmc:Navbar runat="server" id="navbar"></pmc:Navbar>
but it does not know what <pmc:Navbar is. I cannot figure out why.
I'm using VS 2008, in a Web Application Project.
Maybe you should specify the path with ~: ... Src="~/Controls/User/Navbar.ascx" ...
Remove either the initial slash from the path to the control, or better still, prefix it with "~" :
<%# Register Src="Controls/User/Navbar.ascx" TagName="Navbar" TagPrefix="pmc" %>
or
<%# Register Src="~/Controls/User/Navbar.ascx" TagName="Navbar" TagPrefix="pmc" %>
The first solution is flakey as it relies on the page existing in the root folder and the control existing below it. The second is the preferred as it will work from any page in your project.
You should also consider registering your user controls in your web.config, as it keeps things much neater, and tends to avoid path issues a little better.

Resources