Solved

asp.net/vb.net reusable code

Posted on 2009-07-10
3
443 Views
Last Modified: 2013-11-08
Hi

 i want to put below code into app_code folder  as myTask.vb file which cna be re-usable accross the project in .aspx pages.

Currently, i do below
in my .aspx page,

i create     <asp:Literal runat="server" ID="litForm" />. in code behind based o i populate this in "litForm_Load" function and i make "litForm" visible/invisible based on some condition.
 Protected Sub litForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles litForm.Load

      Dim sbForm As New StringBuilder
  sbForm.AppendLine("<form action=""some website"" method=""post"">")
sbForm.AppendLine("<input type=""hidden"" name=""myV1"" value=""mytest1"" />")
        sbForm.AppendLine("<input type=""hidden"" name=""myv2"" value=""" & ConfigurationManager.AppSettings.Item("mytest2") & """ />")
 sbForm.AppendLine("<input type=""image"" name=""submit"" border=""0"" src=""mywebsite/mybtng.gif"" alt=""this is my test onlne"" />")

 sbForm.AppendLine("</form>")

        litForm.Text = sbForm.ToString



when the user cliks on the image (mybtng.gif), page will be redirectred to the action url mentioned in <form> attribute.


I want to make above code  re-usable accoress the projects. just wherever they need just reuse it.
Please help me.








0
Comment
Question by:ram27
3 Comments
 

Author Comment

by:ram27
ID: 24826449
in above , i mentioned it should be in .vb file but it is not mandatory anywhere it could be control or ,vb file or anything , goal is to re-use accress the pages(.aspx) withing a web poject.
0
 
LVL 19

Accepted Solution

by:
daveamour earned 500 total points
ID: 24829525
You need to look at writing a custom web control.
http://msdn.microsoft.com/en-us/library/aa728786(VS.71).aspx
 
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

929 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now