How to raise a server-side event asynchronously?

Discussion in 'ASP .Net' started by Ahmet Gunes, Apr 10, 2008.

  1. Ahmet Gunes

    Ahmet Gunes Guest

    Hello,

    I am trying to develop my own AJAX Framework.
    Actually this framework will allow field-based validation without using
    Validation Controls.
    For example, let's have a webform with 2 text boxes (txtFirstName,
    txtLastName) and 2 dropdownlists (ddlCountryOfBirth, ddlCityOfBirth).
    Let's assume that the tab order of these controls is txtFirstName,
    txtLastName, ddlCountryofBirth, ddlCityOfBirth.
    Each of these 4 controls have a server-side validation code in TextChanged
    events of textboxes and SelectedIndexChanged events of dropdownlists.

    Here is a simple scenario:
    1. User enters his first name and clicks the TAB key.
    2. An ajax request goes to server side and runs the associated TextChanged
    event of txtFirstName.
    3. If the first name is valid a success message is sent to client and the
    cursor is placed in the txtLastName field, else an error message will be
    shown to the user and the cursor will be placed into txtFirstName
    4. Assuming first name is valid, user enters his last name
    5. An ajax request goes to server side and runs the associated TextChanged
    event of txtLastName.
    6. If the last name is valid a success message is sent to client and the
    cursor is placed in the ddlCountryOfBirth field, else an error message will
    be shown to the user and the cursor will be placed into txtLastName
    7. etc.

    Please note that the web form will be designed like a normal web form.
    But all requests to this web form, other than the very first request, should
    only run the corresponding server-side event handler.

    I have been studying the ASP.NET request pipeline for the last few days and
    have learned about several interfaces (IHttpHandler, ICallbackEventHandler,
    etc) and events (OnInit, OnInitCompleted, OnPreRender, OnRender, etc).
    I wonder if anybody has a brilliant solution to this scenario...

    Thanks in advance,

    Ahmet Gunes, PMP, MCSD, MSF
     
    Ahmet Gunes, Apr 10, 2008
    #1
    1. Advertising

  2. Ahmet Gunes

    bruce barker Guest

    for validation, I'd use a webservice. ajax is async, so while you can fire on
    the tab, the call will not return before the tab goes to the next field. if
    the user types fast, they can fill in two fields before the first validation
    request returns.

    -- bruce (sqlwork.com)


    "Ahmet Gunes" wrote:

    > Hello,
    >
    > I am trying to develop my own AJAX Framework.
    > Actually this framework will allow field-based validation without using
    > Validation Controls.
    > For example, let's have a webform with 2 text boxes (txtFirstName,
    > txtLastName) and 2 dropdownlists (ddlCountryOfBirth, ddlCityOfBirth).
    > Let's assume that the tab order of these controls is txtFirstName,
    > txtLastName, ddlCountryofBirth, ddlCityOfBirth.
    > Each of these 4 controls have a server-side validation code in TextChanged
    > events of textboxes and SelectedIndexChanged events of dropdownlists.
    >
    > Here is a simple scenario:
    > 1. User enters his first name and clicks the TAB key.
    > 2. An ajax request goes to server side and runs the associated TextChanged
    > event of txtFirstName.
    > 3. If the first name is valid a success message is sent to client and the
    > cursor is placed in the txtLastName field, else an error message will be
    > shown to the user and the cursor will be placed into txtFirstName
    > 4. Assuming first name is valid, user enters his last name
    > 5. An ajax request goes to server side and runs the associated TextChanged
    > event of txtLastName.
    > 6. If the last name is valid a success message is sent to client and the
    > cursor is placed in the ddlCountryOfBirth field, else an error message will
    > be shown to the user and the cursor will be placed into txtLastName
    > 7. etc.
    >
    > Please note that the web form will be designed like a normal web form.
    > But all requests to this web form, other than the very first request, should
    > only run the corresponding server-side event handler.
    >
    > I have been studying the ASP.NET request pipeline for the last few days and
    > have learned about several interfaces (IHttpHandler, ICallbackEventHandler,
    > etc) and events (OnInit, OnInitCompleted, OnPreRender, OnRender, etc).
    > I wonder if anybody has a brilliant solution to this scenario...
    >
    > Thanks in advance,
    >
    > Ahmet Gunes, PMP, MCSD, MSF
    >
    >
    >
    >
     
    bruce barker, Apr 10, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shany Shany
    Replies:
    0
    Views:
    366
    Shany Shany
    Dec 15, 2004
  2. The Crow
    Replies:
    4
    Views:
    5,907
    ProgTalk
    Jan 31, 2008
  3. Jacol

    raise or not to raise [Newbie]

    Jacol, Feb 3, 2007, in forum: Python
    Replies:
    5
    Views:
    409
    Gabriel Genellina
    Feb 5, 2007
  4. ernest
    Replies:
    2
    Views:
    294
    Roy Smith
    Nov 14, 2010
  5. Jack Bates
    Replies:
    0
    Views:
    281
    Jack Bates
    May 2, 2011
Loading...

Share This Page