Showing posts with label update. Show all posts
Showing posts with label update. Show all posts

Monday, March 26, 2012

Instant GridView Refresh on Update Button Click

I have an application that allows for the updating of data in an Oracle table. I am using Atlas, with ObjectDataSources.

There is a quicklist gridview displaying the data, the user picks the record and it displays some options for updating the record in a seperate form on the page.

Upon clicking the update button the record is updated and a Verify changes button is displayed. When the user clicks the Verify changes button the page will display the correct update.

I have found no other way to to display the change on the Update button click.

Is there a way to instantly show the update with only one click of a button. I want the gridview to rebind and display the new update with the update button click. Why does it take two clicks to show the update?

are you using Gridview1.Databind() when you click update?

That forces an update no matter what.

Instant Update Panel

I have a page on my site that displays one image, the user can post a comment about the image and rate it from 1-5 using the ajax rating control. The page entire page postbacks when the user posts a comment about the image. I am trying to get the comments gridview to postback on its own. The rating control and comment text box and gridview of comments is in a usercontrol. I put it on my photo.aspx page and then put it in an updatepanel. The user now can add a comment (and it does add) but the page still needs to be reloaded how to do you it to instantly update for new comments? Ive seen this on facebook if anyone is wondering where the influence for trying to do this is, can anyone recomend how to do this? thanks in advance ! si!

Throw your code here and let me see..


it took about an hour but it makes sense now! after the comment has been posted, I get it to reset the gridviews datasource and then databind it! haha, thanks thoughBig Smile si!

instant update from database in aspx page using AJAX

Hi

Can someone point me in the right direction? I have a simple admin screen on my website which shows a tables values from my mssql database. How ever, rather than refreshing every 30 seconds to check for new entries, is there a way using AJAX which instantly updates the admin screen as soon as a new entry is inserted into the database?

thanks

There's not a way for the server to communicate directly with the client, unless the client requests it. The way functionality like what you want is implemented is to continually ping a light weight service that returns information about the last update to the underlying data.

For example, a JSON Web Method that returns the timestamp of the most recent item, which you can compare with the timestamp of the most recent refresh you did. If it's newer than your last update, then you can call a heavier method to update the table.

You can use window.setInterval() in JavaScript to set up the periodic check.


You really have no choice but to set a timer and check the database at a set interval, unless you want to get outside the realm of AJAX and DHTML.

All web based communication is initiated by the client. The only way to have server initiated communication is through an application, such as an AcitveX Object. There are a few (a very few) websites which address this topic but because it is so much more difficult, invasive to the end-users computer, and platform/browser specific, it is rare to find this type of setup.


thanks for your replies, very interesting. I guess the timer option is the way i will have to go. I wish to make the 'service' as light as possible, and the timestamp seems ideal - do you know of any examples, or have any tips on making this as optimal and least processor intensive as possible?

thanks again


You could basically combine these two posts from my blog, with setInterval, to do it:

http://encosia.com/index.php/2007/07/11/why-aspnet-ajax-updatepanels-are-dangerous/

http://encosia.com/index.php/2007/07/13/easily-refresh-an-updatepanel-using-javascript/


thanks gt, great posts - just had a quick browse of the rest of your site, you've got some excellent content on there!!

cheers Yes


I decided to put a simple example together, if anyone else is interested: http://encosia.com/index.php/2007/07/25/display-data-updates-in-real-time-with-ajax/

Intercepting Atlas on client

Iv been pndering on this for a couple of days

How can i go about intercepting a particular update, for example. If ihave a page with a grid view inside an updatepanel, a timercontrol thatfires and the gridview is reloaded. If this takes time i'd like to notify the user.
So lets say you want to notify the user when ever any type of routineis being run where atlas is communicating with the server. And lets sayyou want to do something as simple as gmail, a little red div appearsand dissapears accordingly

Any suggestion / ideas would be greatly appreciated

Thanks

DrayI've seen this question asked quite a few times - infact i spent thelast the last 3 hours going through Wilco's Browser and theonline documentation.

I am Still stumped.

This should be a pretty thing - you have a update panel - and you need a callback for it ? Please somebody from the team ...

We can have a callback if we are manually making a call - but where dowe specify the callback location if you have an update panel ?
Anybody ? how can we intercept in Javascript if an update is complete(using update panel on the page).

Is Something like Function OnComplete() Available?

This will help is making loaders etc...

Atlas team ?
No response means it's impossible?

hello.

have you tried using the updateprogress control? it should solve your problem...


Thanks for response

but I do not see how updateprogress can help me.
I need to know that particular update action has been completed.
Maybe I've overlooked somethig?

hello again.

see if this page does what you need:

<%

@.PageLanguage="C#" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

scriptrunat="server">void h(object sender,EventArgs args)

{

info.Text = ((

Button)sender).ID +" " +DateTime.Now.ToString();

System.Threading.

Thread.Sleep(2000);

}

</

script>

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headrunat="server"><title>Untitled Page</title>

</

head>

<

body><formid="form1"runat="server"><atlas:ScriptManagerrunat="server"id="manager"EnablePartialRendering="true"></atlas:ScriptManager><atlas:UpdatePanelrunat="server"ID="panel"><ContentTemplate><asp:Buttonrunat="server"ID="bt"Text="Submit"OnClick="h"/><asp:Literalrunat="server"ID="info"/></ContentTemplate></atlas:UpdatePanel><atlas:updateprogressrunat="server"ID="prog1"><ProgressTemplate>

Updating...you can put what you want here... an img, etc;

you can position it with css, if that's important

</ProgressTemplate></atlas:updateprogress></form>

</

body>

</

html>
I've created exactlly the same demo web on my machine :).
But I need to know about completion of an action on client side.
I need to call my own java script function.I think that it should base on
interception of Atlas call and adding my own handler of oncomplete event.

hello.

maybe something like this?

http://forums.asp.net/thread/1263367.aspx


Luis Abreu:

hello.

maybe something like this?

http://forums.asp.net/thread/1263367.aspx

Thanks, that what I've been looking for although it looks like kind of hack :).
How can I get a list of available methods and properties of "args" and "obj" objects
from following event handler:
function changed( obj, args )

I need to know for examply which UpdatePanel caused post back.

Thanks again

Saturday, March 24, 2012

Invalid postback or callback arguement?

Hey, i have a page with a gridview in an update panel, which has a triggered by the user clicking button1, the gridview has a row_command that deletes the data in the gridview, the code worked fine before i added the update panel, but now i tested my page again, i clicked button1, and then tryed to delete the new item in the gridview.

I got the error message "Event validation is enabled using <pages enableEventValidation="true"/> in the config or in the page head.

My page head bit reads :

<%@dotnet.itags.org. Page Language="C#" MasterPageFile="MasterPage.master" EnableEventValidation="true" AutoEventWireup="true" Inherits="Masters_Default2" Title="Untitled Page" %>

But i still get the error,... where am i going wrong? thanks Si!

Have a look at this blog:http://blogs.msdn.com/amitsh/archive/2007/07/31/why-i-get-invalid-postback-or-callback-argument-errors.aspx

-Damien


Make it false and then try...

Let me know what happend

Invalid postback or callback argument

I keep logging several errors listed below. I have atlas running on my site with update panels on several pages. This error seems to occur if the user uses the browser "Back" button. Is there a way to handle or prevent this error?

Error on Page: /NewestMembers.aspx Error Date/Time: Aug 29, 2006 - 6:57:37 AM Error Message: Invalid postback or callback argument. Event validation is enabled using in configuration or in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. Error Source: System.Web Session Variables: Query String Variables: Form Variables: __EVENTTARGET = ctl00$_MainContentPlaceHolder$_NewestMembersGridView __VIEWSTATE = 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 __EVENTVALIDATION = 2YRA4zH2000xi7Lksp82pi1+tHABGzOHht7Et+u77Weu3g/BHP9mPNIn43W1htX8pl8A+lgBfwaLZ1wEqFInQUSD95SpvsF87mANctA9ZJk= __VIEWSTATEENCRYPTED = ctl00$_MainContentPlaceHolder$ScriptManager1 = ctl00$_MainContentPlaceHolder$_upNew __EVENTARGUMENT = Page$2 __PREVIOUSPAGE = zubEIIwaLs1mi-rZEVX2KuSBbYvdLRKqzF9n-nadHR81 Error Stack Trace: at System.Web.UI.ClientScriptManager.Valid ateEvent(String uniqueId, String argument) at System.Web.UI.Control.Valid ateEvent(String uniqueID, String eventArgument) at System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postD ata) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Hi,

I don't know your scenario but you could try to give a look tothis article by Joteke and see if it could be your case.


All of my pages are using the object datasource. I'm not doing any manual databinding.

Any other ideas out there?

Thanks for your suggestion


I have the same problem.

Here is my scenario. I have an update panel along with an AutoCompleteExtender. I have a DropDownList with an autopost back to make changes to the ContextKey property of the AutoCompleteExtender on SelectedIndexChange. which is causing me to get the post back error.

Any fixes for this?

Thanks,
Kam

Invalid postback or callback argument on page back

Hello,

I ran into this by placing myselft as the final user of my web application.

I have several pages using AJAX controls (update panel, autocomplete extender, etc), and I noticed that when I have redirect to another page, and till there, using the IE back page button, the previous page is loaded and then a message error is prompt (Invalid postback or callback argument)

By now I'm disabling the - PageEventValidation - but, actually I'd like to solve it in a better way.

Thanks in advance guys,

Hi Manotas,

Do you have databound controls, like a DropDownList or a GridView? If so, did you make sure they are initialized in a block that checks for inital page load?

For example:

if (false == Page.IsPostBack)

{

// code for initial load goes here

}

else

{

// code for PostBack from same page goes here

}

Pete


Hi Peter,

Thanks for reply.
I do have bound control. After reading at your post, I checked the initialization of my databound controls.
I realized that there is a gridview which I am initializing at first loading but not during postbacks, however, when the page is reload by using the back button on the browser, there is a postback and maybe is there where is my error. The thing is that I'm not sure what kind of validation I could do there since I wouldn't like to change the data of the parameters used on the select's datasource ...

I tried to find a pattern on the error... I must correct what I said about the invalid postback after the page's loading. In fact, I realized that it was happening only sometimes, and only when I was clicking on certain linkbuttons, on the other side, if I click on others buttons I was not having any problem at all. Also, as you mentioned the fact of look at databoud controls, I began testing and I found that I was getting the error only when I was turning back to the page and my gridview was visible (I'm using a multiview control, and the gridview I mentioned above is contained in its view).

By now, I restored the PageEventValidation and added at the update panel a postback trigger for the controls which are making visible my gridview.

Since I'm not receving the error message anymore... let's see I'l heard about it later...

Cheers

Invoke an UpdatePanel update from client script

I'm writing an application which is predominantly a client-centric application but I need to update a part of the page from a client script action. What is the correct way to do that? I presumed that you simply set the UpdateMode of your UpdatePanel to Always and then implemented ICallbackEventHandler on the page to do the async postback. I've done that, but my UpdatePanel is not updating... help :)

In my ClientCallback, I'm essentially rebinding the control that sits inside the UpdatePanel and then explicitly calling Update() on the UpdatePanel... but nothing.

Hi digory,

http://encosia.com/2007/07/13/easily-refresh-an-updatepanel-using-javascript/

Is this what you are looking for?

Wim.


It is. I was just trying that solution as you posted and it works fine. Thanks! Smile

Invoke Javascript method after partial postback ?

Howdy All,

This might be an easy one but I don't seem to be able to figure it out.

Basically I have an update panel which contains a button that causes the partial postback. After the postback I'd like it to call a Javascript method.

I tried looking to set it on an atlas object and I even tried some hacks like putting a literal control in the Update Panel and setting the text to <script language=""Javascript"">testFunction();</script>" but still no cigar.

Any help would be greatly appreciated.

Try registering your script on the server-side, during the partial post. The script you register will be executed when the response is received from the partial postback.

Page.ClientScript.RegisterStartupScript

-Tony


in my callback function i havestring js = "alert('s');"; Page.ClientScript.RegisterStartupScript(GetType(), "key", js);It doesn't fire

casaubon:

in my callback function i have string js = "alert('s');"; Page.ClientScript.RegisterStartupScript(GetType(), "key", js); It doesn't fire

You need to wrap your js in <script type="text/javascript"> </script>, or use the overloaded RegisterStartupScript specifying "true" for the last parameter.

Hope this helps,

-Tony

Invoke JavaScript method after partial post back

  Hi,
 Im trying to invoke a javascript method after a partial update has occured from an update panel. I found some code for which i beleive works for an old version, but it doesn't work for the released version.
 Does anyone know how i can invoke a javascript method after post back?
 
 
1 function afterPostback()2 {10 }1112 function PageRequestManagerPropertyChanged(sender, args)13 {14if (args.get_propertyName() =="inPostBack")15 {16if (!$object("_PageRequestManager").get_inPostBack())17 afterPostback();18 }19 }2021 function pageLoad()22 {23 $object("_PageRequestManager").propertyChanged.add(PageRequestManagerPropertyChanged);24 }

You can handle _endRequest to do that. Try something like this:

var prm = Sys.WebForms.PageRequestManager.getInstance();prm.add_endRequest(afterPostback);function afterPostback(sender, args){}

Note: This code has to be placed below the ScriptManager control.


Brilliant, that works a treat.

Thanks

Invoking postback for an update panel in a parent document

The default page for my website contains a div with links to user data that is only visible when a user is logged into my site. The login control lives in an IFrame within the default page (see sample code below).

Now, how can I get the udpate panel on the default page to recognize an event or a button click inside of the login control? I'm not looking for a tutorial on getting the login control to work, but rather any link button inside of the IFrame's update panel forcing the default page's update panel to post back. Both pages have a script manager.

chopped down version of existing code:

dafault page:

1<asp:update panel id="upUserPrefs" runat="server" updatemode="conditional">2 <contenttemplate>3 <div id="userPrefs" runat="server"><a href="prefs.aspx">preferences</a></div>4 </contenttemplate>5</asp:update panel>

IFrame source page:

1 <asp:UpdatePanel ID="updateSignon" runat="server" UpdateMode="conditional">2 <ContentTemplate>3 <asp:Table ID="tblLoginCtrl" runat="server" visible="false" Width="100%" HorizontalAlign="Left" CellPadding="0" CellSpacing="0">4 <asp:TableRow>5 <asp:TableCell ID="tcLoginCtrl">6 <uc1:LoginControl ID="LoginControl" Enable runat=server LoginStyle=Login_Home />7 </asp:TableCell>8 </asp:TableRow>9 </asp:Table>10 </ContentTemplate>11 </asp:UpdatePanel>
Any help would be greatly appreciated.

</p><p> (this.Parent.Parent as UpdatePanel).Update();</p><p>

is what I use.....however i have other problems...LOL. but that should fix yours.


Hi,

I think you can add a invisible button in the default page, set it as a trigger for the update panel.

Then add a javascript function in the contained page, in which invoke the click event of the button in the container.

Please feel free to let me know if there is any problem.


I tried that before, but when I have 2 instances of the same control on my page, it fires events for both of them. Or did I do something wrong?? Should this be happening? Have you ever heard of this??


In my opinion, it's normal that two control of the same type would behavior the same.

Wednesday, March 21, 2012

Is ASP.NET AJAX UpdatePanels are dangerous ?

Hi,

I am a big fan of using 'Update Panels'. Not because of the only simplicity but also bcoz of my belief on the AJAX framework.
But, at the same time lots of architects do say that, PageMethods [http://metasapiens.com/PageMethods/Tutorial/VS2005/] are more efficient than Update Panels.
Here is the link - ASP.NET AJAX UpdatePanels are dangerous.

http://encosia.com/2007/07/11/why-aspnet-ajax-updatepanels-are-dangerous/

After reading the page, I am quite suspicious on Update Panel and now think that really PageMethods saves perfomance overhead.But at the same time, simply by going thru few pages, accepting the same seems to be quite impractical.

Please let me know, is really PageMethods are more efficient than UpdatePanel. If yes, then please list me the things that cannot be done using PageMethods, which can be done by UpdatePanel.

Regards,

Arun

Hi,

dangerous is itself dangerous word in this context, but truth is that UpdatePanels, by design and due to their nature, pass a lot more stuff over the wire than PageMethods. Remember, they pass the changed markup, ViewState etc over the wire.

What the article/post says about it is true. However, it is always context dependant, is it an issue. Is the Page so big that async postback with UpdatePanel is unbearable? There are also ways to optimize things like reducing the unneeded ViewState, using multiple UpdatePanels to split the page to as-small-as-possible regions which need to be updated using UpdatePanel. E.g update only the parts which really need to be updated instead of passing everything you have on the Page. Using one UpdatePanel for entire page for example is not wise, if the page can be split up.


joteke:

using multiple UpdatePanels to split the page to as-small-as-possible regions which need to be updated using UpdatePanel. E.g update only the parts which really need to be updated instead of passing everything you have on the Page. Using one UpdatePanel for entire page for example is not wise, if the page can be split up.

I think it's important to keep in mind that even if you do break the page into multiple UpdatePanels, the entire ViewState is still sent to the server. On top of that, the Page and every single control in its control tree is reinstantiated, even if you're only visibly updating a tiny portion of the page.

The overhead associated with this can be relatively massive.


It would be nice to see if UpdatePanel could evolve so that its child controls would have viewstate field of their own (one per Panel), however that brings a lot complexity to the picture (especially from MS perspective) but also for developer to be explicit which Panels access each others child controls (that's why page now loads entire state because it must assume any control could be accessed).

While I'd use PageMethods too mostly today, I also like easiness of UpdatePanels and look for its evolution in vNext (meaning the one after Orcas/2008)


hello.

well, lets be honest: the updatepanel is a beautiful piece of engineering. having said that, i think that ajax is mostly done on the client, so major js,css, xml, etc is required. I'm not sure if changing viewstate is the way to go here. i'm thinking that what should be changed is the way we, developers, face our projects...

Is autopostback=true required on checkboxes for asyncpostbacks

My checkbox will only do postbacks when autopostback=true even when i have defined anAsyncPostBackTrigger trigger for the update panel. Is this behavior by design (see code below) ?

Thanks,

Brent

------

<%

@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajax" %>

<htmlxmlns="http://www.w3.org/1999/xhtml">

<body>

<formid="form1"runat="server"><div><asp:ScriptManagerID="ScriptManager1"runat="server"/><br/><asp:UpdatePanelID="UpdatePanel1"runat="server"ChildrenAsTriggers="False"UpdateMode="Conditional"><ContentTemplate><asp:LabelID="Label1"runat="server"Text="Label"Width="94px"></asp:Label><br/><asp:checkboxID="chk"runat="server"Text="Button"OnCheckedChanged="chk_CheckedChanged"/><br/><asp:ButtonID="Button1"runat="server"OnClick="Button1_Click"Text="Button"/><br/></ContentTemplate><Triggers><asp:AsyncPostBackTriggerControlID="chk"EventName="CheckedChanged"/></Triggers></asp:UpdatePanel><br/><asp:LabelID="Label2"runat="server"Text="Label"Width="91px"></asp:Label></div></form>

</

body>

</

html>

Public

PartialClass ajaxInherits System.Web.UI.PageProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Load

Label1.Text = Now.ToLongTimeString

Label2.Text = Now.ToLongTimeString

EndSubProtectedSub Button1_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)

Label1.Text = Now.ToLongTimeString

UpdatePanel1.Update()

EndSubProtectedSub chk_CheckedChanged(ByVal senderAs System.Object,ByVal eAs System.EventArgs)'Never fires when checkbox is clicked unless autopostback=true.

Label1.Text = Now.ToLongTimeString

UpdatePanel1.Update()

EndSub

End

Class

yes, this is the correct behavior...
what it does is send a request to the server as soon as the checkbox status is changed.

So you're doing good :)

Great. Thanks for the confirmation, Peter.

Brent

Is it necessary to run the Asp.Net Ajax Installation Wizard

I have an issue where my web project works well locally with AJAX, Update Panels and Partial Rendering. Everything is kosher.

As soon as I copy my project to a staging server, any page that uses Validators that become enabled through Partial Rendering seem to have issues. The validators cause script errors on some pages, while on others, they are not visible.

The only difference between my local environment (that I can think of) that may affect this is that I ran the AJAX installation on my local workstation while on the Test Server I just copied the Ajax DLLs into the bin folder.

So does anyone know this may be my problem? Is it necessary to run the full install of ASP.Net AJAX for everything to work well? If not then I may need to resort to custom Javascript for client validation which I'd rather avoid since I can't run the install on the server.

no, but you will need to include the AJAX DLLs in your BIN folder then.


Thanks for your reply! It's good that all I need are the dll's since that's all I have access to do. But that now raises the question of why is it all good locally and not remotely on my test server.

Oh well.. I guess I have 2 options:
(1) Javascript for validation
(2) No partial-rendering.. postbacks and use FakeAjax transitions to make nice ajax-like UI.


alcsharp:

Thanks for your reply! It's good that all I need are the dll's since that's all I have access to do. But that now raises the question of why is it all good locally and not remotely on my test server.

Locally the Ajax DLLs are in the GAC, since you used the Installation Wizard. On the server they aren't there, so you need to explicitly include them.


Oh, and I'm betting you are missing a DLL...
What did you include?


I only included System.Web.Extensions.dll. Since I'm not using the Control Toolkit at all I didn't add it.

Is it possible to cancel update of an UpdatePanel?

Hi there,

I have an UpdatePanel in my .aspx page. I have a timer control which "ticks" on regular intervals (say, every minute or every 20 seconds) and causes the panel to update (which is specified via the UpdatePanel's Triggers collection).

On the server side, I check whether there have been any changes since last update and whether I need to actually update the panel. If no changes, I don't want the UpdatePanel to flush the same contents to the client browser as it already has. So what I want is kinda "cancel" the UpdatePanel under certain circumstances.

How can I achieve that? Thanks in advance.

Hi,

You should set UpdatePanel.Mode = Conditional, remove all triggers from your UpdatePanel and update your panel programmatically in the tick event.

 <atlas:UpdatePanel ID="udp1" runat="server" Mode="Conditional"> <ContentTemplate><%-- Put your content here--%>
 </ContentTemplate> </atlas:UpdatePanel> <atlas:TimerControl ID="tc1" runat="server" Interval="60000" OnTick="tc1_Tick" />
protected void tc1_Tick(object sender, EventArgs e){if (ThePanelMustBeUpdated())this.udp1.Update();}

Oh.. right... it's so simple..

Thank you very much