Showing posts with label postback. Show all posts
Showing posts with label postback. Show all posts

Saturday, March 24, 2012

accentuated characters loss with updatepanel

Hi,

I would appreciate if you could tell me how to prevent accentuated characters áéíóú losing when updatepanel postback, the updatepanel refresh a listbox that is filled from a textbox, but in listbox appears unicode characters instead.

example:

é -->??

Thanks

Hi!,

Did you try using the HTML character code instead of the actual letter? (Like é instead of é )

http://www.w3.org/MarkUp/html-spec/html-spec_13.html

Cheers,

aborting postback

hi guys,

Just wondering how do i or is it even possible to abort a postback when using atlas. The reason why i am asking is that i have some text fields that require validation before a async postback is performed. If the validation fails then i would like to cancel or abort the async postback and alert the user.

any syntax or code snippets would be great

thanks

hello.

maybe something like this: $object("_PageRequestManager").abortPostBack();

Abort AJAX Postback

Hello,

I am developing a project, which has many things on admin and merchant side, but very less on user site.

The user site contains a page from where user can search the data. This is the main page on user site.

The search page contains 10 sliders and 6 different parameters which are checkboxlist. There are at least 5, 00,000 records in the database.

I am using database paging to get result fast.

I am using AJAX on this page.

Now the problem is that when ever I move the slider and release it then button click event is called from JavaScript.

I have 10 sliders on the page now when I move all the sliders one by one the page becomes very slow. It performs all the post backs in the queue.

Is there any way from which I can cancel the previous post back if the page is already inasynchronous postback.

I have even tried the following code when the user moves the slider; I call the following function;

function StopPostBack()

{

var CheckPostBack = Sys.WebForms.PageRequestManager.getInstance();

if (CheckPostBack.get_isInAsyncPostBack())

{

CheckPostBack.abortPostBack();

}

}

But this too not helped me much.

I think the problem is that when ever user moves the first slider and release it the button click event is called and in that the stored procedure is called to fetch the data.

Now when user move another slider the function StopPostBack is called but till that time the application has started the database operation.

My stored procedure taking less then 2 sec to return the data. But when there are multiple movements of the slider the page is very slow.

How can I make is fast.

Regards,

Deepesh Verma

Hi Deepesh,

Please refer to this thread, http://forums.asp.net/thread/1695055.aspx
There is no easy way to abort the execution on the server from the client.
I think you need to find a way to reduce the occurrence of postback on the client.

Ability to fine-tune control over request validation

This is a subject that crosses multiple disciplines, but I'm posting it here (AJAX forum) because it was a partial postback (with Sys.Webforms.PageRequestManagerServerErrorException error) that stumped me.

I have a form that submits regular <input /> tags inside an UpdatePanel (not server controls). I was finishing debugging when I tried submitting something like "test<test>test" for a form value. The page would not do the partial update, and instead threw the error mentioned earlier in an alert box.

After messing around I figured out that it is ASP.NET guarding me against some malicious entry by hackers.

Changing ValidateRequest to false fixed the problem, but I hate to wipe something out completely, without knowing what I'm wiping out.

Is there some way to fine-tune control of what gets validated? Is there any way to know exactly what I've just disabled by setting ValidateRequest to false?

Thanks...

I'll give this one obnoxious bump, just to see if there's someone who may have some knowledge on this topic. If not, maybe it's just one of those areas where MS doesn't want to say what's going on under the covers. It would be nice to know what is going on with the validation, and what, if anything, can be controlled. For example, it would be great to subclass the functionality.


Hi,

It checks the following strings:

1. Is there a "&#" contained in the input string

2. Is there a "<[char]", "<!", "</" in the input string.


Great, thanks Raymond!

Wednesday, March 21, 2012

A postback via update panel resets TabIndex?

I have a few controls inside an update panel. One of them is a dropdownlist with autopostback = true. After it postbacks (you know in Ajax style, no full page postback) the the tab indexes of the controls seem to get ignored or reset. I end up back at the first control in the tab index or else sometimes no control is focused when hitting the tab key.

Anyone find the same issue?

There's a workaround I found, just in case you're using ASP.NET Ajax.

In my example, I have a FormView and two DropDownLists, the first is called "ddlCountries", with AutoPostBack=True. The second is called "ddlStates".

In my case, my page is using an ScriptManager. And my FormView is inside an UpdatePanel.


Just create an event for the "ddlCountries" as follows:

protected void ddlCountries_SelectedIndexChanged(object sender, EventArgs e){DropDownList ddlStates = (DropDownList)FormView1.FindControl("ddlStates");ScriptManager1.SetFocus(ddlStates);}

And voi-là!!


Thanks I found that solution too, its a pity the tabindex settings are ignored with partial postacks in ASP.net Ajax.

a full postback within partialpostback and server event handler ?

I face several problems about using Atlas. Here is the problem :-

I have several anchors inside a big updatepanel. With these anchors, some of them have to raise a full postback, since i can't use a server.transfer when running in particalpostback call. I know i can create a dummy element outsite the updatepanel, and let those anchor (which need a full postback) call a _dopostback with that dummy element to raise a full postback. The problem is ... because there is a server event handler associated with each anchor, and If my understanding is right, by calling _dopostback manually, the server event handler will never get executed. I know i can set up some __EVENTARGUMENT and do whatever i want .. but is there any smarther and better solution ?

Why do you need the anchors inside the UpdatePanel? Can you have them outside (and therefore generate a regular postback)?

A <select> box with 10000 options inside UpdatePanel brings async postback to a craw

I have a databound FormView control inside an UpdatePanel. Also in the UpdatePanel is a <select> box with 10000 options. (The <select> box is not in the FormView.) When I make a change to the FormView and click "Update" it takes close totwo minutes to complete the update. If I move the <select> box and the FormView outside of the UpdatePanel and repeat the same steps, the update is immediate! Can anyone help me solve this? I don't understand why it's taking so long to post back when it's in the UpdatePanel. But I need the update to occur in the UpdatePanel for the Async Postback and I also need the <select> box inside the UpdatePanel as well. Thanks in advance! -figz

I gotta ask. Where did you find a user willing to choose among 10,000 options?

Jeff


Great question! My users are our accountants; need I say more? :-) They have to choose from our entire Chart of Accounts when filling out the form.

i agree with jeff. come on, be real. your accountants must be dead after clicking 10,000 options. it's not only clicking but they have to read first before clicking.

there's no solution to your question. that's how Updatepanel works. or you can split the 10,000 to several pages. geeze, i would rather die than working for your company =)


...not sure what you mean by "clicking 10000 options." It's a dropdownlist sorted by account number. Even though there are 10000 choices, it's easy to find the one you want quickly.


Anyway, I tried moving the dropdownlist outside of the updatepanel, but then it doesn't get databound. So I moved it into another UpdatePanel but it's still slow. I think I what I need is for the second UpdatePanel to have UpdateMode=Always so that the DropDownList gets Databound, but also UpdateMode=Conditional so that it doesn't get posted back when my FormView does. Any suggestions for how to accomplish that? Thanks!


LOL, my bad.

still i don't want to work for you company. =)
10,000 options in a dropdown list is also slow; there is too much data.

would a search form work? how about autocomplete extender? or list A,B,C,D to ... Z ... when he/she clicks a letter, then display all the options under that letter, like a dictionary... will it do?


I appreciate the suggestion, but from a UI standpoint, the accountants are used to choosing from a big list in Excel so they like the 10000 item dropdownlist. I'm sure there is a way to make this work since it works fine when it's not in an UpdatePanel. I managed to fix it partially but I still need help. Here's what I did:

I moved the DropDownList into its own UpdatePanel with UpdateMode=Conditional. When the FormView databinds, it also binds the DropDownList to the 10000 items and calls Update() on that new UpdatePanel so that it shows up. I'm able to then save my FormView and it works very quickly. HOWEVER, all subsequent saves are still slow. Why does it work quickly the first time, but slow every other time? Thanks in advance for your help. -figz


Upon further research... I found this thread: http://forums.asp.net/p/1089566/1629936.aspx

What is happening is that the server side is happening very quick but IE's javascript rendering is very slow to render those 10000 options. (Incidentally, the page renders in about 1/16th the time in Firefox). So the first time the page loads, the 10000 options are being generated server side, but the subsequent times, they are being done async by javascript which is very slow.

My only option it seems is to move the DropDownList outside of any UpdatePanel and generate the list on PageLoad. The problem is that the list is dependent on items chosen inside the UpdatePanel which means that if they change, I have no way of refreshing the DropDownList because items in an UpdatePanel can't talk to items outside of the UpdatePanel. Any other ideas? Thanks! -figz


Since your users want the luxury of having 10,000 items in the List Box, how about you sacrifice your luxury and replace the UpdatePanel with WebService Call (Client Centric Development Model)?


I'm new to AJAX so I'll have to research that. In the meantime, can you provide an overview of what this means and how it will help my issue? Thanks! -figz


You might want to read the following thread and the side threads. Although not exactly the same, you will get a great deal of insight into the problem. In fact what you want to do can probably be done almost instantaneously by combining some client side Javascript with the knowledge of exactly what it is that you need to accomplish.

http://forums.asp.net/p/1065352/1540804.aspx#1540804

Once you have read that, take a good look at the PageRequestManager and the examples involving it. You will find a lot of power to execute the operations far faster and realize the UpdatePanel is not always the best choice. Updating only exactly what you need to and without the catch-all client-side code of the UpdatePanel is the answer.


Just for completeness, this link is also helpful.
http://forums.asp.net/p/1158591/1910791.aspx