IEWC Treeview refreshing to top of page on click - c#

I am using an IEWC webcontrol in ASPX/C# page and whenever a treeview element is clicked, it will refresh to the top of the page. Is there any way to stop this?
It now works fine in IE with the addition of Autopostback and Viewstate set to True. Just not in Chrome.
(Note: I am well aware that IE web controls were never meant to work 100% outside IE)

This was fixed by adding in a piece of jQUery that searches for the element's parent ID and removes the HREF on the nodes.
Alternatively, you can set a session parameter that remembers the scrollX and re-set this on page load

Related

asp FileUpload in content page not working due to updatepanel in master page

I have a master page where an update panel contains the main placeholder of the content pages.
Inside one of the content pages I need to disable the update panel in any way since I have a form with asp:fileupload control that is always returning null due to the update panel.
How can I overcome this issue?
Place your fileuploader and submit button in another update panel and add a post back trigger for this update panel.
On page load of content page, try to get the update panel of master page using FindControl method and then attach your file upload as a post pack trigger to it dynamically.
That may work
I've got a bad news for you.!
Have a look at this
http://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx
The following ASP.NET controls are not compatible with partial-page updates, and are therefore not supported inside an UpdatePanel control:
TreeView and Menu controls.
Web Parts controls. For more information, see ASP.NET Web Parts Controls.
FileUpload controls when they are used to upload files as part of an asynchronous postback.
GridView and DetailsView controls when their EnableSortingAndPagingCallbacks property is set to true. The default is false.
Login, PasswordRecovery, ChangePassword, and CreateUserWizard controls
whose contents have not been converted to editable templates.
The Substitution control.
Validation controls, which includes the BaseCompareValidator, BaseValidator, CompareValidator, CustomValidator, RangeValidator, RegularExpressionValidator, RequiredFieldValidator, and ValidationSummary control.
Solution :
You may want to use Ajax FileUpload using Jquery in place of update Panel. Remember, Open source is always a better option. :)

Maintaining Scroll Position and Selected Control on Postback

Back with another web based issue.
When a control issues a postback to the server the page refreshes (Fine). The page also scrolls back to the top and loses the control that is selected. If it's relevent after the postback depending on what changes have happened controls are made visible or made hidden. The focus is lost and current scroll resets even if nothing is changed on the page visibility wise. The data inputted in Text fields is kept and so are any radiobutton/checkbox selections. The problem is tabbing is reset to index 0 and the pages scroll is sent back to the top of the page.
I am using .Net 4.0
I have tried adding MaintainScrollPositionOnPostback="true" both on the asp page itself and in the web.config to no avail.
I have tried with and without the Ajax updatepanel using conditional updating triggering off when textboxes text is changed or radiobuttons are changed and the postback still causes a scroll and index loss.
Any ides would be fantastic. Ta!
First of all, the MaintainScrollPositionOnPostback="true" has a known bug in asp.net 2.0, see here.
Also, the correct syntax is maintainScrollPositionOnPostback. (lowercase m)
I used the maintainScrollPositionOnPostback but have many problems in IE, then I use the asp.net AJAX Control Toolkit UpdatePanel, it solves the problem (the page don't scroll to the top) and save some bandwidth.
EDIT:
I think I understand your problem, it's mantain the focus on the element, it can be done using some javascripts workarounds, se here.
Hope that helps.

Enabling ViewStateMode doesn't work for the child controls of a child control

I am working on .net 4.0 application. I am trying to load a bunch of custom controls that has a "gridview" control along with several text boxes and dropdowns. As the viewstate is really slowing down the system in order to improve the performance I Disabled the ViewStateMode of the parent control (i.e User control) and Enabled the ViewStateMode for dropdowns. But the problem I have is the dropdowns inside the gridview and panel thrw an error even though their ViewStateMode is Enabled. If I Enable the ViewStateMode of gridView or Panel it works fine but that's increasing the size of Viewstate.
Can somebody please make me understand why it is happening and what is the solution for this?
Thanks
BB
If you are getting tons of viewstate.Then I would suggest you two ways that worked for me too
Compress Viewstate - http://www.codeproject.com/KB/viewstate/ViewStateCompression.aspx, http://www.hanselman.com/blog/ZippingCompressingViewStateInASPNET.aspx
Trace the layout of the rendering area in html, using div , ul, li wahtever. Now instead of placing grids and other server controls, get the datasource(datatable or dataset), itereate through the items and make the html in the codebehind and write the final html tag on page using a literal. using html controls you can get rid of the view state issues. Also on that html tag you can apply jquery to make it better too.

Check box with autopostback = "true" inside of repeater, inside of UpdatePanel pops page back to top when clicked

I have an UpdatePanel that contains a repeater that basically builds a list of checkboxes. Those check boxes are set to AutoPostback with an "OnCheckedChanged" event.
When the user checks a checkbox, everything happens as expected except for one thing, the page pops (or scrolls) back to the top.
Other controls that cause this UpdatePanel to refresh don't cause this issue, even just plain checkboxes that ARE NOT inside of my repeater, but still within the UpdatePAnel, work fine (no scroll back to top)...
Any ideas?
open your page in designview (Source) at the top you will find pagedirectives
try adding MaintainScrollPositionOnPostback="true"
hope it helps !!!

UpdatePanel with UploadFile control doesnt work well

I've three images. I use javascript to mark which one is selected. After user clicks on one I change its class to active. its <li><a>. Now when I wasn't using updatepanel after form post I could see from code behind which element is active and it was correct. After adding updatePanel which contains entire form after postback which should refresh content of updatePanel value is wrong and active is always set to default first <a>. Whats more in this updatePanel there is UploadFile control which doesn't work well because it always has HasFile value to false even though I choose file.
Thanks You for any hints
Your form must be a full postback. You have to add a Trigger for the Full postback, if your FileUpload control is in the update panel.
Alternatively if you want to upload Asynchronously , you could try AJAX AsyncFileUpload control
http://asp.net-informations.com/ajax/ajax-AsyncFileUpload.htm
This is a well known problem, please take a look into the following article:
http://geekswithblogs.net/ranganh/archive/2008/04/01/file-upload-in-updatepanel-asp.net-ajax.aspx

Categories

Resources