Generating report dynamically using ASP.NET AJAX - asp.net

I've googled this to death and can't find anything that points me in the right direction so any help would be much appreciated!
I want to generate a report that consists of X no. of gridviews (X can vary) where each gridview is added one at a time using ajax (to avoid timeout of rendering all gridviews in single post back). I am also hoping that when rendering the next gridview a progress bar/timer can also appear in it's place until it's finished processing and is rendered.
Does anyone know how I might tackle this? I wouldn't have a problem doing this in a single post back but now the reports are timing out I need to generate the report piece by piece dynamically.
Thanks in advance!

Why don't you divide the page into different sections and load each section individually.
Are your gridviews interdependent..?

Related

How to enter a value several times on ASP.NET Webpage?

I have a webpage with a textbox and a button and when the button is clicked i get som calculations on the value entered, but i cannot enter another value and see calulations on that new number.
How can I achieve this? Thanks in advance.
From your question it sounds like you want to be able to change the values without having to click the button again, and have the calculations redone. The reason clicking your button works is because the page goes through a Postback The calculations are then processed server side and returned after the page has loaded. What you want to do can be accomplished in a handful of ways including: jQuery or ajax. One thing you may want to look at is jQuery .post This can help you post the values of your form to a processing page and then set the return value on your form. On the other hand since you're using .NET you could also take a look at the Microsoft AJAX Control Toolkit One place you could start is by looking at the Update Panel. Good luck and I hope this helps!

ASP.NET dynamic controls data exchange in postback

Please excuse me for a probably low quality of this question, since I'm not a web dev, so I possibly don't now some obvious things and don't know what to Google for. I think problem must have some simple solution, but I'm struggling with it for two days now, so I feel myself pretty stupid :-).
I have a custom control which is a set of checkboxes which are added dynamically based on a property which is set in OnLoad event of a page. I have two such controls on a page and second control items should be based on items selected in first control.
The problem is, I can't figure out, how to catch on autopostback which boxes were selected in first control before second contol is constructed to pass this data to it?
Take a look at this.
http://forums.asp.net/t/1440174.aspx
Since your building them dynamically, they are not as easy to find as webforms would like to be, if you added them to the page and wired up events and such.
Your going to look at the Request.Forms list, and search thru it for any controls you want.
I believe checkboxes are like radio buttons, they only return if they are checked, which is good, cause you want to know which ones were checked.
I've used same solution as in the accepted answer for this question: Dynamically Change User Control in ASP.Net , just need to assign an unique id for each dynamically created CheckBox in custom control. Not as clean solution as I want but at least it works.
You can save the data in the ViewState, QueryString or as Session before moving to the next page and you can do modifications based on it.

Crystal Report View page numbers

I am using the Crystal Report Viewer in an ASP.NET application. On the viewer it displays the page numbers along the lines of '1 / 1+' where the 1+ is dynamically calculated. I would like it to display the correct total number of pages from the start rather than 1+. Is there a way to do this?
I think a number of the examples online recommend that you navigate to the last page and then back to the first, but I don't think this is a good way of handling it. I have yet to have the need to do this for any of my projects so I haven't had to try to find a work around yet.
Edit-
Ok, after looking at this just now I realized that if you add the "Page N of M" special field it does the dynamic calculation at runtime. In my testing it will do the dynamic calculation even if you choose to suppress the field by checking the suppress box in the field properties. Granted the dynamic calculation might be slower for larger reports, this is probably just as good as programmatically navigating to the last page and back to the first. Hope this helps.
Crystal Report's Page engine renders sections the first page as quickly as possible to give the perception of performance. You may have noticed field values rendering quickly, with place holders (spaces) for subreports and other resource-intensive objects. As the Rendering engine finishes processing these objects, the place holders are replace with values.
The page numbering situation is similar. The navigation control will initially read '1+', but will increment as the Page engine renders additional pages. When the whole report is rendered, the navigation control and the Page N of M field will display the total page count.
If you insist on altering the user-experience, you may be able to use the Viewer's BeforeRender or BeforeRenderContent event to set HasPageNavigationButtons=False and AfterRender or AfterRenderContent event to HasPageNavigationButtons=True.
I'm not certain that you will be able to do something similar with the Page-N-of-M field.
You have a property called TotalPageCount. If you put that in your report will show the page numbers correctly.
For example, I have a formula field like ToText(PageNumber,0) + "/" + ToText(TotalPageCount,0) to show current page from total pages.

Facebook Wall functionality using ASP.Net

I want to create something similiar to a facebook wall on my social site. I want to store the posts in an sql database and that should be rather simple. What I am looking for is a good way to display the posts? I guess I don't even really know where to start, as I can only think of using a loop to display asp:textboxes. Which obviously is not correct.
I want there to be multiple posts displayed on the page, which should include:
the user who posted,
the text posted,
the date posted,
and if I want to get crazy...a means of deleting/editing the post.
I really have no idea of how to implement this concept, so any ideas would help greatly.
To get started, view this article from asp.net on the Repeater control, or this great article.
The Repeater control lets you databind to a list of objects, and then define one template for how that object should be displayed. Then, ASP.NET will handle showing it as many times as necessary. You can write the code-behind for dealing with delete and edit as if there were only one instance on the page.
go ahead with jquery, use a lot of ajax. for the mark up, use a repeater control with all clean html mark up (instead of server side controls which would generate a lot of unnecessary mark up quickly creating performance issues)
only populate x number of items on initial load, and then using jquery pull data as required based on user action. you can serve this data via json, decode json on client side using jquery and perform a loop which converts this json into appropriate html and injects it into the correct html element
should be simple ;-)
ASP.NET gives you lots of ways to do this. A Repeater, DataGrid, GridView are the first that come to mind. If you'd rather use ASP.NET MVC, there's always the good old foreach loop.
Additionally, check out ListView too.

DataTable and javascript

Is there a way to avoid postbacks with gridview every time a row is added to it?
In other words, can I store the DataTable on the client and pass it on to the server control when I am done to save, rather than do postbacks every time the row is added?
I searched and searched....all I could find was web services, JSON, and I have a feeling it's redundant here...it's a simple task I am sure everyone had to do at some point.
Can anyone shed some light on this?
There is no avoiding postbacks if you're dealing with a standard ASP.NET GridView that utilizes ViewState.
You can however, disable ViewState and manually (programmatically) render the control on every page load. This will let you control every aspect of row creation/removal/updates, but you'll have to do it all manually. And yes, you'll utilize AJAX to read from or update on the server.
I don't konw of anything that lets you do that with the gridview out of the box, except the UpdatePanel, but that doesn't really count. If you want to implement I a full AJAX grid I would look into using the ListView Control, which will give you much more control over the resulting html.
Heres a great article from MSDN Magazine http://msdn.microsoft.com/en-us/magazine/cc337898.aspx

Resources