Results 1 to 27 of 27

Thread: Popup Problem in Asp.Net!!!!

  1. #1

    Thread Starter
    Lively Member AjayKumar's Avatar
    Join Date
    Nov 2003
    Location
    Noida
    Posts
    94

    Question Popup Problem in Asp.Net!!!!


    Hi,
    I am developing as Application in ASP.net and C#.
    I want to display popup window to all clients of my application when a new user login or when a new entry goes into my database.Give me some idea about it.
    Thanks!
    HI ITs exciting!!!!!

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Popup Problem in Asp.Net!!!!

    Do a search for javascript alert.

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Popup Problem in Asp.Net!!!!

    Quote Originally Posted by AjayKumar

    Hi,
    I am developing as Application in ASP.net and C#.
    I want to display popup window to all clients of my application when a new user login or when a new entry goes into my database.Give me some idea about it.
    Thanks!
    Do you mean that when a new user logs in, people all over the world using your web application should get a popup informing them of this event?

    If that's the case, then on every page load, you should perform a check for whether such an event has occurred and depending upon that, throw an alert. Of course, the mechanism for maintaining whether a user has seen the alert or not is going to be slightly tough.

  4. #4
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Popup Problem in Asp.Net!!!!

    Might be able to use an application level dataset or datatable that gets updated after the alert onclick event. You would probably want to purge it every so often, as it could get huge.

  5. #5

    Thread Starter
    Lively Member AjayKumar's Avatar
    Join Date
    Nov 2003
    Location
    Noida
    Posts
    94

    Re: Popup Problem in Asp.Net!!!!

    Actually I have an application in which some fault entries for Traffic lights are done online.I want when any user enter any fault then all users who are currently logged in ,should get a popup message that a new fault is registered.I am confused how to do it,whether on client side or server side.
    Please suggest any solution with some coding!!
    HI ITs exciting!!!!!

  6. #6
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Popup Problem in Asp.Net!!!!

    When a iser logs in you will need to set some values into a DB...not sure what values as I haven't gone into that much detail with this problem.

    Then client side. You create a timer in javascript that say every 10 seconds queries the DB. This would be done using remoting. You would then need more javascript to display a popup window.

    Howvere, if all users logged in are constantly checking for new DB things then this will have an impact on the performance of your web app.

    Woka

  7. #7

    Thread Starter
    Lively Member AjayKumar's Avatar
    Join Date
    Nov 2003
    Location
    Noida
    Posts
    94

    Unhappy Re: Popup Problem in Asp.Net!!!!

    Thanks for your suggestion.
    Okay,But how do i connect to database using javascript.?
    i do not know database connectivity through javascript.
    HI ITs exciting!!!!!

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Popup Problem in Asp.Net!!!!

    You'll have to connect using a server side language, which in this case should be ASP.NET/VB.NET or ASP.NET/C#

  9. #9

    Thread Starter
    Lively Member AjayKumar's Avatar
    Join Date
    Nov 2003
    Location
    Noida
    Posts
    94

    Re: Popup Problem in Asp.Net!!!!

    "You create a timer in javascript that say every 10 seconds queries the DB. This would be done using remoting."
    I have already done connectivity in my application but problem is that how can i display a popup to all online users.
    HI ITs exciting!!!!!

  10. #10
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Popup Problem in Asp.Net!!!!

    well the users clinet will connect to DB, check for data. if data found then display popup.
    If 1000 people are on your site then 1000 popups will be seen. and 1000 hits to the DB every 10 seconds will occur.

    HUGE HUGE hit on the server and DB.
    If the popup shows on 1 client, then it'll show on all, there would be no difference in coding between 2000000 users logging in and say 3.

    Do you have code to popup a single window?

    Woka

  11. #11

    Thread Starter
    Lively Member AjayKumar's Avatar
    Join Date
    Nov 2003
    Location
    Noida
    Posts
    94

    Unhappy Re: Popup Problem in Asp.Net!!!!

    Yes i have Javascript code to popup a single window.

    public void popup(string fname)
    {
    string sc,d2;
    d2 = "Width=780,Height=350,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0 ;";
    sc = "<script language=JavaScript>";
    sc = sc + "window.open('" + fname + "','','" + d2 + "');";
    sc = sc + "</script" + ">";

    if(!IsClientScriptBlockRegistered("window.open"))
    {
    RegisterClientScriptBlock("alert", sc);
    }

    }

    In above function i pass name of a particular page and then it get displays.
    Problem is that i want to show it to all online users.
    Plz write code for that.

    please help me.
    HI ITs exciting!!!!!

  12. #12
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Popup Problem in Asp.Net!!!!

    Here;s the javascript to popup a modal window:
    Code:
    function openSelectVisitor(iBookingKey)
    {
    	var sFeatures = ''
    				
    	sFeatures=''
    	sFeatures+='top=100,'
    	sFeatures+='left=200,'
    	sFeatures+='height=500px,'
    	sFeatures+='width=400px,'
    	sFeatures+='scrollbars=no,status=no,toolbar=no'
    	window.showModalDialog('SelectVisitor.aspx?BookingKey='+iBookingKey,'SelectVisitor',sFeatures)
    }
    Hope this helps.

    Woka

  13. #13
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Popup Problem in Asp.Net!!!!

    OK. You say you can already connect to the DB right.

    Do you do this using JScipt or VB.NEt in the codebehind page?

    Do you know how to create javascript timer?

    Do you know how to do remoting?

    Woka

  14. #14

    Thread Starter
    Lively Member AjayKumar's Avatar
    Join Date
    Nov 2003
    Location
    Noida
    Posts
    94

    Unhappy Re: Popup Problem in Asp.Net!!!!

    Hi,
    To simplyfy i want to flash a message for all clients on any event.
    HI ITs exciting!!!!!

  15. #15

    Thread Starter
    Lively Member AjayKumar's Avatar
    Join Date
    Nov 2003
    Location
    Noida
    Posts
    94

    Unhappy Re: Popup Problem in Asp.Net!!!!

    Hi,
    I do not know remoting and timers in javascript.
    I have used that popup function in my codebehind(.cs) file.
    give me some idea how to do it..
    HI ITs exciting!!!!!

  16. #16
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Popup Problem in Asp.Net!!!!

    This is very complicated in my opinion, well it is if you don't know what you're doing

    http://www.codeproject.com/aspnet/Al...eScripting.asp

    have a read of that, and download the demo.
    This explains how to do remoting. Not easy.

    Woka

  17. #17

    Thread Starter
    Lively Member AjayKumar's Avatar
    Join Date
    Nov 2003
    Location
    Noida
    Posts
    94

    Unhappy Re: Popup Problem in Asp.Net!!!!

    I do not know how to implement this!
    HI ITs exciting!!!!!

  18. #18
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Popup Problem in Asp.Net!!!!

    Yup, like I said it's very complicated.
    Full instructions and demo code are available in that link.

    Web UI coding like this is always complicated. Which is why ASP.NET coders get paid more than VB.NET.

    Woof

  19. #19

    Thread Starter
    Lively Member AjayKumar's Avatar
    Join Date
    Nov 2003
    Location
    Noida
    Posts
    94

    Unhappy Re: Popup Problem in Asp.Net!!!!

    Yea,
    I have studied that demo code.But it is not solving my problem.
    When any client call a remote method then only the current client gets a response from the server.I want this response or some message to all online users.Demo code is explaining concept very much like AJAX(Asyncronous Java Script with XML).
    Definitly it is not solving my problem.
    Now tell me what i do?
    HI ITs exciting!!!!!

  20. #20
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Popup Problem in Asp.Net!!!!

    ERRRRRR...
    Yes, the client does this call...if you have 10000 users online, then you have 10000 IE clients making the call...and 10000 requests to the DB. Not just one. They will ALL do it.
    this is the web. it's asynchronous. You cannot send requests from the web server to IE at random points.

    Woka

  21. #21

    Thread Starter
    Lively Member AjayKumar's Avatar
    Join Date
    Nov 2003
    Location
    Noida
    Posts
    94

    Unhappy Re: Popup Problem in Asp.Net!!!!

    Yea,
    I will try this remoting it again today then i will let u know?Is it the only solution to this problem?
    thanks
    HI ITs exciting!!!!!

  22. #22
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Popup Problem in Asp.Net!!!!

    I believe so, but my UI knowledge of ASP.NET is limited, or rather my javascript knowledge is very limited.
    All cool UI functions in IE are done using javascript, ie timers, menus, etc

    Web developement in ASP.NET is more complicated than VB.NET developement, well complicated in another way.

    Woka

  23. #23

    Thread Starter
    Lively Member AjayKumar's Avatar
    Join Date
    Nov 2003
    Location
    Noida
    Posts
    94

    Unhappy Re: Popup Problem in Asp.Net!!!!

    Thanks for your quick response.
    But i want when one client makes call other client should know abt this call.
    I think it is not possible in this way.It will be very much like chating.
    what do u think?
    HI ITs exciting!!!!!

  24. #24
    New Member leparduk's Avatar
    Join Date
    Oct 2005
    Posts
    7

    Re: Popup Problem in Asp.Net!!!!

    The issue you are raising is one that web developers have struggled with since the inception of the internet. Basically for many reasons (including but not limited to security) the clientside browser cannot be targeted by the code running from the server, (IIS or apache for instance).

    Instead client server interaction is request based, with the request being initiated from the client.

    So, to summarise your problem, you want one client to post a message, whatever that message is (some data whatever is contains), to the server and for other clients (which remember cannot be targeted by the server) to see that this has occurred. However the only way they can see that this has occurred is for them to request it from the server. But the server can't tell them. Can you see the Chicken and Egg scenario developing?

    So in essence Woka has the right idea. Each client must request from the server on a timer whether any events have occurred. This is the part that should be remoting based.

    So your solution will take the following format:

    A client page will exist that allows a message (data) to be submitted to the server via a form. This will be persisted to a database or similar. The same page will also contain a clientside timer (in either jscript or vbscript - I prefer the former) that runs every 10 or so seconds. This will initiate a remoting call (AJAX or any other library you prefer) which will make a call to another server side page that will return an xml data load containing all messages sent by all users since your last call. You can then display these on your page.

    I can provide code for all of this if you need it.
    Just because you're paranoid doesn't mean they aren't out to get you

    Quidquid latine dictum sit, altum viditur

  25. #25
    Hyperactive Member
    Join Date
    Apr 2005
    Location
    Indiana
    Posts
    451

    Re: Popup Problem in Asp.Net!!!!

    I see it has been a while since the last post but incase you are still looking there might be another way. If your users login and you track the ip address of the user when they log in you might be able to send the pop up to each user that is logged in.

    Don't ask me how. I am still learning myself.

  26. #26

  27. #27

    Thread Starter
    Lively Member AjayKumar's Avatar
    Join Date
    Nov 2003
    Location
    Noida
    Posts
    94

    Re: Popup Problem in Asp.Net!!!!

    Hi all,
    I am very much agree with Woka and Leparduk.

    Leparduk,Plz send me code for that as u had explained.
    I think timer is the only solution.
    Thanks for your responses.

    send code soon
    HI ITs exciting!!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width