Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all 5678 articles
Browse latest View live

Using ASP.NET AJAX continues to throw the "The Controls collection cannot be modified because the control contains code blocks" error

$
0
0

Hello,

I am using ASP.NET AJAX Control Toolkit with my .Net 4.0 ASP.NET application.  I did everything that was mentioned concerning the installation (downloaded the 4.0 binary ZIP file (v 4.1.7.0123), unblocked it, uncompressed it, and used the AjaxControlToolkit.dll as a project resource and used it to create a new area in my toolbox).  I then dragged a tab control to my page.  The page now has

<%@RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="act" %>

listed near the top of the page and within my body I am defining the tab control simply as

<act:TabContainer ID="TabContainer1" runat="server"> 

    <act:TabPanel ID="TabPanel1" runat="server"   HeaderText="Red Flower">  

            <ContentTemplate> Tab 1 Content  </ContentTemplate> 

   </act:TabPanel> 

</act:TabContainer>

When I try to run my app I get the error "The Controls collection cannot be modified because the control contains code blocks".  I know it is referring to ajax control toolkit becuase it I delete the TabContainer/TabPanel, I don't get the error.  I tried adding another Ajax Control Toolkit item but I got the same error.  Does anyone know why I am getting this error?  I myself am not defining any <% %> code blocks so I have to believe it is in the toolkit API. 

UPDATE: I am running this page as a web form within a master page.  The script manager is in the master.  If I just create a stand-alone page where I register the assembly and add the script manager, it appears to work.  But if I have my page within a master page, it doesn't.

Any clues would be greatly appreciated - Peter


Get HTML Editor propertie

$
0
0

Hi

Following the example from ajax source code, i have setup a custom button to my toolbar and 2 new properties.

property 1 defines if button shows or not ( working ok ) , and property 2 would be a string value. the propertys are defined when adding the control to the form.

How can i get this value from propertie 2 in the javascript code block in the file that i defined for the button?

 

thanks

rui

Does your directory structure matter for Ajax Toolkit to work?

$
0
0

Within the root of directory of my website I have created a Application Folder that I am building my .net application in. I have all my .net folders in my application folder, Bin, App_Code, etc. The Ajax ToolKit is installed in the Bin folder and registered in the web.config file. When I add a ModalPopupExtender or any other ToolKit control on my page .net does recognize it. However when I go to test in a browser the functionality does not work. I have tested the same page code in the root site of another application and it works. Is there something that needs to be done because I do not have the .net folders in the root of the site?

Thanks in advance for your help

AjaxFileUpload bug re-introduced

$
0
0

Hello,  Working with the AJAX tool kit with Visual Studio 2008

I have two issues here, one being a bug that was initially fixed by a quickfix the source code in the July 2012 3.5.60623 release done specifically for VS2008, this was regarding an error "Could not find a part of the path"  received during the file upload process (not the saving process) where the file could not be written to a TEMP folder within a subfolder under the users document and setting folder "_AjaxFileUpload" This error seemed to be fixed upto and including  the Jan 2013 release 3.5.6.123.  However since then and icluding the latest July 2013 release 3.5.7.725 this bug is there again....will this be fixed because I need this to work so I have to use the Jan 2013 release.  I notice there are more events that would prove usefull in the July 2013 release I'd like to take advantage of.

Second issue, with the Jan 2013 release,when the serverside UploadComplete event fires other commands within the event do not execute such as getting the filename from the Event argument and setting a TextBox control "text" property with the filename, in debugging the event I can see the code execute without error but the text property is never set. The clientside UploadComplete event can successfully perform this same operation however there are other things I'd like to do that can only be done serverside.

Thanks Kerry

Load data in Grid

$
0
0

Hello,

I have 1000 records and am showing in the grid. I dont want to do paging, instead I am using scroll bar to show only 10 records and want to load other records on scroll bar pull.

How can I implement using AJAX ?

Search box not working when enter key is pressed

$
0
0

hi

I have a multiline text box to search any string or character. It is working fine when search text is entered without pressing enter key but do show result when an enter key is pressed.

I want that user can search any number of text even after pressing enter button.

CSS changes not kept between PostBacks in AJAX UpdatePanel

$
0
0

Hi,

I have panel in an AJAX UpdatePanel.

I need to change its position by changing its CSS class - this works fine.

However on PostBack panel returns to original position and I need it to stay in position I moved it to.

Notes.

- The Update panel needs to be frequently Posted Back to.
- I am changing the CSS by invoking a JavaScript function with AJAX tool kit 'ScriptAction' tool.
- I don't know JQuery so, if possible any answers not in this would be a big help - thank you.

Thank you

UpdateProgress displays at page load in Firefox

$
0
0

hello,

i am using an UpdatePanel with an UpdateProgress control to display a message if the computing takes more than 3 seconds to respond.  everything works fine in IE v10 and Safari, but for some reason in Firefox, the 3 second message appears at page load before the user does anything on the page.  the code looks like this.

 

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"><Triggers><asp:AsyncPostBackTrigger ControlID="Button1" /></Triggers><ContentTemplate><%-- GridView code --%></ContentTemplate></asp:UpdatePanel><asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"
DisplayAfter="3000" ><ProgressTemplate><div><img src="/Images/spinner.gif" alt="Computing" />Computing</div></ProgressTemplate></asp:UpdateProgress>

 

is there something i can do in ASP.NET (no javascript) to make Firefox work like IE and Safari? 


 


Ajax - timer continue working when pressing F5 althogh we stopped it on page load event

$
0
0

 

Hi,

I have ceheck box when it cfecked on OnCheckedChanged event I set the timer as follow:

_timer.Enabled = true; and when is unchecked _timer.Enabled = false;

In checked mode  i redresh the label with new date time.

When ceheck box  is checked and press f5 the timer working as expected.

But when check box  is unchecked and press f5 the timer continue working instead of stopping

althouh I set _timer.Enabled = false in page load when check box  was  unchecked  .

 

protected void Page_Load(object sender, EventArgs e)         {

 if (Session[STR_IsAutomaticRefreshMode] != null && (bool)Session[STR_IsAutomaticRefreshMode] == false)
  {               
  _timer.Enabled = false;// here

    UpdateTargets();       

      }

        }

 Why? 

The aspx page:

<body>    <form id="form1" runat="server">   <div>       <div class="_chkRefreshModeDiv">      <asp:CheckBox ID="_chkRefreshMode" runat="server"  Text="Automatic Refresh Mode" OnCheckedChanged="OnRefreshNode" Checked="true" AutoPostBack="true"    />            </div>       <asp:HiddenField ID="_hiddenFieldForChkRefreshMode" runat="server" EnableViewState="true"/>     <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>     <asp:Timer ID="_timer" runat="server" ontick="OnTimerTick" Interval="5000" >      </asp:Timer>  <asp:UpdatePanel ID="UpdatePanel1" runat="server">          <ContentTemplate>               <asp:Label ID="_lblTime" runat="server" Text=""></asp:Label>         </ContentTemplate>              <Triggers>                     <asp:AsyncPostBackTrigger ControlID="_timer" EventName="Tick" />   </Triggers>     </asp:UpdatePanel>  </div>    </form> </body>

ReportViewer Borders

$
0
0

I have a reportviewer created in Visual Studio 2010. The toolbar has borders, each control on the toolbar has borders, empty spaces on the toolbars have borders. The report itself when generated has 3 borders before you get to the content. How can I switch all this off? None of the Border controls: BorderStyle=None;InternalBorderStyle=None;ToolBarItemBorderStyle=NotSet (it won't allow accept None), have any effect.

 

asp.net page postbacks when mouse is moved over embedded youtube flash video

$
0
0

Hi All,

I am developing a site in which youtube video’s will be added to asp.net page using the <iframe> HTML code given at youtube.com site. When I run the program, in the web page youtube video is displayed. But the strange thing is when I move mouse over the video display area the page postbacks happens. I am able to find this when I run the program in debug mode.

To exactly reproduce the scenario, I am writing the steps which I have done in my project.

1) In visula studio 2010 > Open asp.net web application project (with c# as language)
2) add some page, say cat.aspx
3) in cat.aspx write the code as below

<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lblVideo" runat="server"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>

4) in cat.aspx.cs, in page_load even write the following line

lblVideo.Text = "<iframe width=\"620\" height=\"349\" src=\"http://www.youtube.com/embed/WoTsE7pbuKg\" frameborder=\"0\" allowfullscreen></iframe>";

5)you can replace the above <iframe string with any other video's <iframe> given by youtube.com, but be sure to set "http:" and escape " with \" as how I have done.(to get <iframe> HTML code for any youtube video, visit www.youtube.com, click on any video or a famous song, below the video a menu "share" will be displayed, click on it, then another option "Embed" will be displayed, click on it, you will be presented with <iframe> code)

6)Now run your web app project, you can see, youtube video is displayed.

7)Now run with break point set in Page_load event, now move mouse over the video display area, you can see for each time the mouse enters the video display area, a postback happens.

8) I have latest flash installed in firefox and InternetExplorer, this problem happens only in firefox and IE, not in chrome. And this problem happens only when we use Updatepanel. I also found that page does not postback (IsPostBack) is false, every time the control hits the codebehind. It is like page is requested for the first time as how we type the url in the address bar and press enter

Many Thanks in advance to anybody who try to help or give solution.

asynchronous postback interfering with button click events

$
0
0

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest is causing a button click event not to fire.

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string enableOnTimeoutScript ="<script type='text/javascript'>Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(" +"function (sender, args) { if (args.get_error()) { ";

                int buttonIndex = 0;

                foreach (Button button in allButtons)
                {
                    enableOnTimeoutScript +=
                        string.Format("var button{0} = document.getElementById('{1}'); " +"if (button{0} != null) button{0}.disabled = true; ", buttonIndex++, button.ClientID);
                }

                enableOnTimeoutScript +=
                    string.Format("var validator0 = document.getElementById('{0}'); " +"if (validator0 != null) {{ validator0.style.visibility = 'visible'; " +"validator0.innerHTML = args.get_error().message; }} ", customValidator.ClientID);

                enableOnTimeoutScript += "args.set_errorHandled(true); } });</script>";

                Literal enableOnTimeoutLiteral = new Literal();
                enableOnTimeoutLiteral.Text = enableOnTimeoutScript;

                panelDocumentNav.Controls.Add(enableOnTimeoutLiteral);
            }
                
            Button saveData = new Button();
            saveData.EnableViewState = true;
            saveData.Click += new EventHandler(dynamicButton_Click);
            saveData.Text = "SAVE";
      }

 <asp:Content ID="contentBody" ContentPlaceHolderID="contentPlaceHolderBody" runat="server"><div style="height: 100%; left: 0px; position: absolute; top: 0px; width: 76%;"></div><asp:Panel ID="panelDocumentNav" runat="server" CssClass="panel" Width="24%" Style="height: 100%;
        position: absolute; right: 0px; top: 0px;"><div class="spacer" style="overflow: auto; height: 100%"><asp:PlaceHolder runat="server" ID="dynamicControls"></asp:PlaceHolder></div><asp:UpdatePanel ID="updatePanelQ" runat="server"><ContentTemplate><div><asp:CustomValidator ID="customValidator" runat="server" CssClass="error" /></div></ContentTemplate></asp:UpdatePanel>


When the page is first loaded and the SAVE button is clicked the dynamicButton_Click event is not fired but a post back occurs b/c the Page_Load method is called but the if (!IsPostBack) is false so code within if statement is not executed.  The page is reloaded.  If I click the button again the dynamicButtonClick event is fired.

If I comment out the code in the if (!IsPostBack) the dynamicButton_Click event is fired on the first click.

Why is the event not being fired on the first click?

IE9 - posting data in AutoCompleteExtender textbox

$
0
0

I have been weird  problem with IE9.  if only my site opened in ie , then no problem, it works fine.  When multiple sites are open in different tabs, My site is asking for ntml authentication while posting data in AutoCompleteExtender textbox. The site is developed in asp.net and has anonymous access enabled in iis. I have tried resting the options, but no use. Anyone have this issue and know how to fix???

ModalPopupExtender on page load of any page in a directory

$
0
0

Hello all,

I have a simple asp.net 2.0 website, I need a desclaimer to be shown in a ModalPopupExtender on the page load of any page loacated in a specific directory in my website. I need this to happen to the user only once during his/her visit to the website.

I have the desclaimer implemented on a button on a test page.

Any help is highly appreciated :)

Thank you

what is differences list of below table in asp.net?

$
0
0

Table t1 = new Table();
DataTable dt = new DataTable();
HtmlTable tbl = new HtmlTable();
Hashtable hash = new Hashtable();


AjaxFileUpload ContextKeys

$
0
0

Are the ContextKeys ever going to become functional?  And will the be editable via javascript before the file is sent for upload?  I see in the sample that ContextKeys is a property but it's not accessible through the AjaxFileUploadEventArgs.  Would also be useful to be able to edit it through Javascript.  For instance, if we want to dynamically append an orderid or if we want to change the file name to something from a dropdownlist that it could be accomplished in script before the file is uploaded. 

Thanks.

AJAX traffic

$
0
0

Is there a way to see how much traffic AJAX makes on a page? I am making a game and wish to know how resourceful my code is. To be specific, for each call ajax makes, for the data it sends and retrieves, the quantity of Bytes (or kB) is added up and displayed on the page.

Now, I am not talking about only the characters in the XML data string - there surely is more data being passed around from browser to server and back that we can't see. 

Hope I explained this well enough.

Upgrade of Ajax Control toolkit causes change in behavior

$
0
0

I just upgraded the AjaxControlToolkit.dll from 4.0.5.0731 to 4.1.7.0725 and noticed an important change of behavior:

Both CompareValidator and MaskedEditValidator are always on! Even if I specified IsValidEmpty=”true”.  If I TAB through a field and not type anything in it, it is treated as if it was typed into, and the validation fails.

Is there a way to make the check optional, as it was in the previous version?

Help most appreciated.

Changing maxJsonLength property in web.config has no effect

$
0
0

I am using an MS Virtual Earth AJAX control to plot custom boundaries on amap in my ASP.Net 3.5 site.  I have a WCF service which I call from ASP.Net to return the points I need to plot.  In one instance, I need to plot ~40,000 points.  

I get the following error any time the amount of points (rows returned from WCF service) I need to plot are over 25,000.

Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

I tried modifying the maxJsonLength property in my web.config to 2147483647 but changing this value has no effect.  No matter what I set the value to, I always get an error when I try to plot more than 25,000 points.  I even tried setting it to "ABC" and my site still worked when my WCF service returned less than 25,000 records.  

I verified that I don't have the maxJsonLength property in my machine.config file.

Below is an excerpt from my web.config file:

<configuration>
      <configSections>
            <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                  <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                              <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
                              <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                              <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                              <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/></sectionGroup></sectionGroup></sectionGroup></configSections><appSettings/>
      <connectionStrings/>
      <system.web.extensions>
            <scripting>
                  <webServices>
                        <jsonSerialization maxJsonLength="2147483647"/>
                  </webServices>
            </scripting>
      </system.web.extensions>

Any idea my changes to the maxJsonLength property aren't being recognized?

Tabcontainer onemand not working

$
0
0

Hello,

I have the latest ajaxtoolkit and in the tabcontainer I have set ondemand=true and in the tabpanel I have set OnDemandMode=once. But the tab container loads all the tabs on page load and loads individual tab agian when a particular tab is clicked.

Can someone help me fix this problem urgently?

Thanks in advance

Viewing all 5678 articles
Browse latest View live


Latest Images