Showing posts with label page. Show all posts
Showing posts with label page. Show all posts

Wednesday, March 28, 2012

very weird problem

I have installed lastest ajax and also toolkit too. I created master page and default aspx page, then I put my scriptmanager inside the master page and update panel inside the default page, I didn't choose ajax enable website because I have a hard time to place my existing web.config files, assemblies, connection strings to right place of the enable ajax's web.config file. Maybe I should though, with this error.

I get errors sometimes with all the controls in update panel, is not recognized my html tag, even though my controls are declared, it says it is not, But it builds application suscessfully. I made sure I put this

<%@dotnet.itags.org.RegisterAssembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"Namespace="System.Web.UI"TagPrefix="asp" %>

to my page and also in web.config file under config section also assemblies too. Thing is I think every time I backup my website to my documents, for some reason a while later this happens. I even reset my iis to clear my temp folder of asp.net too. Still. Why this is happening ?

You'll also need an reference to the following assemblies:

- AjaxToolKit.dll
- System.Web.Extensions.dll

You can do this using right click on your project, "Add Reference" and point to this DLL's


On bin folder, I have got these ar, cs, de, es, fr,he,hi,it,ja,ko,nl,pt, ru,tr-TR,zh-CHS, zh_CHT all
thas AjaxControlToolkit.resources.dll in it.
Then AJaxCotrolKit.dll under neat AjaxControlKit.dll.refresh and AjaxControlKit.pdb

Microsoft.Web.UI.WebControls.dll with Microsoft.Web.UI.WebControls.dll.refresh


I have these dll on my bin now, and still problem


I had these dll on program file but not pointing to my project. I am right clicking my project and add references, choosing these dll and adding but it is not showing under my bin folder for some reason, can someone tell me steps to how to add these dlls to my projects.


Is anybody didn't have this problem? I go crazy here with this..


this was nothing to do with ajax, it was copy paste problem..

Very weird error. Ajax controls call default.aspx

I have a few pages in my site... and for some reason, if there's any ajax controls on the page, it calls default.aspx and runs the code every time any aspx page with an ajax control exists on it. Problem is, default.aspx resets my session variables.

Why does Ajax call the default.aspx page code? It only runs the CS file... it doesn't actually show the default.aspx page.

I doubt it calls it. Do you have a component in your site somewhere that's got a url of "/" attached to it somewhere, and that's invoking the default page?


it only seemed to only happen when I have Certain Ajax controls on the page. Note, it only does it with Internet Explorer 6 and 7. Firefox seems to be fine.

For example, I have a collapsible PAnel in each row of a Gridview. That is in an UpdatePanel. When the Gridview is populated (and I have a breakpoint on the default.aspx.cs file), it goes through that code. Well, I set my session variables on that page, so in essence it resets them.

It seems like it does this AFTER the page is loaded, because the labels that show content based on those session variables aren't updated until I go to a new page.

It only does this when I have a collapsible panel in IE. The panel is set to collapsed.


Actually, it appears that AJAX is clearing the Session Variables. I don't know where it's doing this, though.

view problem within cc1:ModalPopupExtender ..

I have a view problem within cc1:ModalPopupExtender .. when I click an asp image button the specified panel located most top-left in a page even I do not use x or y ModalPopupExtender properties

this problem happens only with ie

in firefox everything works fine ..

here is ModalPopupExtender code :

<cc1:ModalPopupExtender ID="ModalPopupExtender3" runat="server"
TargetControlID="submitBuyImgBt"
PopupControlID="Panel1"
BackgroundCssClass="modalBackground"
DropShadow="true"
OkControlID="OkButton"
OnOkScript="onOk()"
CancelControlID="CancelButton" />

any help would be greatly appreciated

why it's position always in top left side of the page ?


what does the css look like for the panel? are you using one?

heres what i always use and it shows up at the center of the screen.

<ajax:ModalPopupExtender ID="mpeEditUserForm" runat="server" TargetControlID="btnEditUser" BackgroundCssClass="modalBackground"
PopupControlID="pnlUserModal" />
<asp:Panel ID="pnlUserModal" runat="server" CssClass="modalPopup" Style="display:none; padding:3px 3px 3px 3px" Width="320px">

css:

.modalBackground
{
background-color:Gray;
filter: alpha(opacity=70);
}
.modalPopup{
background-color:White;
border: solid 3px Gray;
padding: 3px 3px 3px 3px;

font-size:medium;
}


Mezzaluna:

what does the css look like for the panel? are you using one?

heres what i always use and it shows up at the center of the screen.

<ajax:ModalPopupExtender ID="mpeEditUserForm" runat="server" TargetControlID="btnEditUser" BackgroundCssClass="modalBackground"
PopupControlID="pnlUserModal" />
<asp:Panel ID="pnlUserModal" runat="server" CssClass="modalPopup" Style="display:none; padding:3px 3px 3px 3px" Width="320px">

css:

.modalBackground
{
background-color:Gray;
filter: alpha(opacity=70);
}
.modalPopup{
background-color:White;
border: solid 3px Gray;
padding: 3px 3px 3px 3px;

font-size:medium;
}

I have CSS but it's still not working .. but both panel and moalPopupExtender located in a web user control ( .ascx )

does the problem because of this ?

Note that every thing works fine in firefox. however not fine in ie6 or above


Not sure on that then. I always have the opposite problem. I get things to work in IE and they fail in Firefox.


Viewing Source - Javascript error on missing elements

Hello,

I know this is very likely to be my misunderstanding of how ajax works, but any help would be greatly appreciated.

When my page first loads there is a panel that is not visible, inside the UpdatePanel. After a partial postback this panel becomes visible, but when I 'View Source', the outputted code for the panel does not exists, nor the code for its child controls (even though they show on screen). This means when I try to use client-side code for a control in that panel, eg.

var t = window.document.getElementByID(childID);

it cannot be found as the childID doesn't appear in the source.

Any ideas?

Thanks very much.

Simon

This is actually expected... View/Source in the browser only displays the source that was sent down with the original request.

As for your specific issue, make sure you're using the client ID... a common idiom is: $get('<%= MyControl.ClientID %>'). $get() is a shortcut in ASP.NET AJAX for document.getElementByID().

ViewState / PostBacks

Hi all,

Is there any way to update the viewstate actually on the page without having to reload the page?

I know that sounds a bit daft but I would be interested to know - I'm having some issues with my update panels / dynamic controls and this might help.

Hi,

normally the UpdatePanel keeps the viewstate in sync, something a lot of people dislike since that adds significantely to the total data transferred back and forth to the server.

I think your problem is more with the dynamic controls. Be sure to put them in the right eventhandler like Page_Init. Something you can try is to first remove the updatepanel and see if everything works. If it does you can integrate the updatepanel again and recheck.

Grz, Kris.


Hi Kris,

Thank you for your reply.

When you say that the update panel keeps the viewstate in sync, should I notice this on the page if I view source?

For example - lets say to keep things easy when my page loads I view source and there's 100 characters of viewstate, I then perform an action that'll change this, are we saying that the update panel has changed the page so that if I view source now I might see 150 characters for example?

My object that is held in viewstate I can access programmatically, ie, repopulate my object when needed from viewstate and everything is there - I was just wondering whether the actual characters in the view source are going to change or only if there's a full postback?


I doubt you'll see it in a ViewSource; I don't think most browsers reevaluate that after an async postback. You'll want to use the IE Dev toolbar or the Firefox Dom Explorer to get a runtime view of what's in there.


Hi,

another great tool would beFiddler.

Grz, Kris.


Thanks for the info about the additional tools chaps - appreciated.

My problem after further diagnosis seems to be this...

When a user adds a resource, I add the drop down menus using AJAX, the update panel updates, I store the select resource in the view state so that when the update panel updates again I can call back the already selected ones to dynamically rebuild those controls again.

My problem seems to be that when you select an item in the list it doesnt fire the onselectedindexchanged event, I'm completely at a loss why to be honest because I'm using the same function for the controls that are added to the update panel after the user has chosen a resource as I am for the pre-selected resources that come with a role - and thats working?

Any thoughts? I've attached a screenshot so you can perhaps get a better idea of what I'm trying to achieve...

Application Screen Shot


Well, I'm not sure how to solve the problem offhand; I tend to limit my use of updatepanels where possible. I'm not entirely sure at what point you're adding your controls based on your description; are you adding them using javascript on the client? That's what it sounds like. if that's the case, then you're not going to be able to do what you're trying to do b/c they don't exist on the server. If you're adding them on the server during the updatepanel's firing, then I'm pretty sure the upd won't recognize them (iirc, it loads all its triggers, etc, on the initial load during Init or PreInit of the page). You might be able to manually force an update by using the PageRequestManager.update() function on the client, and then wire the dropdown's event handler to a function that calls that; but I'm just guessing at this point.


Hi Paul, thank you for your reply...

To clarify what I'm trying to do then...

Looking at the screenshot above you'll notice two clear sections "Pre-selected resources" and "Additional resources".

My code gets the data for the role from SQL, and builds the 3 sets of drops downs (for access level and further detail) adding them to a table control.

I have them also in independent updatePanels, ie, one around each set of drop downs, when the user selects and access level in the first drop down menu (on the left) it'll run my code server side to update the items in the second drop down menu (on the right).

So in the screenshot, the top half of the page is working as expected, and also includes validators etc if nothing is selected on either of the menu's (left or right).

The "additional resources" is where it got more difficult...

When the user clicks on the "Add Resource Hyperlink" a popup window is launched which displays a list of all available resources as hyperlinks, each of the hyperlinks has a javascript call wired up so that when they are clicked it will place the ID of the resource into a hidden text box on the parent window. It also "clicks" a hidden button on the parent window.

My code then detects the click even and grabs the resource id from the hidden text field. I use this to then go and get all of the access levels for the resource and add a set of drop down menus to the "additional resources" part of the page, this has its own containing updatePanel.

The set of drop down menus are added with their own updatePanel as per the "pre-selected resources" section, the code to generate these is a generic function used by both.

I am then expecting the onSelectedIndexChanged event on the access level drop down (on the left) to fire when the user selects an item which in turn should then run my code to populate the further detail drop down menu (on the right) - this is what is currently not working - there are no errors, server or client side - simply nothing happens.

Initially I had a problem where I was adding the resource (with the drop downs) to the update panel and when I added the next one the first disappeared, this turned out to be because the server did not know anything about them as they were added client side, I got around this by changing my onSelectedIndexChanged code to add the selected resource to my userRegistration object held in viewstate, and then each time it updates the update panel it rebuilds the controls, thus any previously selected ones appear.

I hope this helps to clarify what I'm trying to do and where it isn't working, if it helps I'm happy to take a few more screenshots for each of the steps of the process to help further...


Any chance I can see the code related to those additional drop downs? PM is fine if you're not comfortable posting it here.

Also, use Fiddler to see if the event fires, but is not handled by the server, or it doesn't fire at all.

If it's fired, but not handled by the server, then you might have to do some manual inspection of the request to see if one of those dynamic controls fired it and then manually call the handler. If it's not fired, then you might have to do some .js hotness to get the controls properly wired up.

Paul


Hi Paul,

Thanks for your reply - no problem posting the code up - no need to PM - hadn't done it thus far as there's quite a bit of it...anyway...here goes...this should be most of the relavent stuff I think - if there's anything else let me know - last night I got as far as when you change the selected item in the access level (left hand drop down) nothing happens, but then on the second time you change the selection it fires something - not sure what as it then didn't display any controls - lol...looks like something might be nearly working...maybe...

Private Sub PopulateRoleBasedResources()' declare variablesDim userRegistrationAs UserRegistrationDim roleResourceCollectionAs RoleResourceCollection.SerializableRoleResourceCollectionDim roleResourceAs RoleResource.SerializableRoleResourceDim addSpacerAs Boolean' instantiate userRegistration =New UserRegistration(ViewState) roleResourceCollection =New RoleResourceCollection.SerializableRoleResourceCollection(userRegistration.RoleID)' iterateFor Each roleResourceIn roleResourceCollection' populate _iteration += 1' check position in collectionIf roleResourceCollection.AtEndOfCollection =True Then' populate addSpacer =False Else' populate addSpacer =True End If' create table rows for resource access levels and parameter options CreateTableRowsForResourceAccessLevelAndParameterOptions(AccessLevelParameterOptionsType.PreSelected, tblRegistrationPreSelectedResources, _iteration, roleResource, roleResource.AccessLevels, addSpacer)Next End Sub Protected Sub ddlResourceAccessLevelSelectedIndexChanged(ByVal senderAs Object,ByVal eAs System.EventArgs)Dim dropDownListAs DropDownListDim resourceAccessLevelIDAs GuidDim controlIterationAs String Dim requiredFieldValidatorAs RequiredFieldValidator' populate controlIteration ="" dropDownList = sender resourceAccessLevelID =New Guid(dropDownList.SelectedItem.Value.ToString())Select Case sender.id.ToString.Contains("AccessLevel")Case True controlIteration = Right(sender.ID.ToString, (Len(sender.ID.ToString) - 23))Case False controlIteration = Right(sender.ID.ToString, (Len(sender.ID.ToString) - 21))End Select' find our resourceParameter drop down list dropDownList = Page.FindControl("ddlResourceParameter_" & controlIteration)' populate PopulateResourceParameters(resourceAccessLevelID, dropDownList)' find our resourceAccessLevel requiredFieldValidator requiredFieldValidator = Page.FindControl("vldResourceAccessLevel_" & controlIteration)' validate requiredFieldValidator.Validate()End Sub Private Sub PopulateResourceParameters(ByVal resourceAccessLevelIDAs Guid,ByRef dropDownListAs DropDownList)' declare variablesDim sqlAs SQLDim resourceParametersAs Data.DataTableDim listItemAs ListItem' check resourceAccessLevelIDIf resourceAccessLevelID.ToString <>"00000000-0000-0000-0000-000000000000"Then' instantiate sql =New SQL' populate resourceParameters = sql.GetResourceAccessLevelParameters(resourceAccessLevelID)' check we returned some resourceParametersIf resourceParameters.Rows.Count > 0Then' populate dropDownList.DataSource = resourceParameters dropDownList.DataTextField = resourceParameters.Columns("ResourceParameterName").ColumnName.ToString() dropDownList.DataValueField = resourceParameters.Columns("ResourceParameterID").ColumnName.ToString() dropDownList.DataBind()' instantiate listItem = CreateListItem("00000000-0000-0000-0000-000000000000","Please Select") listItem.Selected =True' add list item to drop down list dropDownList.Items.Insert(0, listItem)Else' instantiate listItem = CreateListItem("00000000-0000-0000-0000-000000000000","None Available") listItem.Selected =True' add list item to drop down list dropDownList.Items.Add(listItem)' TODO: Send error to webmaster if no rolegroups have been loadedEnd If' housekeeping ' Dispose(sql)Else' clear all previously added resourceParameters dropDownList.Items.Clear()End If End Sub Protected Sub ddlResourceParameterSelectedIndexChanged(ByVal senderAs Object,ByVal eAs System.EventArgs)' declare variableDim controlIterationAs Integer Dim requiredFieldValidatorAs RequiredFieldValidator' populate controlIteration = Right(sender.ID.ToString, (Len(sender.ID.ToString) - 21))' find our resourceAccessLevel requiredFieldValidator requiredFieldValidator = Page.FindControl("vldResourceParameter_" & controlIteration)' validate requiredFieldValidator.Validate()End Sub Private Sub CreateTableRowsForResourceAccessLevelAndParameterOptions(ByVal accessLevelParameterOptionsTypeAs AccessLevelParameterOptionsType,ByRef tableAs Table,ByVal iterationAs Integer,ByRef enumeratorAs Object,ByRef enumerableObjectAs Object,ByVal addSpacerRowAs Boolean)' declare variablesDim tableRowAs TableRowDim tableCellAs TableCellDim dropDownListAs DropDownListDim listItemAs ListItemDim updatePanelAs UpdatePanelDim requiredFieldValidatorAs RequiredFieldValidatorDim requiredFieldValidator2As RequiredFieldValidatorDim accessLevelDropDownListIDAs String Dim parameterDropDownListIDAs String Dim accessLevelValidatorIDAs String Dim parameterValidatorIDAs String Dim resourceAccessLevelAs ResourceAccessLevel.SerializableResourceAccessLevel' populate resourceAccessLevel =Nothing accessLevelDropDownListID ="ddlResourceAccessLevel_" & iteration accessLevelValidatorID ="vldResourceAccessLevel_" & iteration parameterDropDownListID ="ddlResourceParameter_" & iteration parameterValidatorID ="vldResourceParameter_" & iteration' *** First table row *** ' *** First table cell *** ' instantiate tableRow = CreateTableRow() tableCell = CreateTableCell(40, HorizontalAlign.Left)' populate AddWebControlToControlCollection(tableCell, CreateImage(16, 1,"UI/Images/Misc/Shim.gif","","")) AddWebControlToControlCollection(tableCell, CreateImage(16, 16,"UI/Images/Misc/BulletPoint.gif","Bullet Point","*")) AddWebControlToControlCollection(tableCell, CreateImage(5, 1,"UI/Images/Misc/Shim.gif","",""))' add tablecell to tablerow tableRow.Cells.Add(tableCell)' *** First table row *** ' *** Second table cell *** ' instantiate tableCell = CreateTableCell(HorizontalAlign.Left)' populate tableCell.Text = enumerator.Name tableCell.Style.Add("font-weight","bold")' add tablecell to tablerow tableRow.Cells.Add(tableCell)' *** First table row *** ' *** Third table cell *** ' instantiate tableCell = CreateTableCell(HorizontalAlign.Left)' populate tableCell.Text =" "' add tablecell to tablerow tableRow.Cells.Add(tableCell)' *** First table row *** ' *** Fourth table cell *** ' instantiate tableCell = CreateTableCell(HorizontalAlign.Left)' populate tableCell.Text =" "' add tablecell to tablerow tableRow.Cells.Add(tableCell)' add tablerow to table table.Rows.Add(tableRow) tableRow =Nothing tableCell =Nothing' *** Second table row *** ' *** First table cell *** ' instantiate tableRow = CreateTableRow() tableCell = CreateTableCell(40, HorizontalAlign.Left)' populate tableCell.Text =" "' add tablecell to tablerow tableRow.Cells.Add(tableCell)' *** Second table row *** ' *** Second table cell *** ' instantiate tableCell = CreateTableCell(HorizontalAlign.Left) updatePanel =New UpdatePanel dropDownList =New DropDownList listItem =New ListItem("Please Select","00000000-0000-0000-0000-000000000000") listItem.Selected =True' populate updatePanel.ID ="upnAccessLevelParameter_" & iteration.ToString updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional updatePanel.RenderMode = UpdatePanelRenderMode.Inline dropDownList.AutoPostBack =True dropDownList.ID = accessLevelDropDownListID dropDownList.CssClass ="vam" listItem.Selected =True' create event handler ' AddHandler dropDownList.SelectedIndexChanged, AddressOf ddlPreSelectedResourceAccessLevelSelectedIndexChangedAddHandler dropDownList.SelectedIndexChanged,AddressOf ddlResourceAccessLevelSelectedIndexChanged' add listitem to dropdownlist dropDownList.Items.Add(listItem)'iterateFor Each resourceAccessLevelIn enumerableObject' instantiate listItem =New ListItem(resourceAccessLevel.Name, resourceAccessLevel.ID.ToString)' add listitem to dropdownlist dropDownList.Items.Add(listItem)Next' instantiate requiredFieldValidator = CreateRequiredFieldValidator(dropDownList.ID.ToString, accessLevelValidatorID,"00000000-0000-0000-0000-000000000000","<img class=""vam"" src="http://pics.10026.com/?src="UI/Images/Icons/Warning.gif"" style=""width:16px;height:16px;"" title=""Required information missing"" alt=""!"" />","Required information","UserRegistrationFurtherDetailStep3")' populate updatePanel.ContentTemplateContainer.Controls.Add(dropDownList) updatePanel.ContentTemplateContainer.Controls.Add(CreateImage(16, 16,"UI/Images/Misc/MandatoryField.gif","Required information","Required information","vam", 0, 0)) updatePanel.ContentTemplateContainer.Controls.Add(requiredFieldValidator) updatePanel.ContentTemplateContainer.Controls.Add(CreateImage(16, 16,"UI/Images/Icons/Information.gif","Click to view Access Level information","Information","vam", 5, 35))' instantiate dropDownList =New DropDownList' populate dropDownList.AutoPostBack =True dropDownList.ID = parameterDropDownListID dropDownList.CssClass ="vam"' create event handlerAddHandler dropDownList.SelectedIndexChanged,AddressOf ddlResourceParameterSelectedIndexChanged' instantiate requiredFieldValidator2 = CreateRequiredFieldValidator(dropDownList.ID.ToString, parameterValidatorID,"00000000-0000-0000-0000-000000000000","<img class=""vam"" src="http://pics.10026.com/?src="UI/Images/Icons/Warning.gif"" style=""width:16px;height:16px;"" title=""Required information missing"" alt=""!"" />","Required information","UserRegistrationFurtherDetailStep3") requiredFieldValidator2.IsValid =True' populate updatePanel.ContentTemplateContainer.Controls.Add(dropDownList) updatePanel.ContentTemplateContainer.Controls.Add(CreateImage(16, 16,"UI/Images/Misc/MandatoryField.gif","Required information","Required information","vam", 0, 0)) updatePanel.ContentTemplateContainer.Controls.Add(requiredFieldValidator2)' populate AddWebControlToControlCollection(tableCell, updatePanel)' add tablcell to tablerow tableRow.Cells.Add(tableCell)' *** Second table row *** ' *** Third table cell *** ' instantiate tableCell = CreateTableCell(HorizontalAlign.NotSet)' populate tableCell.Controls.Add(CreateImage(16, 16,"UI/Images/Icons/Information.gif","Click to view Further Detail information","Information","vam", 5, 5))' add tablecell to tablerow tableRow.Cells.Add(tableCell)' instantiate tableCell = CreateTableCell(HorizontalAlign.Left)' *** Second table row *** ' *** Fourth table cell *** ' populate tableCell.Text ="Empty cell"' add tablecell to tablerow tableRow.Cells.Add(tableCell)' add tablerow to table table.Rows.Add(tableRow)' add a spacer if requiredIf addSpacerRow =True Then' instantiate tableRow = CreateTableRow() tableCell = CreateTableCell(2, HorizontalAlign.Left)' populate tableCell.Text =" "' add tablecell to tablerow tableRow.Cells.Add(tableCell)' add tablerow to table table.Rows.Add(tableRow)End If End Sub

Ok - I've had some success!!

I ran it through in debug mode with a break point on the page load, this is where I have a test to see if we're posting back asynchronously and build the page depending on some factors.

What I noticed was that when I call my onSelectedIndexChanged event handler function I add the resource to the userRegistration object and then rebuild the controls on the page (iterating through those in my object) - but when I do any other form of postback (even if asynchronously) I wasn't calling this - and this was why they seemed to disappear.

So, I've amended the code to incorporate this and now I have the controls not disappearing, I've even managed to get them to fire and populate the further detail drop down menu (on the right) - the only minor thing to resolve now is where this is call from - as if I leave the code in the onSelectedIndexChanged event handler function then my controls get duplicated on the page, if I take it out then all but the most recently added one appear but I'm hoping this will be easy to resolve - get there though - and even my validators work - lol - gotta love OO!Big Smile


Glad I could help. seems like you'd want to pull the code in your onSelectedIndexChanged handler out into a helper function, and then have the OSIC handler perform inspection of the sender to determine whether to fire that version, or a different version that doesn't create duplicates. Alternatively, if you keep (as you suggested) your created 'stuff' in the state bag, then you should just be able to inspect the contents of the state bag to see what's there, and then add to it as needed, rather than blindly adding, if that make ssense.


Hi Paul,

Ok - I'm still struggling a bit with this...

The controls are being added which is a good thing - however, if I add one control, I can then use it and the OSIC event fires - great...

If I add more than one control then you seem to need to select 2 different values before it fires...I've followed this through in the debugger and I have a theory - but thats about it!

At the moment I've got the code that iterates through the resources in the userRegistration object as a separate sub, I call this when the page loads (based on certain criteria), so that all of the items are displayed, part of this process is to clear the table first, thus anything thats there is cleared, then all of the resources are rendered.

When the user adds a new one I call this sub again, as obviously I need to show the one they just added...

It looks as if the building of the controls twice might be causing the problem, whilst they have ID's that are set by me I get the feeling that its losing some reference from what had the OSIC event on the first fire, ie, nothing happens, then the page is rebuilt and the second time it seems to work - its very strange...

I'm not sure of the best approach now - I need to display whatever resources have already been added AND the one that has just been added and obviously have all of them firing correctly...

Any thoughts?


Hi Rob; got your PM; sorry I didn't respond earlier.

I'm not really sure based on your code what might be causing the problem; can you look at the rendered' page's source through a runtime tool like the IE developer toolbar and check the DOM tree and the attributes of each of your ddls to see what they look like at each step of the operation? If you have the site somewhere that's accessible, I'll look at it that way for you.

I'm also not entirely clear on the behavior you're describing. Let me repeat my undertanding and you can tell me where I'm mistaken: What you're experiencing is that when you have one dynamic dropdown on the page all is well. That is a ddl that is added after the initial page load. When you later add a second dynamic control, the first time you make a selection on it, nothing happens. the second time you make a selection on it, you get the expected behavior. Is that correct?


Hi Paul,

No worries, I just thought I'd give you a try on this as you helped me out last timeSmile

I dont have the developer tool bar installed, so I'll get it and install it, I've never used it before so I hope its intuitive - you've seen what I mess I can get into! hehe...

I think your description of your understanding was correct - albeit that obviously each time I try to fix this I change something and then that changes the outcome, but I typically then put it back to how it was and go around in circles...

I can confirm that if you only add ONE additional resource it seems to work perfectly, but I suspect that this is because the method to build the controls is being called twice, once in the page load, and once on the button click event, well actually 3 times then - the page loads, it tries to iterate through the collection of already selected resources but there aren't any, so its doesnt, then you select one, the javascript clicks the button, the ajax enables the .net method to be called which adds a resource object to my collection in the userRegistration object in viewstate, and then calls the method to build the controls. No doubt at some point here there's been a postback either full or async - async most likely, thus the same call to build the controls would have happened there too - thus I believe its called twice...maybe thats why if you only add one it works..

I have a line of code in the build mehtod which clears all rows from the current table, this was added to ensure that I didn't get duplicates on the page, if I remove this then I do get duplicates so felt it best to keep this in, so each time it will remove everything from the table, and then rebuild.

If I remove the call to build from the add resource method (fired from the button click) then I never see the most recently added object on the page, my code has added it to the viewstate though so on the next postback/async postback the build method is called and they all appear.

Regarding the number of times you have to select something in the drop downs my theory is that when its say the second control, its run the build method AFTER the page_init, .net doesn't know about the control althought it was added programmatically and is on the page - and thus I believe (probably wrong) it equally doesn't know about the eventhandler (made programmatically with addHandler) - therefore when I select an option it doesnt fire my event, instead it does the autopostback because this is set to true to try and enable the AJAX etc...as such when the postback is called it runs my build method which then takes the resources from the collection in my userRegistration object from viewstate and builds the controls - I think (although have almost lost the plot now) - at this stage the selected index change event DOES work because .net now knows about the controls...and as such the second drop down menu is populated...

I think thats about it...

ViewState and Atlas

Hi

I encountered a problem involving viewstate and PageMethods (web methods in an aspx page).

I was submitting some control values, only one control on the page is designed as a <asp:listbox />, the rest of the controls are generic HTML. While Atlas.js constructed the proxy to the PageMethod and the arguments (Web.Net.PageMethodRequest) the Atlas.js javascript does some sort of check on the page controls, in which viewstate is a hidden input, adding it to a dictionary (refer line 3495 in Atlas.js)

Some sort of exception is generated but no information is available to determine the source. The code behind to the PageMethod didn't get hit in debug mode and it wasn't until I inspected the request/response in Fiddler that I came across a message indicating a corrupted viewstate.

After disabling viewstate on the <asp:listbox> the request got through to my [WebMethod] in the code-behind.

There is a problem with PageMethods and viewstate, or have I missed something.

Craig

An update for those who might be encountering the same problem with altas (Jan-06 CTP) and ViewState.

As mentioned in my previous post, in the file Atlas.js on line 3495, a procedure adds to the variable bodyDictionary all 'submittable' HTML element e.g <input /> this includes <input type="hidden" /> which means that<inputid="__VIEWSTATE" /> is added to the bodyDictionary variable.

Next in the procedure, is a call Web.Net.WebRequest.createQueryString(bodyDictionary, ...);

This is where IMHO the viewstate corruption is occuring between the client service calls to the server. In my case, I make a call to a [WebMethod] which is contained in an aspx page. So my client function is something like this:

functionfoo() {
PageMethod.GetFoo('hello');
}

My aspx.cs [WebMethod] is like the following:

[WebMethod]
public string GetFoo(string text) {
return text+=" get foo";
}

My page wrapes a user control in an<atlas:UpdatePanel>the user control contains an<asp:Repeater>control.

Has anyone experienced this, or am I the lucky one? To avoid the error 500, I removed the check for HTML elements with a type of hidden. But I'm not sure if this is a good thing...

Craig

PS: I can post the stack trace for those who might be interested.


Further, using PageMethod seems to faciliate the viewstate corruption. for kicks I moved the [WebMethod] from the aspx page into an ASMX file, reversed my Atlas.js script hack and the viewstate problem has gone. I hope the PageManager is a little more robust in the rtm.


Hi,

I'm not able to reproduce the behavior that you described. Could you post the stack trace and also the relevant page code?

Hi Garbin

Stack Trace
[FormatException: Invalid length for a Base-64 char array.]
System.Convert.FromBase64String(String s) +0
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +72
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded() +172

[ViewStateException: Invalid viewstate.
Client IP: 127.0.0.1
Port: 3520
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
ViewState: /wEWCAKbhpuAAgLEtM6pBgLN/7aVCAKe4MuSDQLL7+H/CgLL7 3/CgKs5ZucDgLNoqBMLo1Lj5/N S5y dQM87L I5JMzQ=
Referer:http://localhost/Unsd/COC/ExchangeRateView.aspx?countryCode=36
Path: /Unsd/COC/ExchangeRateView.aspx]

[HttpException (0x80004005): The state information is invalid for this page and might be corrupted.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +116
System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded() +209
System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +67
System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +106
System.Web.UI.WebControls.TextBox.LoadPostData(String postDataKey, NameValueCollection postCollection) +31
System.Web.UI.WebControls.TextBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +11
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +408
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +154
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.exchangerateview_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\unsd_coc\bdef81f1\ee1d3cb5\App_Web_ytigk7vl.8.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

Page Code (aspx.cs)
[WebMethod]
publicExchangeRate GetExchangeRate(int countryCode,int year) {
returnCountryManager.Instance.GetExchangeRate(countryCode,
newint[] { year });
}

Page Code (aspx - javascript)
function GetExchangeRate(countryCode, year) {
// Call the server.
PageMethods.GetExchangeRate(countryCode, year, RequestCallback);
}

function RequestCallback(exchangeRate) {
// Bind the result to the controls.
document.getElementById("ctl00_contentPlaceholder_textboxYear").value = exchangeRate.Year;
document.getElementById("ctl00_contentPlaceholder_textboxIMF").value = exchangeRate.IMF;
document.getElementById("ctl00_contentPlaceholder_textboxUNOP").value = exchangeRate.UNOP;
document.getElementById("ctl00_contentPlaceholder_textboxOther1").value = exchangeRate.Other1;
document.getElementById("ctl00_contentPlaceholder_textboxOther2").value = exchangeRate.Other2;
document.getElementById("ctl00_contentPlaceholder_textboxNote").value = exchangeRate.Note;
}

Page Code (aspx - html)
<!-- Exchange Rate Control -->
<atlas:UpdatePanelID="updatePanelExRate"runat="server"Mode="Conditional">
<ContentTemplate>
<unsd:ExchangeRateControlid="exchangeRateControl"runat="server"/>
</ContentTemplate>
<Triggers>
<atlas:ControlEventTriggerControlID="buttonSave"EventName="Click"/>
</Triggers>
</atlas:UpdatePanel>

The ExchangeRate control is populated in the Page_Load event of the aspx Page by passing an array to a property accessor in the control, the array provides is the data source to a repeater. The ItemTemplate in the repeater contains a link to invoke the GetExchangeRate javascript in the page (above).

Hope this helps.

Craig


I don't know if its the same issue or not, but viewstate corruption is rampant in the QuickStart tutorials... There were several times where I ran 3 or 4 different "run this" tutorials in a row only to have the viewstate corruption error message appear on me. Sometimes it was fixed with a refresh of the page, sometimes it never went away.
hi Guys...
even i got the same problem when i put my [webmethod] in code behind.i tried removing type=hidden from atlas.js line 3495 and it is working.please let me know for the solution as we just can not remove any thing from coreatlas files even though doing the same results in expected output.

thanks
Jaideep

I tried a few things, but was not able to repro. Could you give this a try with the March CTP to see if it still happens?

thanks,
David


I have a similar problem with teh session state.

I have narrowed it down to a web user control that raises an event.

The code behind that implements the event sets the session var and then does a redirects.

on the redirect page the session state is blown away. cant figure out why

steps to reproduce

- create a web user control (define an event and raise it)

- create a page and place the wuc on it (trap for the wuc event and set a session var and do a redirect to 2nd page

- in 2nd page Page_load check the session state

ViewState in Session is still uploaded after AsyncPostBack

Hi all,

Here is the basic setup of my page.

- ViewState stored in session
- AutoCompleteExtender using a WebService
- UpdatePanel triggered by button next to AutoComplete TextBox

Here is the behavior I'm experiencing (note that I have validated this with Fiddler):

Page loads first time. "id="__VIEWSTATE" value="y0V/cubnEZ1qzAvIgW0oRpVSc8AvJU6rtssTVFt7+B8="
ViewState is short as expected because storing it in the session.

Now, I click on the button to activate the UpdatePanel, causing a partial postback. This takes much longer than expected. After inspecting with Fiddler I see that it is uploading 50K. I inspect the Request and notice that most of it is my ViewState (I have a repeater on the page). I even turned EnableViewState off on the Repeater and it still uploads it.

My questions are:

1. Where is this uploaded ViewState coming from? It was not downloaded, is it generated clientside by JavaScript?
2. How can I stop this ViewState from being uploaded?

Regards,
Cole

I now realize this is not the viewstate but all of the form elements names & values being concatenated together. Is there a way to adjust what gets sent back from the controls on a AsyncPostBack?


The only way I'm aware of is to not use updatepanels to traffic your info, but instead to use web services, page methods, or hand-jam your own webrequest.

Viewstate verification failed - HELP my website is falling apart. Again :-(

I have a timer component that refreshes my page every minute but after a while it fails with the error "Viewstate verification failed". I left the page refreshing last night and it showed it stopped after 3 hours. The contents of the page haven't changed so I'm wondering if it is a timing issue with another component on my master page that has a javascript timer to which refreshes itself using callbacks.

The full error from my Event Viewer is:

Event Type: Information
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1316
Date: 15/02/2007
Time: 03:31:22
User: N/A
Computer: MAT
Description:
Event code: 4009
Event message: Viewstate verification failed. Reason: Viewstate was invalid.
Event time: 2/15/2007 3:31:22 a.m.
Event time (UTC): 2/14/2007 2:31:22 p.m.
Event ID: b68b7d7fa4d446b3adba40708b352b32
Event sequence: 341
Event occurrence: 1
Event detail code: 50204

Application information:
Application domain: /LM/W3SVC/1/Root/flo-1-128159266743963684
Trust level: Full
Application Virtual Path: /flo
Application Path: c:\inetpub\wwwroot\flo\
Machine name: MAT

Process information:
Process ID: 2308
Process name: aspnet_wp.exe
Account name: MAT\ASPNET

Request information:
Request URL:http://localhost/job_status.aspx
Request path: /job_status.aspx
User host address: 127.0.0.1
User: matthew
Is authenticated: True
Authentication Type: Forms
Thread account name: MAT\ASPNET

ViewStateException information:
Exception message: Invalid viewstate.
Client IP: 127.0.0.1
Port: 1349
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
PersistedState: /wEWBQK9m9+mCQL20L6+CQLh8tHdBgLd/pFuArD90/EPqAe+PBf42BwApxmU14Oldo6DzQU=
Referer:http://localhost/job_status.aspx
Path: /job_status.aspx

Custom event details:

For more information, see Help and Support Center athttp://go.microsoft.com/fwlink/events.asp.

Any help would be appreciated.

Hi Matthew,

I remember some time ago to find a similar problem. It had to do with the fact that viewstate is saved in a hidden field at the end of the page, and continuous AJAX refreshes queued successive requests before they were finished, at the point where the request still had to reach the "end" of the page, where the ViewState resides. As you can see, the ViewState validator couldn't do it's work and, therefore, it threw an exception like the one you are having.

If you search the forum you may find that thread, as I haven't started it I have no easy way to point you to the link. I think I remember there was a workaround as well.

Sorry not to be more helpful, but maybe at least I gave a direction to start looking at.

Regards,

Juan


Thanks for the info. I have set up two almost duplicate copies of the site, one with buffering and one without to see if that is causing invalid data. If that doesn't work I'll look for the thread you mentioned.


Have you figured this out yet? I'm seeing this intermittently and am not sure where it's coming from.

Thanks!


I have managed to resolve this problem by not having multiple types of callback components, ie AJAX and custom made callback scripts.

What I did in the end was to setup a timer on the masterpage. On the content pages if I want update panels to update I add a trigger to the update panel that is pointing to the timer on the masterpage. Therefore evry minute the timer on the masterpage refreshes all updatepanels that are connected to it.

If you need more info let me know and i'll sort some code out for you.

Monday, March 26, 2012

Visibility problem with ajax control

hi,

I have a textbox and required field validator control.when the page is 1st loaded the Textbox is invisible and after clicking a button it becomes visible but

the problem is that the validator control is not working though the text box is visible now? why any idea pls?

Hi,

Can you post sample code to illustratete problem? I cannot get the same problem just by placing textbox and required validator in update panel and makeing TextBox invisible initially.

-yuriy


If you are using Validators inside UpdatePanel, then it is not compatible with it

http://weblogs.asp.net/scottgu/archive/2007/01/25/links-to-asp-net-ajax-1-0-resources-and-answers-to-some-common-questions.aspx

You can download compatible validators control from here

http://blogs.msdn.com/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx


hi,

I have used the usual asp validators.Now I have add the tag mapping required in web.config file and add reference to validation.dll.But when I run the program it shows error in my user controls which are in another folder with a custom namespace.any idea pls? the pages are not showing error but the user controls are showing error.By the By the Pages where these user controls are imported are also in a folder.

pls reply...


I have put the error messags given in my User Controls below:

pls see this and reply quickly............

Error 150 Could not load file or assembly 'Validators, Version=1.0.0.0' or one of its dependencies. The system cannot find the file specified. (D:\SSDTracker\Tracker\web.config line 92) D:\SSDTracker\Tracker\User Controls\CompetencyDatabase\CompetencySectionUI.ascx 32


Hi,

I think the error message explained the issue clear.Make sure Validators.dll is in the right folder and the version of it is right. Make sure you made the right setting in the config file.

Good luck!

Vista w/ vs2005 & Ajax

Is there anyway to allow ajax tag prefixes as asp without having designer errors when declared in web.config or page? I'm running as administrator and have sp1 (kb926601) and the vista patch (kb932232) installed

ex:
no errors in designer:
<%@dotnet.itags.org. Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="ajax" %>

causes errors in designer:
<%@dotnet.itags.org. Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>


Hi,

As far as I know, the ajax extension has a tagprefix "asp" by default, so it's not necessary to specify it.

And I also tried both, they all work fine.

Visual Studio "Loses" controls inside an UpdatePanel

Hi,

I'm using a couple of UpdatePanels on a page and it seems that Visual Studio periodically loses track of controls that are inside an UpdatePanel, throwing errors that say those controls don't exist. If I restart Visual Studio the problem goes away.

Any ideas?

Thanks!

Anybody?


I am having the same problem here.. no solution yet.
I'm also having this problem, the difference is that re-loading VS doesn't get rid of it.

Visual Studio not playing nice with .NET AJAX

I downloaded SP1 for Visual Studio today (497 mb - ouch!). AJAX insisted on it. I can build and run a local page using AJAX. But when I publish and copy to my web host provider I get this error:

Parser Error Message:Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error:

Line 27: <compilation debug="false">Line 28: <assemblies>Line 29: <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>Line 30: <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>Line 31: <add assembly="System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies>

'System.Web.Extensions' is a dll in the AJAX bin directory (along with AJAXExtensionsToolbox.dll - actually it's not in the exact same directory but I digress). I looked around on the web and it seems Visual Studio adds that <add assembly statement to the web config on its own. Same with the System.Web.Extensions.Design. I commented those two statements out and rebuilt and VS added two new ones - so that's true.

One site something about turning the "Get Specific Version" option for the toolkit to false. It also said something about VS grabbing everything in the reference hierarchy when it doesn't need to. I read that it could be the IIS implementation's fault but if it's in the bin at compile time then it shouldn't matter.

I've tried to add it as a reference in the project but after I navigate to it and select it the dialogue box just disappears and it doesn't get added.I've tried dropping it into the bin directory of the published site but that failed. I tried editing the "<add assembly" statement out of the published config file but that didn't work either.

Anyone have any ideas?

Thanks - Foolong

All you need to do, is copy the System.Web.Extensions.dll and system.web.extensions.design.dll to your websites bin directory on the web server.

On your local machine these live in the GAC but once they are on the server, unless Ajax has been installed directly on the server, they dont exist in the GAC and need to live in the bin.


Hi Bryan,

Thanks for your response!

I tried that both by dropping them in after publishing to a dir on my box and also dropping them into the project folder and then publishing. Still get the same error. I'm opening the folder on my web host provider's server up and the dll's are there. I even tried stripping off the 'version', 'culture', 'publickeytoken' params from the <add assembly tag.

Nothing seems to work.

This is too bad too because I just graduated w/ a BS in Computer Science and NOBODY hires unless you have at least three years of experience. I was hoping to use this stuff to to make my site (ergo my resume) look better.

Should have gone after an engineering degree :-(


Sorry you're having trouble with this. There is a point of interest that may affect your issue. You must be able to run your application in FULL TRUST on the server, for it to be able to use the ajax assemblies from the /bin folder. The other option is to have the MSI installer run on the server, which will put these into the GAC and should fix most of the problems.

Who is your host, and what is your servers availability to be modified / administered?

One other thing you may try, is changing all the lower case letters in your Public Key Token portion to Capital letters. It's fixed things in some cases.


I would venture to say that 5 will get you 10 that my web host provider has something to do with this! I just got off the phone w/ them asking

A) if they are making these files available globally - said yes but when I asked if the System.Web.Extension.dll and System.Web.Extension.Design.dll files were in the GAC - he didn't know for sure; and

B) when I told them I was including them in the bin directory and needed full trust he said they can't give that to custom dll's.

Oh well - I guess you get what you pay for.

I really apprreciate your help Bryan and will definitely post back when I get this figured out.

Thank again

Pat


The key is going to get them to install them in the GAC then if they wont give full trust to custom dll's. Of course, depending on how tight they have their security, you MAY be able to override your applicaiton or machine settings, by explicitly setting it in your web.config. Most of the time this will try to override a machine key though, and it will throw you an exception about it not being allowed, but it's always worth a shot.

Try putting this in your web.config under the system.web node

<system.web>
<securityPolicy>
<trustLevel name="Full" policyFile="internal" />
</securityPolicy>
<trust level="Full" originUrl="" />
</system.web>

Like I said, this doesnt usually work, but it's easy enough to give a shot. If it doesnt work you'll get a message about the Machine.config not allowing override.

Visual Studio wont recognize some AJAX components when there is a master page

This is a really weird thing. I have installed AJAX and the toolkits and the validators, and everything was working fine. Then, suddenly, Visual Studio won't let me switch to design view b/c the script Manager and the update panels are now "not known elements," and so are all the labels, panels, dropdownlists, etc inside the update panels. Oddly enough, the components in the AJAX toolkit are still recognized just fine. when this problem first started happening, i would click over to the master page and click back to the aspx page and everything was fine. Now that doesn't even work. And the craziest part is that the web site runs just fine when I debug it, AJAX functionality and all!

I would have blamed this on the way I installed the AJAX framework, but this only happens on pages with master pages.

Does anyone have any experience with this? Or is it just my machine? No one else here at work is having this problem, but I am the only one who is really using AJAX.

Any ideas would be welcome. Thanks in advance

Hi,

As far as I know, the error message indicates the issue is related to permission. It seems your ASP.NET applications run in partial trust. This is configured through the <trust level="xxx" /> setting in web.config or machine.config. Please change the "xxx" to medium and try again to figure out whether the problem still occurs.

Best Regards


Thanks for your suggestion. I don't even have any trust level permissions in my web.config files, so I am assuming that the problem is in my machine.config file. But before I go messing around in there, I would like to try to override it in the web.config. This is what I have in my web.config. But the error I am getting on the page declaration of the default.aspx page is "Unable to read the security policy file for trust level 'medium'." Where are the policy files located?

<location allowOverride="false">
<system.web>
<securityPolicy>
<trustLevel name="Full" policyFile="internal"/>
<trustLevel name="High" policyFile="web_hightrust.config"/>
<trustLevel name="Medium" policyFile="web_mediumtrust.config"/>
<trustLevel name="Low" policyFile="web_lowtrust.config"/>
<trustLevel name="Minimal" policyFile="web_minimaltrust.config"/>
</securityPolicy>
<trust level="medium" originUrl=""/>
</system.web>
</location>

VS 2005 and intellisense

Hi there.

I seems that when it comes to intellisense, VS 2005does not seem to cope with the AJAX tags when used from a page thatinherits from a master page. For instance, take this basic page:

<%@dotnet.itags.org. Page Language="VB" MasterPageFile="~/Master.master"AutoEventWireup="false" CodeFile="Test2.aspx.vb" Inherits="Test2"title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
</asp:ScriptManager>
</asp:Content

The openining "ScriptManager" is underlined in red for me as an unknownelement. I'm using VS 2005 Team Edition with the latest Beta downloadof the AJAX library. Can anyone help?

Cheers,

Mike

Just to let you know that you are not alone. I have the same problem.

Same here. I didn't realize it was the master page that was causing this problem for me though. Thanks for pointing it out.


Find the following section in the web.config file:
<pages><controls><add tagPrefix="asp" namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><add tagPrefix="asp" namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></controls></pages>

change it to

<pages><controls><add tagPrefix="msajax" namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><add tagPrefix="msajax" namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></controls></pages>

You can choose your own tag prefix, just dont' use 'asp' as a prefix. Next you must change the prefix for things like update panel to your chosen tag prefix.


wow... thanks for this!


Hi, it is a stupid problem in the all versions of VS Studion 2005. We had some discussions with guys from Microsoft, but without any results... If you use some master in the your page, and Intellisense doesn't work - just open required master page in the VS Studio, switch back to the your page and - all will be Ok...

VS 2008 RTM AJAX Toolkit 3.5 Autocomplete extender has issues

I just installed VS 2008 RTM and the autocomplete has issues. I created a new page added the scriptmanager and set it up to enablepagemethod so that I could use my local database to supply the autocomplete strings.

I dropped a textbox on the page then I dropped the extender onto the control. It appeared in the properties list of the textbox as expected. I changed some properties and set the ServiceMethod.

The extender did not alter the source. All the property changes were lost. I tied this several times and always the same result. The properties could be changed in the properties window but these are not updated in the source aspx page. So when you switch to source view from design the changes are simply lost.

For those who would like to implement a pagemethod rather than a webservice call, I found two good sources:

http://allwrong.wordpress.com/2007/03/13/ms-ajax-autocomplete-extender-using-a-page-method/

http://fredrik.nsquared2.com/viewpost.aspx?PostID=393

From my codebehind page:
<* The autocomplete extender is designed to use a web service to supply the items for the list box. Sometimes this
* is certainly an over-kill or the data may be accessable directly from the application's database connection. A
* web service is an un-needed layer for these times. So here is how to call a "page method" to supply that data.
*
* 1 - add: using System.Web.Services;
* 2 - In the html, modify the ScriptManager with the EnablePageMethods set to true.
* ex: <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True"></asp:ScriptManager>
* 3 - add a declaration for the page method: [WebMethod]
* 4 - add: public static string[] methodNameHERE(string prefixText, int count)
*
*/

///<summary>
/// ServiceMethod - The method to be called. The signature of this method must match EXACTLY as below.
///</summary>
///<param name="prefixText"></param>
///<param name="count"></param>
///<returns>string array</returns>
[WebMethod]
publicstaticstring[] getCompanyNames(string prefixText,int count)
{
bbCMScore bb =newbbCMScore();
string[] s = bb.getGroupingUsingUserCompanyNameSource(prefixText, count).ToArray();
return s;
}

The ASPX code looks like this:

<asp:TextBoxID="tbGrouping"runat="server"></asp:TextBox>
<cc1:AutoCompleteExtenderID="tbGrouping_AutoCompleteExtender"runat="server"EnableCaching="true" CompletionSetCount="20" CompletionListCssClass="autocomplete_completionListElement" CompletionListItemCssClass="autocomplete_listItem"CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" MinimumPrefixLength="2" TargetControlID="tbGrouping" ServiceMethod="getCompanyNames">
</cc1:AutoCompleteExtender>

The above works as it should. The problem is the properties are not updating. This causes VS 2008 RTM to error with a "souce code not available" error which certainly doesn't point to the real problem. You thought you set the properties and really they were not set.

Larry Aultman

Hi Larry,

Your problem is such weird issue. Can you modify or add extra code to your page? We suggest that you should check which version of AJAX Control Toolkit that you are using now. Please upgrade it to V11119. Also, you should check the .NET Framework version and AJAX Control Toolkit version. So do the web.config settings. AJAX Control Toolkit are divided into two versions for supporting .NET Framework 2.0 and 3.5.

Best regards,

Jonathan


Jonathan,

During the upgrade to RTM from Beta 2, I uninstalled everything Beta2. I uninstalled all projects from my machine, and deleted all traces of my development environment. I installed the RTM, downloaded the latest versions of AJAX toolkit. I created an new project.

I did verify that all my versions are for 3.5. My work around is to just not use the properties window for the control. However this control has other isses that are show-stoppers. I have commented on them in this forum under the "onClientItemSelected" event that will not fire. I can make it autocomplete but I can't get an event fired so it isn't much use to me. Thus for the moment I can't use it in production.

Thanks for the reply. I hope that someone is able to find the problem as it would be useful to users.

Larry Aultman


Hi Larry,

wph101larrya:

My work around is to just not use the properties window for the control.

Only for AJAX Contol Toolkit's Controls or all the Controls?

If the former, please do this and have a test.

We suggest that you should download a sample fromhttp://www.asp.net/learn/ajax-videos/ and have a test. Please make sure Javascript is not forbidded in you machine.

Best regards,

Jonathan

VS cant recognize all tags from AJAX framework.

For some reason starting from Beta VS marks all tags that represent AJAX makeup as invalid even though page compiles and runs OK.

Did anybody see this?
Thanks

there's already 4 or 5 topics on this... here's one of them (http://forums.asp.net/thread/1435993.aspx)

VS doesnt recognize tags asp

Hei,

I'm getting started with ajax, i do a lot of things with the ajaxToolkit but i still have a problem,

When i put an update panel on a page, visual studio can't recognize all the asp tag, and my code loose its formating and i can't use completion (ctrl+space) anymore.

Is it a problem of web.config?

Thanks to help me.

ps: Sorry for my english ...

This is my web config

<?

xmlversion="1.0"?>

<

configuration>

<

configSections>

<

sectionGroupname="system.web.extensions"type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

<

sectionGroupname="scripting"type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

<

sectionname="scriptResourceHandler"type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"/>

<

sectionGroupname="webServices"type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

<

sectionname="jsonSerialization"type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"/>

<

sectionname="profileService"type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"/>

<

sectionname="authenticationService"type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"/>

</

sectionGroup>

</

sectionGroup>

</

sectionGroup>

</

configSections>

<

connectionStrings>

<

addname="DBConnectStr"...."/>

</

connectionStrings>

<

system.web>

<!--

Recupere la langue du browser-->

<

globalizationuiCulture="auto"culture="auto" />

<

trustlevel="Medium"/>

<

pagesstyleSheetTheme="Default">

<

controls>

<

addtagPrefix="asp"namespace="System.Web.UI"assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</

controls>

</

pages>

<compilationdebug="true">

<

assemblies>

<

addassembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<

addassembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies>

</

compilation>

<

httpHandlers>

<

removeverb="*"path="*.asmx"/>

<

addverb="*"path="*.asmx"validate="false"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<

addverb="*"path="*_AppService.axd"validate="false"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<

addverb="GET,HEAD"path="ScriptResource.axd"type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"validate="false"/>

</

httpHandlers>

<

httpModules>

<

addname="ScriptModule"type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</

httpModules>

</

system.web>

<

system.web.extensions>

<

scripting>

<

webServices>

</webServices>

</scripting>

</

system.web.extensions>

<

system.webServer>

<

validationvalidateIntegratedModeConfiguration="false"/>

<

modules>

<

addname="ScriptModule"preCondition="integratedMode"type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</

modules>

<

handlers>

<

removename="WebServiceHandlerFactory-Integrated"/>

<

addname="ScriptHandlerFactory"verb="*"path="*.asmx"preCondition="integratedMode"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<

addname="ScriptHandlerFactoryAppServices"verb="*"path="*_AppService.axd"preCondition="integratedMode"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<

addname="ScriptResource"preCondition="integratedMode"verb="GET,HEAD"path="ScriptResource.axd"type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</

handlers>

</

system.webServer>

</

configuration>noone for me?

Wait for response webservice

Hi everyone,

I'm kinda stuck over here. I hope someone can help me.

I have an input button on my page which has the onClick event and the onServerClick event. In the onClick event, the JavaScript code makes a call to a webservice. This webservice adds some records in a database table. After the webservice succesfully finishes, it response should be true.

The procedure goes like this:

function UpdateProduct(){...WebService.UpdateProduct(values, UpdateProduct_Callback);...}function UpdateProduct_Callback(response){return response;}

The onServerClick event refreshes the gridview I am using and selects the new record and its attributes.

The server side code executed by the onServerClick event should not be executed until the webservice is finished.

Is it possible to get the response in the UpdateProduct javascript function and return it? Like onClick="return UpdateProduct();"?

Thanks for your help!




No a callback is done after the WebService finishes on a seperate thread. Thats the whole point of a callBack, you dont have to wait for the method to finish executing. If you want to get the return value, wait for your method to finish, instead of using a callback.


Thanks for your quick reply.

Is there any other way to wait on the return value of the webservice through JavaScript without the callback? Or is it better do do it from the server side code?


You have to do it server side, JS only supports callbacks on webservice calls.


Thanks for your help. I will do it through server side code.

Wait Message...

Can anyone point me in the right direction on constructing a wait message for when an AJAX page is performing an action?

I would like to display a message that is centered on the screen when the user (for example) clicks a button to perform an action. Further, I would like to disable the page (and all controls on it) so that a response is received before continuing.

Thank you,

Jason

You might want to take a look at the UpdateProgressOverlayExtender in http://www40.brinkster.com/rajbk/FlanControls.html.

Take a look at this http://weblogs.asp.net/rajbk/archive/2007/01/08/using-the-updateprogress-control-as-a-modal-overlay.aspx to use it as a modal overlay.

Hope it helps.

German Afanador


You can use <asp:UpdateProgress > Control for that

or there are third parties control that can you use..

http://www.ajaxium.com/ajax-for-asp.net.aspx

Want To create Accordion Script Like Yahoo

Hello Everyone,

I m developing a website in Asp.Net 2.0 with AjaxControlToolkit.I want Buttons To Appear and functional like yahoo Home page..

Any Help Is Appriciated.

Nitin

Which buttons on the "yahoo home page" are you talking about exactly? There are a lot.

I'm not seeing any accordions there, I am however seing some tab controls... but maybe I'm just blind... can you be a little more specific please?

Regards


Hi Nitin,

I suspect that you are saying the Buttons Like "Mail, Messenager,Radio etc". Based on my experience, you should better use TabContainer instead of Accordion.

Best regards,

Jonathan