Link to home
Start Free TrialLog in
Avatar of ram27
ram27

asked on

asp.net/vb.net reusable code

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.








Avatar of ram27
ram27

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of daveamour
daveamour
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial