Urgent!!! Form inside Windows form control (that is embedded to Web page i.e aspx), not displayed on button click

 Hi all I have a Windows Form Control(i.e Windows Control Library), that consists of a Button "button1" and  a panel "panel1". Also I have a form "form1.cs". On form "form1.cs" I have a label whose text value i have set to  "Hi". On click of button "button1" on windows form control i am opening the form "form1.cs"  inside a panel and it displays "Hi". The code of windows form control is as below :

  public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form1 obj = new Form1();                   //This form has a label control whose text value is set to "Hi"
            obj.TopLevel = false;
            panel1.Controls.Add(obj);
            obj.Show();
        }
    }

Now when i run this control it runs fine and on click of button the "form1.cs" is displayed(with label showing "Hi" ).

 

Now comes the real problem, I am creating  a new asp.net website and  embedding this Windows form Control in my web page(i.e aspx page)  usign <object> tag. Now when i create virtual directory of this website and acess my web page throught virtual directory the control s loaded fine on web page with button "button1" on it.  But on click of button form "form1.cs" is NOT DISPLAYED..................I have no guess why it is happening coz the control indivdually is workign fine but when embedded to aspx page , on click of button it doesn't diplays the form "form1.cs" .........

lookign forward for positive response  asap.........n its urgent

cheersssss......sssss

nav
 

0
navdeeprana
9/21/2007 10:34:12 AM
asp.net.web-forms 93655 articles. 6 followers. Follow

4 Replies
2534 Views

Similar Articles

[PageSpeed] 56
Get it on Google Play
Get it on Apple App Store

Hi nav,

navdeeprana:

But on click of button form "form1.cs" is NOT DISPLAYED

when use a hosted winforms usercontrol you must think a little different. AFAIK the Form.Show() wont works in a hosted environment. You must design your usercontrol as a closed control with all the controls you need on it. Means no further dialogs allowed. If you go this way, you'll see it works.

BTW, i'm doing a similar job in the moment and thats the knowledge i was came to.

 


Servus,
Klaus

I haven't the faintest idea, but great many therefrom.
klaus_b@.NET
0
klaus_b
9/21/2007 2:06:17 PM

Hi , as u said that i must design my usercontrol by placing all the controls i need on it.......but as per my functionality for instance i getting images from a medical device and storign it in array.......so i have to create as many instances of the the form inside the user control(at runtime) as many images are there so that each of the image is displyed in separate window......so i think it is not feasible to to have a control hardcoded on to my user control since depending on number of images retrieved at runtime i have to create that many instances of the form and display image in it ......so that user can save it......

 

0
navdeeprana
9/21/2007 6:47:41 PM

navdeeprana:

but as per my functionality for instance i getting images from a medical device and storign it in array

it sounds like the medical device is connected to the client, right?

navdeeprana:

so i have to create as many instances of the the form inside the user control(at runtime) as many images are there so that each of the image is displyed in separate window......so i think it is not feasible to to have a control hardcoded on to my user control since depending on number of images retrieved at runtime i have to create that many instances of the form and display image in it ......so that user can save it......

the solution for the requirement you're write here, sounds to me like a typical winforms app. All the jobs are be done on client side, no server interaction is required.

If i misunderstand you, please correct me.

 


Servus,
Klaus

I haven't the faintest idea, but great many therefrom.
klaus_b@.NET
0
klaus_b
9/22/2007 10:12:38 AM

 Hi , ye u r right the device is connected at clients end and my Windows form control embedded in web application interacts with the h/w device at client's end. N ya no server side functionality is required.

As u said

"when use a hosted winforms usercontrol you must think a little different. AFAIK the Form.Show() wont works in a hosted environment. You must design your usercontrol as a closed control with all the controls you need on it. Means no further dialogs allowed"

I am able to open form inside my windows form control that is embedded into a web page. So my problem is solved.

Thanx for ur time......

chersssss............

nav

0
navdeeprana
9/22/2007 2:45:19 PM
Reply:

Similar Artilces:

Can my web page with a form submit to other web pages forms?
I was wondering if I created an aspx page that had a form on it that I could use the submit button to submit this form's contents to other web pages forms(servers accepting those form's data). I am thinking this would be a great way to update data on particular web pages without having to actually visit those similar web pages. Any ideas, examples would be much appreciated. Thanks in advance.  Yes you can.  It's called Cross Page Posting: http://msdn2.microsoft.com/en-us/library/ms178139.aspxAlso: http://msdn2.microsoft.com/en-us/library/ms178140.aspx might ...

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

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

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.   refer: http://dotnetslackers.com/Community/blogs/haissam/archive/2007/11/26/ways-to-pass-data-between-webforms.aspxSSNPlease remember to click "Mark as Answer" on the post that helps you. 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 p...

Strange output in web form after web form is displayed.
   I have been using a web user control for over a week now with no problems. I am now getting strange output in my web form after my controls display on the page. Below is the strange output. Can anyone tell me what is wrong here? Note I did not include it all because it is quite large.   Request Details Session Id: l5b5vkazucfatba4oliaw1vi Request Type: POST Time of Request: 9/10/2007 4:59:59 PM Status Code: 200 Request Encoding: Unicode (UTF-8) Response Encoding: Unicode (UTF-8) Trace Information Category Message From First(s) F...

Web Form : Block the return button on the web form
Hello, I have a principal form with a list of information. From this form, I go on an edit forms and I want to control what is done on this form. For this, I want to block the button Windows back on my edit form. Somebody can help me ? Thank you for your help.  Jy. set the Session Variable (with your ID or whatever ) in the Principal Form when user click on Edit then put the One Back Button on your edit form and Redirect the page by using the Session variable value.Please Mark as Answred If This Blog has Helped You.RegardsMitesh Darjihttp://www.indianic.comhttp://www.mitatdotnet....

ASPX Web Form window jumps when link button or button is clicked
Dear, i m senthil, and i m new to asp.net I m using asp.net with vb, my problem is, i m creating a forum, in all web pages while clicking any link button or command button the webpage jumps and the focus is going to some other controls. I want the page not to get jumped... Pls help in this regard. set the MaintainScrollPositionOnPostback property of your page to true. http://msdn.microsoft.com/en-us/library/system.web.ui.page.maintainscrollpositiononpostback.aspxMike Banavige~~~~~~~~~~~~Need a site code sample in a different language? Try converting it with: http://converter.telerik.co...

add window form control on web form
i want to add windows from control link label on web from .what should i do?  saurabhiP:i want to add windows from control link label on web from . Windows form controls are for windows application and should not be used on web forms.You want a link label which is the same as a hyperlink in ASP.NET so use that instead.  saurabhiP:i want to add windows from control link label on web from .what should i do?  Hi saurabhiP,Base on my understanding, you want to use windows control to web form. But base on my experience, there are many issues! Check the following l...

windows forms in vb .net into web forms
we are creating a database driven website as part of our project. currently we have forms connecting to the database created in visual basic. these windows forms we need to convert into web forms which are asp .net compatible. can u give me an answer or show me a way. Hi, because of the difference in nature between web and win applications you'll need to reimplement at least the UI part. If you have a multitiered application in which the busines logic and data access are in different parts/assemblies you can reuse them. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Wor...

Web Forms or Windows Forms
Hi; I got started a new project for a company's Intranet. This is a test database system which we will use as a pool and put data and update,del,add simply modification operations on.I am learning .NET and implementing this system together I am using web-forms now.Everyone enters their pass and user-name to be able to use the system.But I can implement this system with Windows Forms also.At this case if you were me which form system you would use? Thank you for your replies There are definate advantages to using Web Forms since they do not have to be deployed to each client...

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

Sharepoint help! Error msg : "A Web Part or Web Form Control on this Web Part Page cannot be displayed or imported because it is not registered on this site as safe"
hihi, I have set up a testing virtual server on my local machine. I installed win server 2003, wss 2.0, sql server 2000, and visual studio .net 2003. i tried to create a project in C# but when i build it and import the web part (.dwp) into the page, there is this error msg "A Web Part or Web Form Control on this Web Part Page cannot be displayed or imported because it is not registered on this site as safe"  I seached most of the sites and they informed that the problem lies in the safe control in web.config i enter the safe control in web.config but i does not know where to put ...

Open web page in IE and populate fields on the form from my web form
To the dot net Knights.  Many humble thanks in advance from a dot net surf. We have an vb application that opens multiple instances of IE object, each to different web pages.  It then takes information from the current record in the app, populates fields on each of the web pages, and them submits the forms.  We are then able to look at the resulting web pages and quickly get the info we're looking for.This prevents us from having to manually navigate to each web site, enter the same information and then wait for the page to open.  If there is ...

Web resources about - Urgent!!! Form inside Windows form control (that is embedded to Web page i.e aspx), not displayed on button click - asp.net.web-forms

After historic election, China says Taiwan an internal affair
Taiwan is an internal matter for China, there is only one China in the world and the island's election neither changes this reality nor international ...

IS attack on Syria's Deir Ezzor kills 75 regime forces: Monitor
At least 75 Syrian soldiers and pro-regime militiamen were killed Saturday in a multi-front attack by the Islamic State group on the eastern ...

Donald Trump Booed By Conservative Crowd After Attacks on Ted Cruz
NBCNews.com Donald Trump Booed By Conservative Crowd After Attacks on Ted Cruz NBCNews.com MYRTLE BEACH, S.C. — Among conservatives, Donald ...

FX CEO John Landgraf updates his forecast on 'too much TV,' talks Netflix
The man who ignited the “too much television” discussion six months ago has an update to his thoughts on the state of television.FX Chief Executive ...

China tourists splurge US$229b in 2015, Europe most popular outside of Asia: GfK
CHINA produced 109 million outbound tourists in 2015, and they come with whopping purchasing power, spending some US$229 billion in retail therapy. ...

Her lead all but gone in Iowa, Hillary Clinton deploys Bill to win over voters
Los Angeles Times Her lead all but gone in Iowa, Hillary Clinton deploys Bill to win over voters Los Angeles Times Former President Clinton ...

Windows Phone's Word Flow keyboard is coming to 'other platforms' starting with iOS
Kareem Anderson / WinBeta : Windows Phone's Word Flow keyboard is coming to ‘other platforms’ starting with iOS — Piece by piece it looks like ...

Man accused of financing Jakarta attacks with IS funds arrested
12 suspec­ts have been detain­ed in nation­wide raids since Thursd­ay's attack­s

Kendall Jenner & Sis Kylie Will Be Showing At NYFW This Year
Kendall Jenner is all smiles as she spots her friends nearby on Friday afternoon (January 15) in Los Angeles. The 20-year-old model hung out ...

Hawaii woman heard 2 booms on night Marine choppers crashed
Los Angeles Times Hawaii woman heard 2 booms on night Marine choppers crashed Miami Herald A retiree who lives across the street from a Hawaii ...

Resources last updated: 1/17/2016 2:00:40 AM