asp.net 2.0 script callbacks

Discussion in 'ASP .Net' started by kelly, Jul 24, 2006.

  1. kelly

    kelly Guest

    Hi

    I have an app where I have 2 dropdown lists (state and city) and a Save
    button. When a user selects a value from the state dropdown list, I
    use script callback to populate the data for the city dropdown list.
    By using script callback, I'm able to execute server side functions
    without a postback.

    Now here is my problem...let's say I selected Illinois and then Chicago
    on the dropdown lists. After I click on Save, the city dropdown list
    no longer shows Chicago as the selected value, but shows the first item
    in the city dropdown list instead. It seems as if the viewstate is not
    being saved/updated or the control is not refreshed correctly?

    Is anyone else having this problem using script callbacks? It seems as
    if I need to also change the viewstate field on the client side using
    javascript?


    Kelly
     
    kelly, Jul 24, 2006
    #1
    1. Advertising

  2. kelly

    Guest

    You should post the code for more information but are you sure your
    dropdown lists are runat=server ?

    XK





    kelly wrote:
    > Hi
    >
    > I have an app where I have 2 dropdown lists (state and city) and a Save
    > button. When a user selects a value from the state dropdown list, I
    > use script callback to populate the data for the city dropdown list.
    > By using script callback, I'm able to execute server side functions
    > without a postback.
    >
    > Now here is my problem...let's say I selected Illinois and then Chicago
    > on the dropdown lists. After I click on Save, the city dropdown list
    > no longer shows Chicago as the selected value, but shows the first item
    > in the city dropdown list instead. It seems as if the viewstate is not
    > being saved/updated or the control is not refreshed correctly?
    >
    > Is anyone else having this problem using script callbacks? It seems as
    > if I need to also change the viewstate field on the client side using
    > javascript?
    >
    >
    > Kelly
     
    , Jul 24, 2006
    #2
    1. Advertising

  3. kelly

    kelly Guest

    The dropdownlists are part of a user control and I save the selected
    values using the SaveControlState. But since I'm using script
    callbacks to populate the city dropdownlist and no postback occurs, I
    believe SaveControlState is not saving correctly.

    Kelly

    wrote:
    > You should post the code for more information but are you sure your
    > dropdown lists are runat=server ?
    >
    > XK
    >
    >
    >
    >
    >
    > kelly wrote:
    > > Hi
    > >
    > > I have an app where I have 2 dropdown lists (state and city) and a Save
    > > button. When a user selects a value from the state dropdown list, I
    > > use script callback to populate the data for the city dropdown list.
    > > By using script callback, I'm able to execute server side functions
    > > without a postback.
    > >
    > > Now here is my problem...let's say I selected Illinois and then Chicago
    > > on the dropdown lists. After I click on Save, the city dropdown list
    > > no longer shows Chicago as the selected value, but shows the first item
    > > in the city dropdown list instead. It seems as if the viewstate is not
    > > being saved/updated or the control is not refreshed correctly?
    > >
    > > Is anyone else having this problem using script callbacks? It seems as
    > > if I need to also change the viewstate field on the client side using
    > > javascript?
    > >
    > >
    > > Kelly
     
    kelly, Jul 24, 2006
    #3
  4. Kelly,
    That's correct, the simple script callback doesn't preserve the stateful
    page class on the server side. You could do this with something like
    Anthem.Net because it handles callbacks by actually instantiating the Page
    class and preserving the page state. Find it on Sourceforge.net. Or, if you
    are more adventurous, ATLAS.
    Peter

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "kelly" wrote:

    > Hi
    >
    > I have an app where I have 2 dropdown lists (state and city) and a Save
    > button. When a user selects a value from the state dropdown list, I
    > use script callback to populate the data for the city dropdown list.
    > By using script callback, I'm able to execute server side functions
    > without a postback.
    >
    > Now here is my problem...let's say I selected Illinois and then Chicago
    > on the dropdown lists. After I click on Save, the city dropdown list
    > no longer shows Chicago as the selected value, but shows the first item
    > in the city dropdown list instead. It seems as if the viewstate is not
    > being saved/updated or the control is not refreshed correctly?
    >
    > Is anyone else having this problem using script callbacks? It seems as
    > if I need to also change the viewstate field on the client side using
    > javascript?
    >
    >
    > Kelly
    >
    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Jul 24, 2006
    #4
  5. kelly

    kelly Guest

    Peter

    Thanks for the reply...but is there a way for me to get around this in
    asp.net 2.0? Since they introduced this feature, I'm sure many others
    have had the same problem.


    Kelly

    Peter wrote:
    > Kelly,
    > That's correct, the simple script callback doesn't preserve the stateful
    > page class on the server side. You could do this with something like
    > Anthem.Net because it handles callbacks by actually instantiating the Page
    > class and preserving the page state. Find it on Sourceforge.net. Or, if you
    > are more adventurous, ATLAS.
    > Peter
    >
    > --
    > Co-founder, Eggheadcafe.com developer portal:
    > http://www.eggheadcafe.com
    > UnBlog:
    > http://petesbloggerama.blogspot.com
    >
    >
    >
    >
    > "kelly" wrote:
    >
    > > Hi
    > >
    > > I have an app where I have 2 dropdown lists (state and city) and a Save
    > > button. When a user selects a value from the state dropdown list, I
    > > use script callback to populate the data for the city dropdown list.
    > > By using script callback, I'm able to execute server side functions
    > > without a postback.
    > >
    > > Now here is my problem...let's say I selected Illinois and then Chicago
    > > on the dropdown lists. After I click on Save, the city dropdown list
    > > no longer shows Chicago as the selected value, but shows the first item
    > > in the city dropdown list instead. It seems as if the viewstate is not
    > > being saved/updated or the control is not refreshed correctly?
    > >
    > > Is anyone else having this problem using script callbacks? It seems as
    > > if I need to also change the viewstate field on the client side using
    > > javascript?
    > >
    > >
    > > Kelly
    > >
    > >
     
    kelly, Jul 24, 2006
    #5
  6. if you are attempting to store values in the page where there is not a
    postback,
    you can store them in hidden fields on the page (for example), and when your
    script callback is called, part of it's work would be to go get those values
    and update whatever control needs to be "refreshed" via client-side
    Javascript and the HTML DOM.
    Peter

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "kelly" wrote:

    > Peter
    >
    > Thanks for the reply...but is there a way for me to get around this in
    > asp.net 2.0? Since they introduced this feature, I'm sure many others
    > have had the same problem.
    >
    >
    > Kelly
    >
    > Peter wrote:
    > > Kelly,
    > > That's correct, the simple script callback doesn't preserve the stateful
    > > page class on the server side. You could do this with something like
    > > Anthem.Net because it handles callbacks by actually instantiating the Page
    > > class and preserving the page state. Find it on Sourceforge.net. Or, if you
    > > are more adventurous, ATLAS.
    > > Peter
    > >
    > > --
    > > Co-founder, Eggheadcafe.com developer portal:
    > > http://www.eggheadcafe.com
    > > UnBlog:
    > > http://petesbloggerama.blogspot.com
    > >
    > >
    > >
    > >
    > > "kelly" wrote:
    > >
    > > > Hi
    > > >
    > > > I have an app where I have 2 dropdown lists (state and city) and a Save
    > > > button. When a user selects a value from the state dropdown list, I
    > > > use script callback to populate the data for the city dropdown list.
    > > > By using script callback, I'm able to execute server side functions
    > > > without a postback.
    > > >
    > > > Now here is my problem...let's say I selected Illinois and then Chicago
    > > > on the dropdown lists. After I click on Save, the city dropdown list
    > > > no longer shows Chicago as the selected value, but shows the first item
    > > > in the city dropdown list instead. It seems as if the viewstate is not
    > > > being saved/updated or the control is not refreshed correctly?
    > > >
    > > > Is anyone else having this problem using script callbacks? It seems as
    > > > if I need to also change the viewstate field on the client side using
    > > > javascript?
    > > >
    > > >
    > > > Kelly
    > > >
    > > >

    >
    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Jul 24, 2006
    #6
  7. kelly

    kelly Guest

    Do you know if it's possible to modify/update the ControlState from the
    client side using javascript?

    I am able to modify the dropdownlist values on the client side using
    javascript but do not know how to modify/update the ControlState also
    on the client side. The control I'm using is a complex control and it
    calls LoadControlState when the Save button is clicked on to get the
    values of the controls on the page.

    Kelly

    Peter wrote:
    > if you are attempting to store values in the page where there is not a
    > postback,
    > you can store them in hidden fields on the page (for example), and when your
    > script callback is called, part of it's work would be to go get those values
    > and update whatever control needs to be "refreshed" via client-side
    > Javascript and the HTML DOM.
    > Peter
    >
    > --
    > Co-founder, Eggheadcafe.com developer portal:
    > http://www.eggheadcafe.com
    > UnBlog:
    > http://petesbloggerama.blogspot.com
    >
    >
    >
    >
    > "kelly" wrote:
    >
    > > Peter
    > >
    > > Thanks for the reply...but is there a way for me to get around this in
    > > asp.net 2.0? Since they introduced this feature, I'm sure many others
    > > have had the same problem.
    > >
    > >
    > > Kelly
    > >
    > > Peter wrote:
    > > > Kelly,
    > > > That's correct, the simple script callback doesn't preserve the stateful
    > > > page class on the server side. You could do this with something like
    > > > Anthem.Net because it handles callbacks by actually instantiating the Page
    > > > class and preserving the page state. Find it on Sourceforge.net. Or, if you
    > > > are more adventurous, ATLAS.
    > > > Peter
    > > >
    > > > --
    > > > Co-founder, Eggheadcafe.com developer portal:
    > > > http://www.eggheadcafe.com
    > > > UnBlog:
    > > > http://petesbloggerama.blogspot.com
    > > >
    > > >
    > > >
    > > >
    > > > "kelly" wrote:
    > > >
    > > > > Hi
    > > > >
    > > > > I have an app where I have 2 dropdown lists (state and city) and a Save
    > > > > button. When a user selects a value from the state dropdown list, I
    > > > > use script callback to populate the data for the city dropdown list.
    > > > > By using script callback, I'm able to execute server side functions
    > > > > without a postback.
    > > > >
    > > > > Now here is my problem...let's say I selected Illinois and then Chicago
    > > > > on the dropdown lists. After I click on Save, the city dropdown list
    > > > > no longer shows Chicago as the selected value, but shows the first item
    > > > > in the city dropdown list instead. It seems as if the viewstate is not
    > > > > being saved/updated or the control is not refreshed correctly?
    > > > >
    > > > > Is anyone else having this problem using script callbacks? It seems as
    > > > > if I need to also change the viewstate field on the client side using
    > > > > javascript?
    > > > >
    > > > >
    > > > > Kelly
    > > > >
    > > > >

    > >
    > >
     
    kelly, Jul 24, 2006
    #7
  8. Isn't ControlState a server-side property? The only thing you have on the
    client side is a bunch of HTML and possibly some javacript sitting in the
    browser, right?
    Take a look at Anthem.Net. It will help you to understand all this better,
    and save you a lot of time.
    Peter

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "kelly" wrote:

    > Do you know if it's possible to modify/update the ControlState from the
    > client side using javascript?
    >
    > I am able to modify the dropdownlist values on the client side using
    > javascript but do not know how to modify/update the ControlState also
    > on the client side. The control I'm using is a complex control and it
    > calls LoadControlState when the Save button is clicked on to get the
    > values of the controls on the page.
    >
    > Kelly
    >
    > Peter wrote:
    > > if you are attempting to store values in the page where there is not a
    > > postback,
    > > you can store them in hidden fields on the page (for example), and when your
    > > script callback is called, part of it's work would be to go get those values
    > > and update whatever control needs to be "refreshed" via client-side
    > > Javascript and the HTML DOM.
    > > Peter
    > >
    > > --
    > > Co-founder, Eggheadcafe.com developer portal:
    > > http://www.eggheadcafe.com
    > > UnBlog:
    > > http://petesbloggerama.blogspot.com
    > >
    > >
    > >
    > >
    > > "kelly" wrote:
    > >
    > > > Peter
    > > >
    > > > Thanks for the reply...but is there a way for me to get around this in
    > > > asp.net 2.0? Since they introduced this feature, I'm sure many others
    > > > have had the same problem.
    > > >
    > > >
    > > > Kelly
    > > >
    > > > Peter wrote:
    > > > > Kelly,
    > > > > That's correct, the simple script callback doesn't preserve the stateful
    > > > > page class on the server side. You could do this with something like
    > > > > Anthem.Net because it handles callbacks by actually instantiating the Page
    > > > > class and preserving the page state. Find it on Sourceforge.net. Or, if you
    > > > > are more adventurous, ATLAS.
    > > > > Peter
    > > > >
    > > > > --
    > > > > Co-founder, Eggheadcafe.com developer portal:
    > > > > http://www.eggheadcafe.com
    > > > > UnBlog:
    > > > > http://petesbloggerama.blogspot.com
    > > > >
    > > > >
    > > > >
    > > > >
    > > > > "kelly" wrote:
    > > > >
    > > > > > Hi
    > > > > >
    > > > > > I have an app where I have 2 dropdown lists (state and city) and a Save
    > > > > > button. When a user selects a value from the state dropdown list, I
    > > > > > use script callback to populate the data for the city dropdown list.
    > > > > > By using script callback, I'm able to execute server side functions
    > > > > > without a postback.
    > > > > >
    > > > > > Now here is my problem...let's say I selected Illinois and then Chicago
    > > > > > on the dropdown lists. After I click on Save, the city dropdown list
    > > > > > no longer shows Chicago as the selected value, but shows the first item
    > > > > > in the city dropdown list instead. It seems as if the viewstate is not
    > > > > > being saved/updated or the control is not refreshed correctly?
    > > > > >
    > > > > > Is anyone else having this problem using script callbacks? It seems as
    > > > > > if I need to also change the viewstate field on the client side using
    > > > > > javascript?
    > > > > >
    > > > > >
    > > > > > Kelly
    > > > > >
    > > > > >
    > > >
    > > >

    >
    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Jul 25, 2006
    #8
    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. Lucas Tam

    Client Side Callbacks for ASP.NET 1.x

    Lucas Tam, Feb 1, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    1,347
    Jeff @ Dart
    Feb 7, 2005
  2. =?Utf-8?B?TWljaGFlbFk=?=

    ASP.NET ICallbackHandler - Script callbacks....

    =?Utf-8?B?TWljaGFlbFk=?=, Jan 21, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,943
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jan 22, 2006
  3. aBs0lut30
    Replies:
    0
    Views:
    305
    aBs0lut30
    Aug 10, 2006
  4. =?Utf-8?B?TG93bGFuZGVy?=
    Replies:
    0
    Views:
    387
    =?Utf-8?B?TG93bGFuZGVy?=
    Mar 27, 2007
  5. Tim Spens
    Replies:
    1
    Views:
    884
Loading...

Share This Page