Showing posts with label parts. Show all posts
Showing posts with label parts. Show all posts

Monday, March 26, 2012

PageRequestManager : Whats the difference between doPostBack and _doCallBack ?

I want some parts of my web page refresh after a focus or changed event being made on a TextBox. What I want to acheive is get back to the server to do some code. I check the PageRequestManager and saw to way to make a postback to the server. What I want to do is get back to the server like I put a submit button without the whole page refresh. Some advices on that would be really appreciate !

It's not overly clear what your trying to do. Are you currently using UpdatePanels? If not, look into them:

http://www.asp.net/ajax/documentation/live/overview/UpdatePanelOverview.aspx

http://www.asp.net/learn/ajax-videos/video-78.aspx

http://www.asp.net/learn/ajax-videos/video-159.aspx


I know it's not clear. I'm sorry. I'll try to explain more clearly.

On a client event like OnFocus or OnBlur or OnChange, I'll check some client state for the input (TextBox) and take decision if I need to get back to the server to refresh some part of my menu. I try to implement a sort of contextual menu. So, when some part (say inside panel1) got focus, I want to make an ajax request to add some stuff to the menu. When the panel lost focus, maybe I'll switch the visibiliy of some parts of the menu on the client side or got back to the server to do some job.

I'm building a sort of UIManager. This Manager need to check some client state(hidden field) and decide to get back to server if I doesn't have all the state it need to add some part of the menu for the contextual part.

So, I put the menu inside and UpdatePanel UpdateMode=Always. When a control (maybe TextBox, RadioButton or panel) got focus, maybe I need to get back to the server. I want to know if it's necessary to put the control inside and Update Panel or I can write some code to submit the form and use eventArgument to know what I have to do...

I hope is it a little be more clear. I appreciate a lot the time you take to help me !


Hi,

Thank you for your post!

Based on my understanding, you just want to refresh the updatepanel via javascript(e.g On a client event like OnFocus or OnBlur or OnChange).

Check out like this:

use __doPostBack to refresh the UpdatePanel

If you have further questions,let me know.

Best Regards,


Hi,

Thank you for this great anwser. It's really what I was searching.

I have another question. I need a way to pass parameter from the client to know what to do when the page refresh on the server. For example, when the TextChanged occured on the TextBox1, I want to update some parts of the menu. Is it a good approach to pass parameter on the EventArguments of the __doPostback ? And which format do you recommand I use ? Or can you recommand me another way of doing that ?

function TextChanged(){ __doPostBack('ClientAjaxComm','');}
Thanks!

Hi,

It is a good approach to pass parameter on the EventArguments of the __doPostback.

Or you can store something into something hiddenfield,and get them at the server side.

It is up to you to which approach you use.

Thanks!

Wednesday, March 21, 2012

Partial rendering requires a browser that supports W3C DOM Level 1.0.

We have open a new web page using atlas in some parts.

Yesterday, I have check event log of the live site www.rusgelin.net

I saw hundreds of errors.

THe exception is "Partial rendering requires a browser that supports W3C DOM Level 1.0. ".

I might create my own browser detection logic in the atlas so if browser does not support atlas, I can easly disable script manager and replace new controls with old controls.

but this solution is not feasible solution. Please explain why does the error occur?

Sahin

I saw the same error, though I use Ajax beta 1.0. if this can't be sloved, I guess i have to turn off the Ajax beta, coz all the search engine spider can't index my web site.
hello.

well, that happens because?currently?the?client?side?features?need?a?browser?with?those?caracteristics?to?correctly?render?the?pages.?getting?those?warnings?means?that?you had several?browsers?not?compatible?with?dom?level?1?loading?the?pages.
all the error message are generated by spiders from like google , yahoo... why i concern this is if those spider can not access my site correctly, then my web site can not be indexed by those search engines, that will be a big problem.

.Net 2.0 is actually fairly good at detecting browsers / bots - so you can place some logic in your base page code that checks for the bot and disables the partialrendering...following is a simple code snippett -

If (HttpContext.Current.Request.Browser.Crawler == true)

{

<control logic to over-ride displaying of content (either allow or disallow)

}

else

{

(do the normal thing)

}


oh and if you haven't read this - it gives alot more detail...on the scm / enabling detecting etc...

Sorry, but that does nothing to address this problem -- the error is coming from UpdatePanel.

-MT


With Beta2 you can if the browser supports partial rendering declaring this in the page that contains the ScriptManager:


Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
If ScriptManager1.SupportsPartialRendering = True Then
ScriptManager1.EnablePartialRendering = True
Else
ScriptManager1.EnablePartialRendering = False
End If
End Sub

Cheers,
Juan


Will this cut out this error??

-- My system is throwing 100's these errors a day -- and I haven't even launched teh site!


Will this cut out this error??

-- My system is throwing 100's these errors a day -- and I haven't even launched the site!


Yes, it will... just try it...

After adding that piece of code to the PageInit Method, use whatever error tracking tool you are using to check that it's not throwing errors anymore


Hi,

Why dont you try with Beta2 , this is a new release of ASP.NET AJAX,

and you can also get the informatin about how to convert ATLAS to Beta2 inhttp://ajax.asp.net/default.aspx

Pradeep Kumar Bura


I was using up to now the Beta1 and encountering the raised exception for all search engine. Does the default settings of the Beta2 solve this problem directly, or do we need some extra settings to change or tweak?

Thanks in advance,
Joannès


I have the same question as Joannes and want to bring this thread back to the top of the list so someone might answer from MSFT.

Will/is theEnablePartialRendering property smart enough to set itself to false if the client browser does not support partial rendering?
Or will we have to performscriptManager1.EnablePartialRendering = scriptManager1.SupportsPartialRendering; on every page that uses a script manager?


hello.

well, currently, you have to do that :(