AJAXControlToolKit Partial postback not working - asp.net

I thought including ajax control toolkit is a simple thing, but for some odd reason it's not working. It always triggers a full postback from a button inside UpdatePanel.
I am using VS 2015 / asp.net 4.6.1 / Class Library output type. ajaxcontroltoolkit.dll v18.1.1 is added via Nuget. I created a very basic web form page with only an update panel and a label outside of it. Clicking on a button inside update panel always causes a full post, updating the label outside along with it.
Oddly enough, I created a blank Web Site project with the same page and code behind, and it works fine as expected there.
I use browser debugging tool to observe the network output. The site that works appears to have 1 reference to WebResource.axd and 2 references to ScriptResource.axd. Versus the site that doesn't work having only 1 reference to Scriptresource.axd and none to WebResource.axd.
Is there something I missed? Any further techniques I can use to troubleshoot the problem?

One full day of trouble shooting. This setting in web.config prevents ajax control toolkit from performing partial page load.
https://weblogs.asp.net/scottgu/gotcha-don-t-use-xhtmlconformance-mode-legacy-with-asp-net-ajax

Related

ASP.Net asyncfileupload control in JQueryUI modal dialog

We are in the final stages of moving an older web application from the asp.net 2.0 environment to asp.net 4.0. We've got everything ironed out but a file upload implementation.
We use an asyncfileupload control within a JQueryUI modal dialog...which runs well under 2.0 but not under 4.0, the control simply does not fire the UploadedComplete server-side event.
Our testing indicates the same code will run outside of the JQueryUI dialog, but not when in the dialog...so we assume the issue relates to JQueryUI under 4.0.
Seen one or two very old posts suggesting JQuery moves the upload control outside the form element, and thus the control doesn't fire, but that doesn't answer the question as to why our original implementation runs under 2.0 but not 4.0.
Any guidance would be appreciated.
Have you tried setting the right enctype="multipart/form-data" .
Hope these links already answered ,gives you some help
StackOverFlow,
ASPNet-Button-do-PostBack-in-jQuery-Modal-Dialog-Popup

DotNetNuke 7 - Edit page menu not working when adding ajax control to module

I am creating a simple DotNetNuke module and every time I add a control that contains ajax it somehow interferes with the edit page menu. The control in question is one from Syncfusion and it is the numeric textbox.
The page and the menu functionality works well as long as I use the standard Microsoft user controls. For example if I change the ajax numeric textbox for the asp.net or the html one then it works well. As soon as I add the ajax textbox then the edit page menu does not work.
Has anyone else experienced this issue?
Additional information: The Syncfusion control does not require any specific jQuery version.
There is no error logged on the DNN event viewer. I have been trying with FireBug to follow the tracks but it reveals nothing.
I have attached the screenshot to help visualize the issue.
This happens because of jQuery conflicts. The syncfusion controls load their own jQuery library. To avoid issues within your module add a key to the appSettings section of the DNN web config file:
"SFjQueryLoad" value="false"
This will cause the control to use only the jQuery library provided by your DNN website.

AjaxToolkit AsyncFileUpload needs ViewStateMode enabled, how to avoid?

I know this is rather a trivial question but anyhow I want to know if it is solvable.
I have an ASP.NET webform page with a nested masterpage and JavaScript includes. I make extensive use of jQuery and Ajax calls. Once a page is loaded, all communication with the server is done with Ajax calls, so I don't need ViewState enabled, and this is resulting in a reduced HTML output code.
I now have to implement a page where a user can upload a file. So I used the AsyncFileUpload control of AjaxToolkitFileUpload. Once a file is uploaded, I do a Ajax call to the server to request the filename.
It all works fine but I noticed that FireBug found 10 errors per file upload between the OnClientUploadStarted and the OnClientUploadComplete events. The file is uploaded properly and the events on the client side are working too. But I can't ignore the fact that there are errors thrown so I went looking for the problem.
I rebuild the page piece by piece and I found out that this control needs the Viewstate enabled.
However with viewstate=disabled in the page directive the file size is 76.6kb, and with viewstate=enabled the size is 99.2kb.
Again, I know it is trivial and will not affect performance on the site, but it is a nice to know.
- Why does this control needs the viewstate? (I suppose because it actually post the file to a iFrame or something like that?)
- How can I reduce the viewstate and let this control still work properly?
For reducing view state and having this one control work properly, you can use leave view state enabled on your page and set the ViewStateMode to Disabled for the page and then set the ViewStateMode to Enabled for the one control that needs view state. For all other controls they should inherit the setting of the parent by default.

ASP.NET Treeview Control not expanding on click

I having an issue with the ASP.NET Treeview control. I create the treeview just fine but the nodes will not expand or collapse. I see there is a javascript error but it is for line 1 character 0 of the webpage, there is nothing at line 1 character 0.
I am using the ASP:Treeview control in conjunction with the Telerik controls, but I'm not sure if that is an issue.
I saw there was a similar question here but the answer is not pertinent to my site. Has anyone run into this issue before? I've tried searching Google and tried a number of proposed solutions but so far none have worked.
Thank you,
Normally with problems like this it is best to isolate the code which is causing the problem. For example, create a minimal page with no other controls or external JavaScript and see if the problem persists.
It's also useful to use a decent debugger. The latest IE8 actually has a very good Visual Studio-style JavaScript debugger built in - go to your page, hit F12 and the go to the Script tab and click 'Start Debugging' and see where that leads you.
I've seen unhelpful javascript errors when a page does an AJAX postback, an exception occurs on the server, and the client javascript is unable to handle what the server returns. You could ascertain if this is happening by debugging the site, putting a breakpoint on the Page_Load method (or something similar), and see if it gets hit when trying to collapse or expand the TreeView.

controls in code behind

i was working on a vb.net project and i couldn't find some controls in the code-behind file(*.vb). i was wondering is it because i was working in page_load function so controls are not loaded until after page_control event. however i was able to find them with findcontrol function of formview objective.
Controls inside of templates (such as in your FormView, or in a GridView) are not directly accessible in the code behind. You must use FindControl to get access to those controls.
If the controls are declared in the aspx then they're defined in partial class equivalent for your Page class.
This was introduced along with .Net v2.0 so that messing with the designer wouldn't screw up with your code behind file (which caused quite a few problems in some cases).
You can access the controls from your Page Load event. Sometimes IntelliSense plays tricks on you and doesn't suggest the control. Just type it in. It will work. You can close the aspx page and open it again. Sometimes that fixes it. Or just restart Visual Studio if you're annoyed by it.
However, there are a few considerations if you are interested in accessing control data at certain times during the life cycle of the page.
Server controls have their own life cycle that is similar to the Page life cycle, but the order in which the event is triggered for the controls is as follows:
Init and Unload event for a control occurs before the event is raised for the container (bottom-up).
Load event for a control occurs after the event is raised for the container (top-down).
You can find a more detailed explanation of the Page life cycle events on MSDN.
It's hard to tell what exactly the problem is; it would help if you could post some code here.
I do have two guesses/suggestions:
If you have the problem that brentkeller is describing, what usually fixes this completely for me is deleting the aspx.designer.cs file, then right-clicking on the .aspx file and select "Convert to Web Application". This re-creates the designer file.
The control is inside a template like Jason Berkan suggested. If it's in a LoginView, for example, you would use .FindControl("controlId") on the LoginView.
The controls would be part of a partial class in the same solution. Just find all references for your class name.
I occasionally have trouble with adding a control to a page and the Intellisense not recognizing the control. The compiler also seems to not recognize the control and prevents the project from being compiled. It can be very frustrating and I really haven't figured out why.
Sometimes it helps to close the aspx page and its code file, sometimes closing Visual Studio and re-opening it works. Sometimes none of it works and I just try another way to get things done.
I don't know if this is what you're experiencing, but if so, it can definitely make you scratch your head and wonder what is going on.

Resources