Datagrid problem

  • Thread starter Thread starter james crosthwaite via .NET 247
  • Start date Start date
J

james crosthwaite via .NET 247

Hi,

I'm pretty new to .NET and i'm having a major problem which ireally need some help with.

I am developing an application for my office which allows usersto book rooms. I have a Booking Form which contains a datagridlisting attendees for the meeting. On this form there is abutton which takes the user to a new form to add between 1 and 5guests. Once the guests have been added the system takes theuser back to the booking form via a piece of javascript(history.go(-2)). This is all well and good but i need thedatagrid on the booking form to refresh when the user goes backto the page, to show the added guests. I have written code topopulate the datagrid from a database which is called in thepage_load event. What i need to know is, is there a way to takethe user back to the booking form (without losing any datathey've filled in) and refreshing the datagrid to show theupdates?

Hope this makes sense!!
 
I would add a table containing all the form elements for adding a guest to
the main page, and display this form (myTbl.Visible = True) when the user
clicks the button to 'add a guest'

Assuming you are adding items to the datagrid, you need to call dg.databind
on within the event for adding a new guest. This will update the datagrid
with the new data.

HTH - You may wish to hold for other answers - I'm quite new to asp.Net
myself, but thats the way I would do it! :)

Hi,

I'm pretty new to .NET and i'm having a major problem which i really need
some help with.

I am developing an application for my office which allows users to book
rooms. I have a Booking Form which contains a datagrid listing attendees for
the meeting. On this form there is a button which takes the user to a new
form to add between 1 and 5 guests. Once the guests have been added the
system takes the user back to the booking form via a piece of javascript
(history.go(-2)). This is all well and good but i need the datagrid on the
booking form to refresh when the user goes back to the page, to show the
added guests. I have written code to populate the datagrid from a database
which is called in the page_load event. What i need to know is, is there a
way to take the user back to the booking form (without losing any data
they've filled in) and refreshing the datagrid to show the updates?

Hope this makes sense!!
 
Thanks for the response Simon, i'm not sure if this would work though.
perhaps i should explain further.

The Add Guest(s) button on the booking form uses server.transfer to
send the user to the Add Guests form. When the user goes to this form a
value is passed to the add guest form (from the booking form) that is
the meeting ID. This ID is then used to add the new guests to a
database table that records the attendees for each meeting. What i had
then hoped (rather naively it would seem) would be that the code that
populates the datagrid (from said database table) would be called and i
wouldn't have to worry about it. i figured that when the user goes back
to the Booking Form the page_load even would be fired, however as i'm
just going back through the history it would seem that the booking form
is cached and therefore there is no obvious event fired or anyway of
determining that the booking form has been viewed via the history, if
you see what i mean.

The data is there but the only way to get the datagrid to show the
added guests is to refresh the booking form when the user goes back to
it, however this then means that any changes that have been made would
be lost. What i need is a way of storing the state of the booking form
when the user clicks the Add Guest(s) button so that they can then go
back to this state and then just refresh the datagrid by calling the
sub that does this. That way i could, hopefully, use the
server.transfer or response.redirect commands to go back to the saved
state. This would then call the page_load event and maybe i can use an
if statement to check the state so that i can just reload the datagrid
and leave the other changes intact.

any help would be much appreciated.

cheers

James
 
I have now managed to solve this problem using Session variables.
Thanks to Simon for responding.
 
Back
Top