WebUserControl and JavaScript

Discussion in 'ASP .Net' started by Arun, Jul 13, 2004.

  1. Arun

    Arun Guest

    I am new to ASP.NET I need some help for this scenario

    The scenario is like this

    I have a template Page which loads a WebUserControl (uct1.ascx) inside
    a PlaceHolder (PH1)

    Now this Web User Control (uct1.ascx) has a table with 2 rows
    First row has a 5 text boxes 2 Combobox and 6 buttons (all Server
    Controls)
    Second row just has a placeholder (PH2)

    When the user clicks on each button a respective webusercontrol is
    loaded into the placeholder (PH2)

    Now my question is
    When I click on each button it refreshes the whole page. Which means
    it is going to the server for each and every click,

    Can I avoid this, if so how

    I tried this option by loading all the user control @ once and making
    it visible true/false @ runtime through java script

    But Javascript doesn't seems to work fine with Web User Control as it
    is not getting the document.all.XXXX says it is null

    I would appretiate if some one advice me the best way to go

    Thanks
    Arun
    Arun, Jul 13, 2004
    #1
    1. Advertising

  2. Going to the server is not a problem, per se, as long as you remember you
    have to "reload" dynamic items with each trip. For dynamic clicks, you will
    have to store the information somewhere. ViewState is one option that works,
    as long as you are not sending too much info (as it travels back and forth
    between client and server). Cache is another option, as is Session (although
    I would not use Session for this). If the amount of data warrants, you can
    also throw the information into a persistent store, like a database.

    You are going to have to maintain a bit of state in your code, knowing where
    someone is in the process.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    ************************************************
    Think Outside the Box!
    ************************************************
    "Arun" <> wrote in message
    news:...
    > I am new to ASP.NET I need some help for this scenario
    >
    > The scenario is like this
    >
    > I have a template Page which loads a WebUserControl (uct1.ascx) inside
    > a PlaceHolder (PH1)
    >
    > Now this Web User Control (uct1.ascx) has a table with 2 rows
    > First row has a 5 text boxes 2 Combobox and 6 buttons (all Server
    > Controls)
    > Second row just has a placeholder (PH2)
    >
    > When the user clicks on each button a respective webusercontrol is
    > loaded into the placeholder (PH2)
    >
    > Now my question is
    > When I click on each button it refreshes the whole page. Which means
    > it is going to the server for each and every click,
    >
    > Can I avoid this, if so how
    >
    > I tried this option by loading all the user control @ once and making
    > it visible true/false @ runtime through java script
    >
    > But Javascript doesn't seems to work fine with Web User Control as it
    > is not getting the document.all.XXXX says it is null
    >
    > I would appretiate if some one advice me the best way to go
    >
    > Thanks
    > Arun
    Cowboy \(Gregory A. Beamer\) [MVP], Jul 13, 2004
    #2
    1. Advertising

  3. Arun

    Arun Guest

    Thanks ,
    It works fine with cache,
    Is their a way i can do this using Javascript @client site.
    so once i get the data from the server i have to only enable/disable
    the webusercontrols on the button click.
    (Using the javascript, i am unable to get the webcontrols ClientID, i
    can get the clientID for controls inside it. Just out of curiosity, is
    it possible to do this way.)

    Thanks
    Arun

    "Cowboy \(Gregory A. Beamer\) [MVP]" <> wrote in message news:<uOx#>...
    > Going to the server is not a problem, per se, as long as you remember you
    > have to "reload" dynamic items with each trip. For dynamic clicks, you will
    > have to store the information somewhere. ViewState is one option that works,
    > as long as you are not sending too much info (as it travels back and forth
    > between client and server). Cache is another option, as is Session (although
    > I would not use Session for this). If the amount of data warrants, you can
    > also throw the information into a persistent store, like a database.
    >
    > You are going to have to maintain a bit of state in your code, knowing where
    > someone is in the process.
    >
    > --
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBA
    >
    > ************************************************
    > Think Outside the Box!
    > ************************************************
    > "Arun" <> wrote in message
    > news:...
    > > I am new to ASP.NET I need some help for this scenario
    > >
    > > The scenario is like this
    > >
    > > I have a template Page which loads a WebUserControl (uct1.ascx) inside
    > > a PlaceHolder (PH1)
    > >
    > > Now this Web User Control (uct1.ascx) has a table with 2 rows
    > > First row has a 5 text boxes 2 Combobox and 6 buttons (all Server
    > > Controls)
    > > Second row just has a placeholder (PH2)
    > >
    > > When the user clicks on each button a respective webusercontrol is
    > > loaded into the placeholder (PH2)
    > >
    > > Now my question is
    > > When I click on each button it refreshes the whole page. Which means
    > > it is going to the server for each and every click,
    > >
    > > Can I avoid this, if so how
    > >
    > > I tried this option by loading all the user control @ once and making
    > > it visible true/false @ runtime through java script
    > >
    > > But Javascript doesn't seems to work fine with Web User Control as it
    > > is not getting the document.all.XXXX says it is null
    > >
    > > I would appretiate if some one advice me the best way to go
    > >
    > > Thanks
    > > Arun
    Arun, Jul 14, 2004
    #3
    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. Michael Groeger
    Replies:
    2
    Views:
    1,968
    Michael Groeger
    May 9, 2005
  2. DagoFlores
    Replies:
    0
    Views:
    401
    DagoFlores
    May 19, 2005
  3. Christian H

    WebUserControl and design time support

    Christian H, Sep 30, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    444
    Christian H
    Sep 30, 2005
  4. =?Utf-8?B?cm9kY2hhcg==?=

    databinding and webusercontrol

    =?Utf-8?B?cm9kY2hhcg==?=, Oct 25, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    298
    =?Utf-8?B?cm9kY2hhcg==?=
    Oct 25, 2006
  5. Jorge Ponte

    Open Window with Javascript from WebUserControl and return values

    Jorge Ponte, Dec 20, 2004, in forum: ASP .Net Building Controls
    Replies:
    3
    Views:
    254
    Analisa
    Jan 17, 2005
Loading...

Share This Page