WebUserControl and JavaScript

A

Arun

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
 
C

Cowboy \(Gregory A. Beamer\) [MVP]

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!
************************************************
 
A

Arun

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top