?
Solved

reusing a webform in visual studio 2010

Posted on 2011-09-28
12
Medium Priority
?
218 Views
Last Modified: 2012-05-12
how can i create webforms in visual mode and put them in a server control to be used on webapplications that reference the web control dll.

Thanks,
Luis
0
Comment
Question by:girosoft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 22

Expert Comment

by:Mrunal
ID: 36814015
Can you please explain more what  you want to achieve with type of scenario?

Other option is:

Make user-control / custom-control.
0
 

Author Comment

by:girosoft
ID: 36814292
Hello,
I want to create a webform that performs certain tasks (like showing a grid with a list of products of a type), i can do that easialy if i create the webform as part of the webapplication, but what i want is to put that in a library (dll) that i can reuse in different webapplications, in visual studio 2010 there is no webcontrol library i guess now is server control, but i found no way of exposing the webform created in the library to the client webapplications.
0
 
LVL 25

Expert Comment

by:kevp75
ID: 36814310
usually i do everything in the code-behind.  with VB we have XML literals that allow us to build things like a form, simply as

Dim _TmpForm = <form method="post" action="">
                          <%= 'Fields here %>
                          </form>

just do this in your class assembly...   make it a function with a datatype of string or XElement, build your form in it using XML literals, then return it
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 17

Expert Comment

by:Jesse Houwing
ID: 36814527
You can't easily share an aspx with different sites. What you can easily share are webcontrols and webparts, but they require a different way of working.
http://msdn.microsoft.com/en-us/library/zt27tfhy.aspx

Alternatively, you can place your pages and usercontrols in a resource and load them through a virtual path provider:
http://www.codeproject.com/KB/aspnet/ASP2UserControlLibrary.aspx
0
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 37916707
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
 
LVL 17

Expert Comment

by:Jesse Houwing
ID: 37916708
It's just not easily done.

To re-use parts of a page the recommended way is to create controls or usercontrols. And with a FileSystemProvider you can redirect a web application to a different storage location (as demonstrated in the second link I provided).

If it were as simple as the OP would like it to be, then this question would have been answered a long time ago.
0
 
LVL 17

Accepted Solution

by:
Jesse Houwing earned 2000 total points
ID: 37928058
ascx and aspx fiels can't be shared across projects without investing in a serious amount of custom code (you'll need to write a custom FileSystemProvider for ASP.NET and configure that in your website).

What can be done is to create a server control. These are simple .NET classes that inherit from WebControl or Page. You can't use an aspx or ascx with these to store your mark-up, you'll instead have to build the control tree completely from code.

To make use of such server controls, you (in case of webcontrols) add them to the toolbox and drag them on your page. or in case of Page controls, you inhertit your aspx page from them. so replace public class MyPage : Page {} with public class MyPage : MyBasePage {}
0
 
LVL 17

Expert Comment

by:Jesse Houwing
ID: 37928143
I hope that with this additional clarification, my answers can be AAccepted as answer to the question.
0
 
LVL 25

Expert Comment

by:kevp75
ID: 37928837
I agree.   PAQ http:#37928058
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question