Solved

asp.net/vb.net reusable code

Posted on 2009-07-10
3
441 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
Comment Utility
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
Comment Utility
You need to look at writing a custom web control.
http://msdn.microsoft.com/en-us/library/aa728786(VS.71).aspx
 
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 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

7 Experts available now in Live!

Get 1:1 Help Now