How to access a control on a web form from anoter web form

hi all

I have this scenarios

i have two web forms, one called form1 and the other called form2

form1 has a label with id "lbl1"

is it possible to access lbl1 from form2, change its text permenantly?

thanks.

0
MinaSamy
3/25/2009 10:56:34 AM
asp.net.free-for-all 9281 articles. 0 followers. Follow

4 Replies
1803 Views

Similar Articles

[PageSpeed] 39

 

refer: http://dotnetslackers.com/Community/blogs/haissam/archive/2007/11/26/ways-to-pass-data-between-webforms.aspx


SSN
Please remember to click "Mark as Answer" on the post that helps you.
0
suthish
3/25/2009 11:26:25 AM

MinaSamy:

hi all

I have this scenarios

i have two web forms, one called form1 and the other called form2

form1 has a label with id "lbl1"

is it possible to access lbl1 from form2, change its text permenantly?

thanks.

Hi once you navigate from the page you can only access its properties if you you cant chnage it

when you return back the value will again be new one unless you assign it

So you can use session variables and set the session variable

Session("lbl") = "Hello"

Label1.Text = Session("lbl").ToString()

 

hence whenever you chnage value of Session variable it will be reflected in ur label


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
3/25/2009 11:30:51 AM

Thanks for you help

but what I mean is there a method to add a control to form2 permenantly

so even after i close the browser and re-open it the added control is still there .

thanks.

0
MinaSamy
3/25/2009 11:58:55 AM

MinaSamy:

Thanks for you help

but what I mean is there a method to add a control to form2 permenantly

so even after i close the browser and re-open it the added control is still there .

thanks.

Add the control in ur aspx it will be there permanently


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
3/25/2009 12:22:30 PM
Reply:

Similar Artilces:

Accessing two web forms in a single web form
  Hi. I am developing a website in VS 2005 with Ajax & SQL Server. I am having 5 forms in my application. 1) Login Form 2) Main form 3) Form "A" 4) Form "B" I need to show the main form after the User login. I need to show all the contents of form A or form B (Ex: Form "A" user or form "B" user) in the Main Page. Can I show a single page having Main Form controls as well as Form "A" and Form "B" controls? I should access all the controls including Form A/B in the Main Page. Thanks ...

Access a Web User Control Method from a Web Form
I'm trying to pass the Selected Index value from a web user control in a web form to the user controls selectedIndexchanged Sub.  I can't seem to figure out how to pass the information that I need to the user control and have it execute the sub routine. In the SelectedInedxChanged Sub I have a switch Statement and I want to get the index value from the web form where the user control is located and compare it to each case and then to have it execute the code for the case that it matches. What do I need to do? Hi, I am not sure if I understood your question correctly. I su...

Access SqlDataSource on Web Form from a Web User Control...
Hello, I want to access a SqlDataSource on a Web Form fromout. a Web User Control. To do this, I have in my code behind of the Web User Control the folowing code: DropDownList1.DataSource = (this.Page.FindControl("SqlDataSource3") as SqlDataSource);DropDownList1.DataTextField = "Name;DropDownList1.DataValueField = "NameIDropDownList1.DataBind(); But, the control (ic. SqlDataSource3) is not found. Even other controls like labels and buttons are not found with the FindControl. What am I doing wrong? Thanks Andromedaris     This is not much of a surprise,...

Web forms and mobile web forms
Hey everyone, I am looking to develope a web site that depending on the device connecting to it, it will display a certain page. In this case im looking to create a web and wap version of the same project. I have the Web forms version finished using ASP.NET and C# and I am wondering how to create the mobile web form and incorporate it in the project. In the project folder, can I just add a mobile web??? But what about displaying device specific pages?? Cheers -Dudach Yes, you can add mobile web forms and controls to your Web Application project. No problem. For device/br...

How to Make Web Forms from other Web Forms
In putting together an ASP.NET application for a biz application, we have come to the point where there are three different types of basic forms which have, for the most part, been perfected. Now its is a matter of cloning those forms for various uses and modifying or adding code to suit the particular need. Copy and paste works OK, but there is a lot of changing of certain words, etc. Is there a way in ASP.NET to take these basic forms, turn them into classes or templates, create forms from them, then add or overwrite code? ? (Anybody who is a Vis Fox Pro programmer would know imme...

Controlling web control instances on Web Form
I have created a composite control, extending functionality of the Hidden Control. However, I would like to prevent the user from adding this control to the page multiple times. I only want one instance of the control on the Web Form. What setting in my project to I adjust to enable this functionality? I can not find it in any of the books that I have referenced. Is this a setting or is this code that has to be added to the inheriting class. Looks like there is no standard apporach. But I'd consider using static field to count number of created objects and throw exception if second object ...

Access Web Control's property within the Web Form
Hello, I have a Web Control which has a TextBox and a Button. I want to put this Control on a WebForm, then put some text in a Control's TextBox, press on Control's Button and be able to access text box's value from within the Web Form. That's my Control: _________________________________________________ public class Colo : System.Web.UI.UserControl { protected System.Web.UI.WebControls.TextBox TextBox1; protected System.Web.UI.WebControls.Button Button1; public string Myval{ get{return (string)ViewState["myval"];} set{ViewState["myval"] = va...

how to call controls of web control form in coding of other forms?
hello everyone i have one problem i have created one webcontrol shoppingcart in which there are two labels one of qty and other of amt which are initially enable =falsenow on other page(aspx page) i have one txtbox of qty as txtqty i want tat as soon as user enters qty txtqty and clicks on add cart button it shd be display d value in lblqty of web control shopping cart make sure i m using datalist on aspx page so give me suggestions on tat basis and my coding is in vb. plz give ur suggestions as fast as possible. Neeti what do you mean by webcontrol.... it this user control or normal ...

For interrupting.web form Resized by position of the div : if div can't dispaly all (such as only top part , then web form heithten the heght),resize the web form
Web Form Resized by position of the div : if div can't dispaly all (such as only top part , then web form heithten the heght),resize the web form ! Because of my pool English, if you can't see , I will explain more ! ThanksGambler is the real life I guess you mean when form grows it also grow parent div element. This is normal. If you want div to stay fixed size and rather clip the form and maybe show a scrollbar, look at overflow property in CSS.Thanks------------------------------------------------------------This posting is provided "AS IS" with no warranties, and confers no ...

Web Form embedded in another Web Form
Hi,  I have programmed a Web Form which acts like a scientific calculator. I would like to embedd this calculator in the upper left hand corner of another accounting Web Form. I don't want to host the calculator on the same server as the accounting page. I.e. I want them to have distinct URLs. Classically, I would do this using frames, but is there a better way using ASP? Is there some sort of Panel which can display the webpage at a specific URL which I can just drag onto my accounting Web Form? Thanks,  P1000   Frames are the only way to embed a webform inside ano...

Web Form vs. Web Content Form
If you don't mind, I would like to know what is the difference between those two items, when I go to add a new item I see both of those and I don't know what the difference is.  A content form is for use with a masterpage. A web form is a standalone web page. If you select web content form, you will then have to specify a masterpage for it. and what is a master page used for?  Hi, a master page is used to give a constant look and theme to a site, without having to duplicate code. So basically you can put your header, menu, nav and footer on a master page. Then a...

calling a web form from another web form
I would like to know what is the best way to open a web form from another web form. I would like to call it from a button control. Thanks Well, if I've grasped your question right, there are many methods to do that: 1)Response.Redirect > To navigate to another page from code and is equal to clicking a hyperlink. I suggest this as I think it's closer to your question. 2)Server.Transfer > This ends the current web form and begins a new web form. It's usable when you want to pass some variables i.e (Label1.Text) to the next immediate page. It's not safe though and not used to send p...

How to fire events in other web form from other web form ?
Suppose that I have A and B web form. I want to trigger B web form's Page_Load event from A web form. How can I do that ? Thanks in advanced WilbertWilbert Bujn Create a public method in B that call the load method : public void Load(object sender, System.EventArgs e) { Page_Load(sender, e) ; } In the page_load of A, instanciate a B object and then call the function B myB = new B() ; myB.Load() ; Quicky Thank you quicky, it works fine. WilbertWilbert Bujn...

Include web form inside web form
I tried to include an aspx file in a asp.net web form. However, all the web controls (textbox, button) in the included page are not displayed when called. <Form id="Form1" method="post" runat="server"> <%   Response.writeFile("subPage.aspx"); %> <asp:button id="btnPrev" runat="server" text="Previous"></asp:button> </Form> There are some <asp:textbox> controls in the subPage.aspx file, the file itself works fine, but when it is included in the main page, all the controls are not displayed. Please assist. Thanks   u should u...

Web resources about - How to access a control on a web form from anoter web form - asp.net.free-for-all

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 ...

WA bushfires: Firefighters work through the night to control several blazes
Firefighters in Western Australia are working through the night to control and contain several blazes.

Alaska Marijuana Control Board votes to allow consumption in retail outlets - Alaska Dispatch News
The Alaska Marijuana Control Board voted Friday to allow consumption of marijuana products in retail stores across the state. But social clubs, ...

69 percent of users would bypass security controls to win a big deal
When faced with the chance of clinching a major deal people are willing to throw security controls out of the window. This is according to research ...


MAZEL TOV, HILLARY: Clinton Wins Gun Control Award From Major Anti-Bill of Rights Group
... restrictions on the freedoms protected by the Constitution is not a sign of character, but a clear indication of blind adherence to a gun control ...

Obama to Veto Bill Requiring Background Checks On Syrian Refugees; France Demands Tighter Controls, EU ...
... does not call for ending the refugee program or require religious screenings, as some Republicans have demanded . France Demands Tighter Controls, ...

Brussels Pushes Gun Control In Wake of Paris Attacks
Europeans double down on gun control after terrorists murder defenseless civilians

Control Your HTPC With Scavenged IR Parts
If you’ve built yourself a home theater PC, one of your highest priorities is probably coming up with a convenient control solution. The easiest ...

5 Questions: Punjab’s rightful control over Chandigarh, says Prem Singh Chandumajra
Shiromani Akali Dal (Badal) MP Prem Singh Chandumajra on why he raised the issue of Punjab’s claim over Chandigarh in LS.

Resources last updated: 11/24/2015 7:46:36 AM