same user control in two pages, display data from data base same time

I have two pages(.aspx), each of them have
same user control(.ascx) inside. that user
control dispaly data from database. after I click
the first page which displays data on the user control.
I click the second page, I want to display same data already in
the user control on the second page, thanks for any idea.
0
hong_ma
5/12/2005 1:58:37 AM
asp.net.web-forms 93655 articles. 5 followers. Follow

5 Replies
742 Views

Similar Articles

[PageSpeed] 4

sorry, i don't quite understand what you are trying to do.

are you trying to say that the data should be cached for the usercontrol so it doesnt need to do constant trips to the database, if so:

you should have a look at this : http://www.dotnetjunkies.com/quickstart/aspplus/doc/cachingoverview.aspx

The asp.net caching will allow you to cache pages by controls and pages.

 

Regards,

0
hysaccess
5/12/2005 5:56:23 AM
I used user control(ascx), not frames. I used same user control in different page. 
in the first page. the user control dispalys some data. when I  go to the second page,
I like user control dispalys same data already.(this is my problem).I don't want to use
 the same criteria to get the data for the second page. that means, I should get data
from user control in the first page, Then pass the data to the second page, after that,
 pass that data from second page to the inside user control. is it right? or another way to
do this.
0
hong_ma
5/12/2005 2:02:30 PM

Yes you can use the fragment cache for that....Just make sure you have set Shared=true

<%@ outputCache Duration="120"  Shared="True" %>

OR

You can use data Cache and cache the result generated in First Page. When your user control is invoked from the second page it will just check if data exist in Cache. If it does then just display that data. 


ASP.Net Tips & Tricks - Jawad's Blog
0
JawadKhan
5/12/2005 2:15:03 PM

What type of data do you need to pass ?

Otherwise you can decalare a public variable in the user control

and declare the usercontrol in your vb code then set the public variable in the public control to that value you need

sounds complicating .. :)

0
hysaccess
5/12/2005 11:09:16 PM
Reply:

Similar Artilces:

Problem in accessing web form data in user controls when create user control dynamically
HI. I have a problem using web user control. I designed a user control named NewsForm. This user control contains some web form elements like <asp:textbox>. When I add it in an .ASPX page, all things may be true. I can know which user filles in textbox (for example and other controls) <%@ Register TagPrefix="uc1" TagName="NewsForm" Src="NewsForm.ascx" %> and <UC1:NewsForm id="newsForm" runat="server"></UC1:NewsForm> But when i create it in code behined dynamically, however user control has web form controls but their value are blank for example //aspx co...

Pass data from Web User Control to Web Form
I have a Web Form that contains a Web User Control. The WUC displays dynamic content. I want to change the TITLE property of the Web Form, based on the contents of the WUC. For example, if the WUC displays information about Horses, I want to change the page title to "HORSES" by passing the string to the parent Web Form. I have tried playing with parameters and such, but I can't remember how I did this in the past. PLEASE HELP!~o0 Spin-Monkey Oo~ The best way to do this is by creating a public property on your web user control and accessing that from your web form. Check ...

Persisting data in a web user control, which contains a list of other web user controls.
 Hi All, I have a control I've created, which can have a number of child controls - also user controls - stored as an ArrayList, which can be added wither a design time or programmatically.My problem is when I add to the list programmatically, it doesn't persist them. So if I add 3 child controls in step 1 of a wizard, with the aim that those three will be visible inside the parent in step 3, what happens is that the parent has no child controls and the item count is 0.Can anyone help? Thanks in advance.Code:Parent Control Markup: <%@ Control Language="C#" Auto...

user control data entry form, use same codebehind as web form?
Hi All, I have a quesiton about the approach I'm taking. I have a series of report forms which I have been in the process of consolidating to a single, generic page and subs/functions in a single code-behind. All the reports can use the same set of data entry elements (a dropdown, a radio list, and a textbox). I'm trying to convert these elements to a user control. However, this user control seems to need to inherit differently than the rest of the code-behind. I've been using a single class in the code behind. Is it feasible to separate out the data entry? the code behind im...

how to htmlencode data when using data controls to display data
Hi Lets say you are displaying a colllection of records in a gridview and you want to make sure all of the rows and columns are html encoded before you display them, how can can you get the gridview to do this automatically? I don't want to have to create a template for each bound column. Thanks very much andrea Hi Andrea, I believe there is a "HtmlEncode" property on each column that you can set.  By default I believe it is set to true.  You can pull up the column editor by selecting the "edit columns" task, and then select the columns in the botton left of the dialog to see...

How to get data from data base and display it in data grid
 hi,am having a connection to data base and now what i want is , how can i display the data from database and display it in my data grid.any sample code of 2 or 3 lines can be of great help. i know how do i get data for a drop down from data base  as below.List<CRoleBE> roleList = roleInterface.GetAllRoles();ddlBaseRole.Items.Add(new ListItem("Select any Role", "-1"));foreach (CRoleBE businessEntity in roleList){    ListItem item = new ListItem(businessEntity.Name, businessEntity.ID.ToString());    ddlBaseRole.Items.Add(i...

Web form that displays data and post data to a database
Hi,  I have a web form that needs to Get the userID and then display data from datasource 1 -  name, Phone, Address etc. of the user Then on the same form the user needs to submit additional information and click submit.  On click submit, I would like to capture all the info about the user from datasource1 - i.e name, phone, Address etc along wiht the additional info submitted by the user and insert into a table. Currently the way I am doing is: when the user enters their UserID, I use a formview to display the user data. When the user clicks submit on th...

How to Bind Data to Whole Web Form not in Data Control
How to Bind Data to Whole Web Form not in Data Control. To Get Data Like <%= %> One way to do it would be to create properties in your page class and then set them at Page_Load retrieving your data from whatever source. Can I ask why you would not want to use .Nets data controls? They make life so much easier.~mike~ agree with mike.  just drop in a literal and set literal's text property. Another advantage to that is if your "form" is editable, upon post back, values are retained automatically without the need to bind from datasource again...most of the time anyway. Then agai...

UpdatePanel within a web user control resets data of controls outside the user control
Hello, I have a usercontrol on my page which displays a running marquee text. It makes use of an UpdatePanel (within the user control) to refresh the marquee text (within the updatepanel) at periodic intervals. For this I added a timer control and its tick event as an async postback trigger for the UpdatePanel. I have a lot of textboxes and dropdown list boxes (all with runat=server) on the page outside the above user control. These are also contained in different UpdatePanels. Problem is, when the user control does a postback to refresh the marquee text, it causes some of...

C#.NET WEB APPLICATION
hei guys, i need help on my application, i'm using C#.NET as front-ed and SQL as back-end, aside from a datagrid, i want to display my data using textboxes and not a datagrid, i can do it using Visual Basic 6 but since i'm a newbee at C#.NET i don't know how to do it, specially the codes, can anyone help me with it? thank you in advance! If you are doing windows development, i would suggest using 'DataForm wizard' (Use Solution Explorer-->Rightclick project-->Add new Item-->New DataForm). It will guide you through steps. If you are doing web apps. Use quickstart to learn them. h...

how to insert data in to the data base from a dynamically generated user control
Hi, I am loading one user control dynamically multiple times in a single page inside of an dynamically generated html table row. I am able to load that user contol dynamically multiple times, but the problem is , i want to enter data in the dynamically loaded user control's text boxes and insert the same data in to the database tables. please provide me a simple example to insert data in to the data base from dynamically generated user control. ?   The code for dynamically loading an user control which i have written is as follows:   using System; using System.Data; using...

how to integrate My Web Pages Starter Kit (MWPSK) with Dynamic Data? Convert Page Template to User Controls?
All --Has anyone investigated how to integrate My Web Pages Starter Kit (MWPSK) with Dynamic Data?   If case you are not familiar with MWPSK, then just know that MWPSK uses a web-user-control-based customization model whereby anything that is a user-control can be displayed on any page, and pages can be created at run-time via a Content Management System (CMS) framework.   So, the problem with integrating Dynamic Data in MWPSK is that the Page Templates would need to be user-controls.   While it is not difficult, in general, to convert an ASPX to an...

passing data from user control to web form
I have a user control, with some text boxes. in my webform, I am dynamically loading the control - Dim uc As Control = Page.LoadControl("moreemployers.ascx") ' move control to placeholder. place1.Controls.Add(uc) I am using the following to define the text fields in the user controls. Public Property employername() Set(ByVal Value) txtename.Text = Value End Set Get Return txtename.Text End Get End Property how can I access these variables in the web form? bevbev if y...

Web form Access to User Control Data
I need to access the value of a User Control Public variable from the code behind page of the form containing the user control. Right now I can't see the user control from the code behind page. This contol is not dynamically loaded....

Web resources about - same user control in two pages, display data from data base same time - asp.net.web-forms

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Continental Automotive recalls 5 million airbag control units
Filed under: Recalls , Chrysler , Fiat , Honda , Mercedes-Benz , Safety , Crossover , Minivan/Van , Sedan Only 580,000 Continental airbag-equipped ...

Zika Control Demands Anti-Mosquito Measures, Officials Say
Governments and residents of areas where Zika virus is spreading should redouble their efforts to limit exposure to mosquitoes that carry the ...

This architect quit his job to make an app that gives you back control of social media
... Aldo Cherdabayev quit his job and moved to Dublin, Ireland, to start a company. He wanted to build app called that gives you back control of ...

Sessa Capital Files Lawsuit against Ashford Hospitality Prime over Change in Control Provision
Sessa Capital (Master), L.P. (&ldquo;Sessa&rdquo;), owner of 8.2% of the outstanding common shares of Ashford Hospitality Prime, Inc. (NYSE:AHP) ...

Study: Texas birth control fell after Planned Parenthood cut
Fewer women obtained long-acting birth control, births increased in poor families after state dropped Planned Parenthood from health program ...

Zika tests Catholic position on birth control
... problems, they're creating a theological conundrum for the Catholic church The church has long forbidden nearly every form of birth control, ...

Panel: Takata Lacks Quality Control Processes, Policies For Addressing Defects
An independent review panel hired by Takata — the company behind the ongoing recall of millions of defective, potentially dangerous, airbags ...

Air Traffic Control: Ripe For Reform
The Canadians are right — it’s time to privatize our air traffic control system.

Khloe Kardashian Says Kourtney Kept Her From 'Spiraling' Out of Control, Wants Rob to Be 'Happy'
The 'Kocktails With Khloe' host shared a touching post to her website, recalling how her sister saved her from a destructive path.

Resources last updated: 2/4/2016 9:10:28 PM