AutoCompleteExtender in EditItemTemplate in DetailsView having issues - c#

I have 2 identical AutoCompleteExtender's - one is in the Insert mode of my DetailsView, which is the default mode, and one is in the Edit mode. There is also another DetailsView, which only shows when a Checkbox is ticked (and the page posts back), which also hides the previous one.
When the mode is Insert, there are no issues at all, even when ticking the checkbox to hide the DetailsView with the AutoCompleteExtender in and show the other one (which has no AJAX controls btw). But when the mode changes to Edit, and the user ticks the checkbox to change to the other details view (with no ajax), I get this error:
Extender control 'autoNom' is not a
registered extender control. Extender
controls must be registered using
RegisterExtenderControl() before
calling RegisterScriptDescriptors().
Parameter name: extenderControl
Any ideas guys?
Thanks

The problem is not with the other DetailsView. Try deleting the extender for the edit mode and and configure it again. Because it looks like there is something with the Ajax config in the edit more. Make sure about the namings.

Related

RequiredFieldValidators stop working after UdpatePanel postback inside UserControl

I have a webforms page with 2 UpdatePanels: udpGrid for a gridview and udpFormViews with a ajaxToolkit:TabContainer surrounding 3 tabs for Insert and Editing records from the grid, and a repeater with it's own item template for editing related data to the main record. The edit tab is invisible on Page_Load. Inside the insert and edit tab resides the same Usercontrol which contains a Formview. the formview is set to insert mode by default but has an insert and edit item template with a footer template for save/update/cancel buttons, and when editing The second instance of the usercontrol gets set to edit mode and loaded and shown. It also contains a footer template containing the insert udpate and cancel commandbuttons to trigger the FormView's native inserting/updating/cancel events. RequiredField valdators on the insert FormView UserControl works fine from start and after inserting, but as soon as i do a postback to show the edit FormView usercontrol or the Repeater on hte 3rd tab (which has no relation to the Usercontrol containing the UserControl) the RequiredFieldValidators on the insert formview stop working at all, and even in code validating it's insert-validationgroup returns valid while the requiredField shows empty text in code.
For some reason the insert FormView UserControl loses it's validation logic completely after any postback but it's own Insert, with or without the second instance of the UserControl present. I don't load or change anything to the insert Formview UserControl and i can keep inserting without breaking the Validation but whenever a postback occurs outside of it it breaks. Even updates on the other UpdatePanel (udpGrid) break it and i have no way to test validation on the insert UserControl clientside or serverside using the RequiredFieldValidators. The Edit UserControl does still fire its validators but besides showing the error text on screen it ignores it and still updates the record, also ignoring server side the edit-validationgroup validation.
Does anyone know what is happening? it seems putting these Formvies in UserControls kind of breaks things while using it plain on other pages causes no issues?
Update: i found out that when the RequiredFieldValidation is broken i can still trigger the errortext by filling and emptying the textbox on the clientside. the problem that the page validation on client side and on server side doesnt work correctly persists
Found out the problem after some extensive digging. I was using ASP:Linkbuttons inside the footer template which didn't do the validation anymore after the UpdatePanel surrouning everything did an update. Even though i used ChildrenAsTriggers="False" on my UpdatePanels it somehow messed up the clientside validation triggers.
I went and moved the buttons into the templates themselves and changed them into ASP:Buttons. I believe i needed the buttons to be Linkbuttons since the normal Buttons wouldn't trigger postbacks with the FormView_ItemUpdating and FormView_ItemInserting events of the Formview in the Footer template, but now that i have dedicated buttons inside the Insert and Edit templates they can be normal Buttons again.
Hope this helps someone out there facing a simular problems.

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.

UpdatePanel does full postback first time

I have a custom control that has an update panel in it. Within the update panel, there are no custom controls, but there are custom controls outside the update panel. All controls have an ID set as do the parents of the controls. Inside the update panel is a repeater that has controls that should trigger an async postback. The update panel has an update mode of conditional and children as triggers is off. The update panel renders standalone divs, not table cells. EnablePartialRendering is on on the script manager.
Each repeater item has numerous textboxes, but two of them have autopostback turned on. Inside the repeater ItemDataBound event, I register the control with the script manager's RegisterAsyncPostBackControl.
If I edit either textbox, it does a callback correctly. But after the first one is edited, if you edit the other one, it does a full postback. It doesn't matter which one is done first. But after it's done its postback, if you edit either of the textboxes, it does callbacks correctly.
I've tried several things like changing the UpdateMode and ChildrenAsTriggers properties to various combinations. Nothing seems to work.
Any suggestions?
A lot of things can cause this, compare UpdatePanel causes full page postback with LinkButton in ListView in UpdatePanel causes full postback.
You'll need to provide more information, e.g. .NET Framework version, IIS version etc. exact ASP.NET markup etc
But since you asked for "Any suggestions?" try looking through these questions

How to program edit button for gridview through codebehind?

I am trying to generate a gridview dynamically through codebehind. So I am making all the columns through code using BoundField and other controls.
Now I am trying to to put a edit button in the gridview sand program that(I made a RowEditing handler). Right now all my code is in the page_load but when I hit the edit button in the gridview I get 2 gridviews back on post back.
So I tried to put a isPostback if statement to stop this but then I just get a error back saying it can't find the handler.
So I am not sure what to do.
Thanks
Depends how you created the control, what version of Visual Studio, and how nested it is.
For example I currently just went backwards a bit in technology.
I'm using 17 gridviews on a page that are all sql server 2000 driven from code behind and i have a dropdown in the grid for even row as well.
vs 2005 2.0 is what i am using.
I'm using a Master Page (which typically will not be a problem from gridviews, but will need ResolveUrl for jquery references)
Getting to your question, I seem to have that problem with .net asking for a handler when i would tend to copy and paste from .aspx html source. I have MultiView/View/FormView etc... so I tried CTYPE etc..., but upon re-doing the edit with being on the aspx page design view, then use properties and the events. Or if it is a link or button on the page then click on it in design view and it should take you there and NOT have a problem with the Handles.
Some of my code for Edit Button
etc.....
THEN in your properties -> Events, look for "RowEditing" and write in a name then put breakpoints in where it is called and you are there really for edit mode...
I only use 2 other events "RowCancelingEdit" and then "RowUpdating"
Thus I click Edit (which everything is readonly), and a postback occurs (eventually i was to be doing grids again with ajax and not have postbacks) then my fields are in edit mode and dropdown shows list from database as well .... I can update or cancel.... either way it ends in back to readonly state with Edit button visible.
Please post some code if you are still having issues with it.

Telerik RadControls RadFormDecorator - Tow Problem About Positioning

i am using asp.net with c# web app in vs 2008
problem 1:
i do not know why Telerik RadControls- RadFormDecorator Moves some controls (such as Buttons or chech boxes) and changes their positioning up or down in my form after viewing in browser...
i put those controls in a cell of a table ... but not help
i had this problem about radajaxmanager and by setting UpdatePanelsRenderMode property to inline problem solved - but here there is no property like that...
what is going on here?
problem2:
i decorated my buttons and chechboxes with radformdecorator (telerik radcontrols) control...
when i click on a checkbox to set it to true or false so my webpage positioning goes to up (like when postback occurs , but this is not postback)
how can i prevent this problem ?
thanks for attention
This happens in some scenarios because of the way RadFormDecorator styles checkboxes - real checkboxes are hidden outside of the viewport. When the decorated checkbox is clicked however, browsers try to focus the real checkbox, hence the "jumping". To avoid that, you should set position:relative to the parent container.

Categories

Resources