Showing posts with label postbacks. Show all posts
Showing posts with label postbacks. Show all posts

Wednesday, March 28, 2012

Postbacks and animationextender / modalpopupextender

I have a usercontrol which handles its own postbacks. I would like to place this usercontrol in a panel, which gets displayed either using the animationextender or the modalpopupextender. The problem is that when a user clicks on any control which fires the postback in the usercontrol, the usercontrol disappears from the page.

Would anyone happen to know how to prevent the target panel of a modalpopupextender or animationextender from disappearing on a postback? Thanks!

Have you gotten anywhere with this problem? I just came across this issue and need to also understand how to properly do this. Thanks.

postbacks and ajax

I have created dynamic datagrid with vb.net using (no javascript) that has checkboxes and dropdowns, and when checkboxes checks it postsbacks, and shows data comes from database, now I want no postbacks to happen. I guess I can do that in ajax, but need a help on it, since I have never done that before and don't know ajax. Can anybody help me on that?

Hi There,

If you are using .net 2.0 with ajax.net

Try following, this is do a callback when you click on your checkboxes

<asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager>

<asp:UpdatePanelID="updatepanel1"runat="server">

<ContentTemplate>

YOUR DATAGRID HERE

</ContentTemplate>

</asp:UpdatePanel>


I am using 1.0 and didn't work on that, I need 2.0 then? Do I need to start with ajax enable website or can I add it those lines later to existing project ?


actually my asp.net version 2.0, but ajax 1.0


Check out all the vid's on ASP.NET AJAX:

http://www.asp.net/learn/videos/default.aspx?tabid=63

This one in particular should help:

http://www.asp.net/learn/videos/view.aspx?tabid=63&id=75

This one discusses what is needed to use ASP.NET AJAX with an existing application:

http://www.asp.net/learn/videos/view.aspx?tabid=63&id=81


Unfortunately I cannot view videos, it says respond denied.


What d4dennis@.inspir3 said should work but you have to add somestuff to your web.config file before the site is "ASP.NET AJAXenabled".


This goes under the <configuration> tag

  <configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>

 This goes inside the <pages> tag:
  <controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>

If you haven't made any changes to your <compilation> section replace it with this: (Otherwise change it accordingly)
  
<compilation debug="false">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="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>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>


  Finally add this just above the </configuration> tag:
 
 <system.web.extensions>
<scripting>
<webServices>
<!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
<!--
<jsonSerialization maxJsonLength="500">
<converters>
<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
</converters>
</jsonSerialization>
-->
<!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
<!--
<authenticationService enabled="true" requireSSL = "true|false"/>
-->
<!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
writeAccessProperties attributes. -->
<!--
<profileService enabled="true"
readAccessProperties="propertyname1,propertyname2"
writeAccessProperties="propertyname1,propertyname2" />
-->
</webServices>
<!--
<scriptResourceHandler enableCompression="true" enableCaching="true" />
-->
</scripting>
</system.web.extensions>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="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"/>
<add name="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>

Hope this helps!


Thank you for laying out this for me, I just found the same thing right before you have sent me and implemented, so web.config is fine now, but in my existing project , I have lots of panels, tables etc. and I tried to put my datagrid inside the this format

<body> <formid="form1"runat="server"> <asp:ScriptManagerID="ScriptManager1"runat="server"/> <asp:UpdatePanelID="UpdatePanel1"runat="server"> <ContentTemplate> <div>

datagrid

</div> </ContentTemplate> </asp:UpdatePanel> </form></body>

which I don't want it to refresh whole page is working but it is something weird happening inside the my grid, I have checkbox and dropdown and textboxes right, when I checked the checkbox, page is not refreshing which is Good, what I want, but because I need to enable dropdown when checkbox checked, refresh happening inside the grid to dropdown, I wonder if I put my updatepanel and contenttemplate to right place or not?


I need when checkbox checked inside the grid, my dropdown inside the grid should enables, gets filled with data without refreshing the page or datagrid. Right now, it is not refreshing the page but inside the grid almost like part of the grid where dropdown there gets refresh( looks like flashing at that area where dropdown sits) I don't want that.

I wrote a lot of working code (at SERVER SIDE) didn't use javascript that does things inside the datagrid when user checks checkboxes. But it was keep refreshing the page with each checkbox clicks that's why I need to use ajax.

PostBacks are not working

Help!

As soon as I change to EnablePartialRendering="true" so that I can get all the fancy Atlas functionality the buttons stop working. Weird thing is that the project was working but now it does not. I've reinstalled Atlas and I still have the same issue.

The aspx code is:

<

atlas:ScriptManagerid="s1"EnablePartialRendering="true"runat="server"/>

<

asp:PanelID=panel1runat=serverHeight="140px"Width="475px">

<

atlas:UpdatePanelID="p1"runat="server">

<

ContentTemplate><asp:LabelID="lblHello"runat=serverVisible=false>Hello World</asp:Label><asp:ButtonID="Button1"runat="server"Text="Button 1"Visible=falseOnClick="Button_Click"/><asp:ButtonID="Button2"runat="server"Text="Button 2"Visible=trueOnClick="Button_Click"/>

</

ContentTemplate>

<

Triggers>

<

atlas:ControlEventTriggerControlID="ImageButton1"EventName="Click"/>

</

Triggers>

</

atlas:UpdatePanel>

</

asp:Panel><asp:ImageButtonID="ImageButton1"runat="server"ImageUrl="~/images/but_New.gif"OnClick="ImageButton1_Click"/>

The cs code is:

protectedvoid ImageButton1_Click(object sender,ImageClickEventArgs e)

{

this.lblHello.Visible = !this.lblHello.Visible;

}

protectedvoid Button_Click(object sender,EventArgs e)

{

this.Button1.Visible = !this.Button1.Visible;this.Button2.Visible = !this.Button2.Visible;

}

And the web.config file has the following (I didn't change anything on this)

<

controls>

<

addnamespace="Microsoft.Web.UI"assembly="Microsoft.Web.Atlas"tagPrefix="atlas"/>

<

addnamespace="Microsoft.Web.UI.Controls"assembly="Microsoft.Web.Atlas"tagPrefix="atlas"/>

</

controls>

Thanks!

Hey!

try this in your Page_Load:

Page.ClientScript.GetPostBackEventReference(

new System.Web.UI.PostBackOptions(this.(control that is not posting back));

I had the same problem, and this line did the trick. This generates the _doPostBack function everytime the page loads. I'm not sure why is this necesary...

hope this works for you!


hello.

i've copied your excerpt and it looks like it's running ok here...


OK so this is REALLY weird.

My atlas post backs don't work when the page fist loads, but once I refresh the page everything works great. I've compared the webpage source code for page when it works and when it doesn't and the source code is identical.

Anyone have any ideas.

Help!!!


I'm having the same problem. Does anyone have a solution?

Postbacks not working

OK so this is REALLY weird.

My atlas post backs don't work when the page fist loads, but once I refresh the page everything works great. I've compared the source for webpage when it works and when it doesn't and they are identical.

Anyone have any ideas?

Hi,

could you show us the relevant code?

Please see the following post for the code:

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


hello again.

as i said, i've loaded the page and it is working here with or without partial rendering. hum...have you tried building a new web site by using the atlas template?


When I build a new web site useing the atlas template I get the same issue (Atlas only works on reload)

Sample Atlas projects I've downloaded (AtlasControlToolkit) seems to work fine.


hello again.

there's some weird stuff!!! btw, have you used fiddler to see what's happening during a partial postback?


Yes, fiddler isn't getting anything.

postbacks, atlas and search engines

I've always tried to avoid using postbacks for things like paging in e-commerce solutions to make them search engine friendly.

however I'm really keen to use Atlas for various things like paging products but this is going to force me to use postbacks.

Are there any aproaches to make make asp.net postbacks and atlas pages search engine friendly?

Take the simple example of a link to go to the next page.

Is there a way I can take a traditional nexpage link instead and 'Atlas' it?

e.g. products.aspx?brandid=3&page=3

Your best bet here is to generate an appropriate Google Sitemap file, submit links through Yahoo SiteExplorer, and hopefully MSN/Live.com (SiteMaps ahem!!!) will soon support something similar as well. Hopefully someday soon they just support 1 XML based standard or at least multiple xml standards and write a xslt to transform sitemaps back and forth. RDF anyone? I think the browser revolution will cause this eventually.

Your Atlas structure should be able to deal with appropriate query strings and generate the requested content. Using your example, your Atlas page should check initial query string for brandId and Page and load those pages appropriately. You can use initialData for this probably if you're using data sources, or web services are even easier, just load the appopriate page.

I think the Atlas team and Live.com team work closely together, any comments? Live.com seems to be offering developers a lot of services to augment their functionality, this would definitely be up there as a feature.

Monday, March 26, 2012

Probably a stupid question........Flash>Atlas ?

This is probably a dumb question but....anyway.....
Hasn't this kind of 'client side processing to provide a richer user experience without postbacks' already been implemented a billion times better by Macromedia Flash ? What are the benefits of atlas over flash ( please don't say 'you need a plug-in for flash' as the flash player is pretty much ubiquitous now )?
Or is it just utterly stupid to try and compare them both?
How is Atlas related to AJAX?

There are no dumb questions.Smile [:)]
Here are my answers as oppossed to anyone else's:
Atlas is Microsoft's implementation of Ajax for the .NET platform.
I see Flash and Atlas as different products. Flash started as graphical animation over the web. It is trying to grow to provide a programmable interface, however, the languages semantics of Flash are problematic according to a developer friend of mine. His company tried to create a complete web ui using flash and they gave up based on a number of technical issues, including the fact that there was little documentation regarding how to create an application, limited support for most programming items (try-catch being one), and a few other things that escape my mind at this moment. I believe that there is a Flash Server that provides a lot of this functionality, but I don't know anything about it. I don't remember all of the issues that he brought up, but there were several. I have not used flash so my data may be completely inaccurate. Smile [:)] Also, don't dismiss the plug-in issue. The plug-in issue is a much bigger deal than just downloading and installing it. Many companies don't allow for third-party plugins. Getting a plug-in installed can be a major headache. Atlas does not require an installation at the client. Atlas only requires an installation of the application at the server. According to the Scott Guthrie blog entry, Atlas will run without installing anything on the web server. Atlas requires a dll in the /bin directory of an application and some script files that are a part of an application, not the web server.
I see flash as primarily used for its graphical featureset. I see Atlas and Ajax as being used for application development where data is primarily text. Yes, the Web2.0/mashup metaphor is bring together both worlds, but most application oriented data is still textual.
Anyway, thats my thoughts on the issue.


Flash has grown quite a bit and now offers very powerful programming elements. It can easily support asynchronous method invocations, serialization os complex types, data binding, and event persistent connections to the backend to avoid polling schemes - something that javascript does not support today.
Our product supports both Flash and AJAX clients in the same capacity. You can see the same examples implemented with Flash or AJAX and using the same server and the server-side .NET classes.:http://www.themidnightcoders.com/examples.
cheers,
Terry

Yes, it has been several years since they tried to do the flash ui. I figured my data was old. Smile [:)]



I think another big advantage that a pure JavaScript solution offers is that there is no need for a Flash programmer; literally the skillset. Typically, most people I have had the pleasure of working with, most can do even the most basic JavaScript, where only a very very small few can do any sort of Flash.
Cost. With Flash, not only do you need the investment into the additional skillset you need the tools/IDE.

There's a topic on the docs page that gives an overview of the relationship between Atlas and AJAX, it's titled "Understanding AJAX Applications and ASP.NET Atlas". It's athttp://atlas.asp.net/docs.

Thanks for the posts chaps, much appreciated.
>I think another big advantage that a pure JavaScript solution offers is that there is no need for a Flash programmer; literally the skillset. >Typically, most people I have had the pleasure of working with, most can do even the most basic JavaScript, where only a very very >small few can do any sort of Flash.
The thing is though, AFAIK actionscript IS javascript! I did a bit of actionscript maybe 3 4 years ago, and the 2 languages are VERY similar. I remember reading that this was intentional by Macromedia to allow easy learning for the javascript mob.
Still not seen a really convincing argument for atlas>flash though.
Thanks for the cool little discussion and the links everyone.

My 2 cents...
One of the cool things about Atlas is that it can enhance legacy ASP.NET sites (or generically, any HTML web app) incrementally. That is, you can take an existing web app and start enriching it with Atlas immediately and in small doses. You don't need to rebuild the whole web app from scratch. You can "layer in" Atlas functionality to give your existing web app incrementally richer behavior.
Further, if you use the client-side Atlas tags/functions, you can retain a nice separation of presentation and behavior for your web app. Your presentation can be built using vanilla HTML. It's behavior (how it reacts to events like "click" or "hover") can be built with Atlas tags. Thus, Atlas can help designers and developers collaborate. The designer can write the presentation (HTML) and the developer can write the behavior (Atlas tags and functions).
In Flash apps (not merely Flash eye-candy animations), in practice, the whole app is recreated from scratch. Though there are examples of hybrid HTML/Flash apps, these seem less common than Flash apps that are self-contained. Thus they tend to demand a full rewrite of your legacy app. Or, for new web apps, they tend to demand a singular approach rather than facilitating hybrid technologies that marry the best of HTML with the best of behavioral technology like Javascript.
-Russ-

Hi,

Thought i'd jump on the wagon and put in my 2 cents, so here it is.

I'm not really sure this magical world with designers doing the HTML really exists, in my experience it's been the designer doing mockups and developers doing the rest far too. At best the designer might provide the HTML for the master layout.

On the ATLAS vs Flash point, they are really 2 different fish IMO. I havn't seen too many true web applications using Flash. Also, i don't think search engines are particularly fond of flash, although i don't think they will work particularly well with ATLAS either.

Nick