• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 673
  • Last Modified:

How do build aspx code that allows you to re-use code.

Hi,
  How do you build aspx code that re-uses aspx code that you have developed instead of adding the same code over and over again?

  I have some lines of aspx code that are used in the forms that I want to maintain in one place instead of sticking it on each new form..

Thanks,
Keith
0
KeeterBlack
Asked:
KeeterBlack
  • 2
1 Solution
 
Paul MacDonaldDirector, Information SystemsCommented:
They're called "classes".  You can have as many or as few as you want, and use them to organize your code any way you like.  

http://msdn.microsoft.com/en-us/library/ms973814.aspx

http://www.daniweb.com/web-development/asp/tutorials/19997/understanding-asp-classes
0
 
KeeterBlackAuthor Commented:
Paul...

   No... Not Classes..  

  I am talking about adding plain old aspx code(markup) that I use over and over again.

  Unless there is someway to make a class with Aspx code.

Example of code used in many different forms:
=========================================
                  <asp:Panel id="Panel1" runat="server" horizontalalign="Center">
                        <div id="submitbutton" runat="server">
                              <igtxt:WebImageButton id="btnSubmit" runat="server" text="Submit Changes" height="40px"
                                    onclick="btnSubmit_Click">
                              </igtxt:WebImageButton>
                              <igtxt:WebImageButton id="btnDismiss" runat="server" autosubmit="False" height="40px"
                                    text="Dismiss Changes">
                                    <ClientSideEvents click="CancelClicked" />
                              </igtxt:WebImageButton>
                              <igtxt:WebImageButton id="btnDelete" runat="server" height="40px" text="Delete Record">
                                    <ClientSideEvents click="delRecord" />
                              </igtxt:WebImageButton>
                        </div>
                  </asp:Panel>

===========================================
The above code is needed in many different forms.

Thanks,
Keith
0
 
Gerry BartleySoftware EngineerCommented:
Try putting this in  a usercontrol ascx. Then it's available in one place and any mods are reflected on all existing forms

Can be dropped onto any page like any page control

http://msdn.microsoft.com/en-us/library/y6wb1a0e(v=vs.100).aspx
0
 
KeeterBlackAuthor Commented:
Thanks...

That will work!!!!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now