How do I do this.

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

I have a Windows application which has a combo box and a button, when user clicks on the button another window pups up with a data grid containing the data for the combo box. The datagrid allows the user to modify / add / delete data for the combo box. When the user closes the update window the combo box on the first window is updated with the current data from the database.

How can I achieve the same functionality on a ASP.NET webform, specifically the part where the user clicks on the button on the first page and when the update webpage is closed combo box is updated with the current data. Or is there a better way of doing this?

Peter
 
Read this:
http://msdn.microsoft.com/workshop/author/om/windows_frames
_dialogs.asp


-----Original Message-----
I have a Windows application which has a combo box and a
button, when user clicks on the button another window pups
up with a data grid containing the data for the combo
box. The datagrid allows the user to modify / add /
delete data for the combo box. When the user closes the
update window the combo box on the first window is updated
with the current data from the database.
How can I achieve the same functionality on a ASP.NET
webform, specifically the part where the user clicks on
the button on the first page and when the update webpage
is closed combo box is updated with the current data. Or
is there a better way of doing this?
 
Hi Peter,


Thank you for using Microsoft Newsgroup Sevice. Based on your description,
you are wanting to apply the popup dialog model in the Winform application
to the ASP.NET web application? Is my understanding correct?

I've viewed the weblink provided by Kikoz, I think it a very good
instruction on performing pop dialog style in web based application.
http://msdn.microsoft.com/workshop/author/om/windows_frames_dialogs.asp

Generally, to provided dialog in web pages, you should use the javascript
function such as "OpenModalDialog", and pass a window handle as parameter
to it. Then, you can control the original window from the popuped dialog
browser window. The key points is to make proper use of the javascript's
window objects and fuctions. For more detailed instructions or tutorial on
this, you can visit the following weblink :
http://msdn.microsoft.com/workshop/author/om/doc_object.asp?frame=true

BTW, although we can perform such dialog style in web applicaion, I still
don't think it the most proper way in such web based apps. The web based
application cosist of web pages which is display separately in the client
side web browser. If you used the javascript client side skill to provide
the communication between different browser windows, it all depends on the
client condition, also it is somewhat uncomfortable to write the client
script. In web application, the generic pattern for such situation is to
using two pages. When need to popup another page to do some changes, we can
just navigator( redirect) to the new page, after finishing the operation
then go back(also can use redirect) to the former page. This can make the
programming logic in web applicatino more easier and comfortable to
realize. Do you think so?


Please have a try on the above suggestions. If you have any questions,
please feel free to let me know.


Merry Christmas!!

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
I totaly agree with you on the popup windows, I think it's better to send
the user to next windows and than redisplay the data, it's just I have not
done any web development yet as you can tell from my questions so I don't
know how to do either one.

So how would I go about sending user to a different web page in the same
window and retaining current field values?

Is the following assumption correct?

1. Store current screen data in a class
2. Redirect user to web page
3. When user is done with the web page redirect the user to the original web
page, Reload data from the class to the current web page.
 
Web is clueless about what's going on on client side.
Server just gets the request for some particular file,
processes it, spits resulting html back to the client and
forgets about it forever (at least til the next request).
That's why it's impossible to store some data in any class
that was created (and destroyed) during one page request
and than reload it during another request even if the
latest request was made by clicking on link on the first
page.

The solution really depends on what do you need to do.

You can store data in db, then redirect user to the next
page and include id(s) of this data in URL, then reload
this data from db on second page based on those ids. You
will need to post data to server somehow (button click or
xml/ActiveX/IE behavior/WebService) on the first page
before redirection.

You can store data in HttpApplication if the nature of the
data is global. Then simply get it when you get a request
for the second page.

Or simply include data in URL when redirecting (not much,
2KB top, if I remember correctly) and use
Request.QueryString collection to get it on second page.

There are other ways to do this.

Regards.
 
Hi Peter,


Thank you for the response. As for the assumption operation squence you
mentioned in the reply:

##################################################
1. Store current screen data in a class
2. Redirect user to web page
3. When user is done with the web page redirect the user to the original web
###################################################

I think it good only for the "Store current screen data in a class" step.
In ASP.NET web application, it is server-side application which will be
requested and used by many client-users, and all the users will share many
of the serverside resources and components. So storing datas in classes is
not quite proper. However, we can use many other means to store the datas
and retrieve it.

Kikoz has listed many proper ways to remain datas between different
requests. Such as :
1. using database server to store temp datas and retrieve back from it
2. append the data strings in the Url or in the request's Querystring
collection and get it in the target page. Remain it in the page(store them
in some Html hidden area) and post them back to the original page.
3. using the "Application" or "Session" collection to stored those datas.
The "Application" and "Session" are all serverside components and can store
different kinds of datas(not only string).

And which means you should use all depends on your data requirement ,such
as quantity, data type ..etc.
Here is some weblinks for the relative references:
About the "Session" in ASP.NET
http://msdn.microsoft.com/library/en-us/dnaspnet/html/asp12282000.asp?frame=
true
About passing values between different web pages
http://msdn.microsoft.com/library/en-us/vbcon/html/vbtskPassingValuesBetween
WebFormsPages.asp?frame=true

Please check out the preceding sugestions to see whether they help. If you
have any question on it, please feel free to let me know.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top