[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

asp.net/vb.net reusable code

Posted on 2009-07-10
3
Medium Priority
?
451 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
[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
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 2000 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

650 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