I need to have a GridView listing all invoices of an account. Each account can have a PDF generated for that account, which isn't done instantly - so I need a gridview column to update the user of the progress of this conversion - i.e. 'In Progress'.
Then, when the conversion is done the cell's text should change to a hyperlink to the PDF file.
I know it's a very vague question in regards to monitoring the state of the PDF, but I'd just like to know if AJAX would be a solution and what controls I would use.
Hmm... So there's a gridview with several rows (accounts), and each account may have its Pdf state changed at any time, and the link cell should be refreshed immediately (upon a Pdf state change)?
Try searching for "web methods" + "web services" + "asynchronous" and check if it's what you are looking for.
If you can, using a control like Telerik's RadControls Grid, which has Webservice binding, can do the work for you, continuously refreshing the data as it changes: http://demos.telerik.com/aspnet-ajax/controls/examples/integration/aspajaxgridapplication/defaultcs.aspx?product=grid
Related
I have a page on which user select a date range and submit the form. I am picking data as per date range and then binding it to the gridview. Since I have to also generate pdf just after binding I am using response.write to write the generated pdf file to the user. But the problem is that the gridview never changes. The moment I stops execution after gridbind(return;), the gridview binds properly. After struggling for some time i found out it is happining due to response.write and response.end statement which is used for writing the file.
My question is how to do these two task back to back? so that when user submit the form he sees the gridview with all data and also the file gets downloaded.
right now after gridbinding I generate 1 more link to the generated pdf but the client wants that it should be done in one go instead of 2 .
you can achieve this using two ways
show your data to user and set interval in javascript lets say wait for 1 min and then postback page to download PDF.
(RECOMMENDED)create another page say FileDownloader.aspx and open that page in new window using javascript. you can share your data between pages using session, disk, db whatever suits you best.
Using a combination of asp.net, jQuery, and c# and stored procedures.
I have successfully created a gridview, which I then apply jQuery datatables plugin to provide text column filtering (I disabled most of the other datatables function/settings off)).
The Gridview works as expected and when I make use of the RowEditing and RowUpdating events also, IE the editable fields update nicely.
If the user clicks and edits, then clicks the update link, the database is updated and the page reloads. now if that person has scrolled down say record 50 (half way down for instance) in order to locate and then edit that record, then after the page refresh, the user then has to scroll back down to find that same record.
I'm trying to find a way of returning the user to the same location (record) that they had just edited before the page refresh after the page refresh.
I found a very simple solution to my problem with out a load of coding and it turned out to be MaintainScrollPositionOnPostback="True" page directive.
Unless I've misunderstood; your dilemma is nothing to do with gridviews etc, and is all to do with merely maintaining page scroll position on post-back... have a read of this JavaScript solution from the 4 guys
P.S. Google is your friend
I have an ASP.NET page where at the top of the page is a search box. There are 2 text boxes - one is an autocomplete extender for the Name on a database, and one is just inputting the ID.
The page features DetailsViews and GridViews primarily, and even when no account has been searched for, these display blank data which is not ideal. I sort of fixed this by using if (IsPostBack), encasing the elements in a placeholder and setting it to visible only if the page ispostback. But this doesn't cover if the user types in an incorrect ID.
Also, some accounts have huge amounts of data inside the GridView's. I had an issue where because I have no way of detecting when a data source's rows has changed, I end up binding whenever the page loads (Page_Load method). I've come to realise this is simply very bad - there are lots of times when the user can click various things in the page and have the page postback, and it takes an eternity to load each time I click something for accounts with lots of data.
Anyway, my question is essentially two-fold but I have a feeling the solution will be similar:
1: How can I detect when there are no accounts returned when searching, and disable the Grids/Detailsviews and show an error message?
2: How can I figure out when the user searches for another account and only rebind the grids after that has happened?
Thanks
This method is very ugly but it'll get the work done.
1) To Check whether there are no records; after the AutoComplete Extenders Webservice is called if no record is returned put some value in Session like
Session["NoData"]=true;
if Records are found then;
Session["NoData"]=false;
after the webservice is called do ajax request to check that session & on the basis of value do what you want.
2) You can achieve this also by following the above option.
I've been asked to develop a system wherein employees can mark on a form their availability on a given day of the week - for instance an employee could mark themselves as available on a given time on a given week, and unavailable on some other time. It looks a little like this:
http://img697.imageshack.us/img697/842/mvcb.jpg
Currently this works by rendering checkboxes within the table, picking up click events in each cell and marking the checkbox and hence the cell appropriately. I'm using the JQuery "click n drag checkbox" plugin from here. However, I've been informed that there could well be more than two states for a given cell (for instance available, unavailable, available in a given circumstance), in which case binding to a checkboxes checked value isnt going to be a lot of help.
I've never used javascript or asp.net before and am unsure as to the best way to approach this problem. Ideally I could stick a data structure behind each cell which I could update to a certain state and then get my cell colour by binding to this - however I'm at something as a loss as how to best achieve this.
Add a click event to the cell - e.g. click on the cell. Each click could then change the status of the cell. This status could then be store via ajax or using a submit button like on a form. Each cell could relate to a hidden form field which is where you status could be kept.
Maybe take some inspiration from google calendar. There you can select a timespan in the month view by click-dragging a range of days. I guess thats a faster way of entering longer timespans. (Like the lower part of the dragon)
My current situation is to display an unknown number of Plantypes and within those Plantypes display a list of Participants(also unknown number), the participants have a textbox and a dropdown that is editable (you can't edit the individual rows, there is one update that does a bit of validation then updates all rows.)
I currently have a gridview nested withing a repeater, the repeater displays the Plan in a label and OnItemDataBound I call a method to populate the gridviews. It looks great, but I can't figure out how to save all the data at once. I'm not opposed to handling this a different way, as in loose the gridview and or repeater, if someone has a better idea.
This is C# and framework 2.0...there is no sorting or paging on the gridviews...just some links and the fields to update.
thanks in advance,
Padawan
HTTP is stateless. Since a user physically can only update one record at a time you should implement some way to save as the user goes. This can be a simple as having a row focus and row blur events and do the saves using AJAX on blur(unfocus). Maybe make is modal as they edit so they cannot leave the page without saving.