Advertisement

05.29.2008 at 10:27AM PDT, ID: 23442209
[x]
Attachment Details

How to compartementalize ascx code?

Asked by UnifySupport in Programming for ASP.NET, .NET

I'm pretty sure its simple, but I'm a bit confused. I have  a number of control files (eg. foo1.ascx, foo2.ascx) and they'll all have the same section of code  like:

<table border="0" cellpadding="0" cellspacing="0" style="width:100%;margin-top:10px">
      <tr>
            <td>
                  <table border="0" cellpadding="2" cellspacing="0" style="height:100%; text-align:right;">
                        <tr>
                              <td style="padding-bottom:0px">
                                    <div runat="server" id="divDayTop1" style="font-size:1px; line-height:1px; background-color:#E8EEF7; height:1px; margin-left:2px; margin-right:2px;"></div>
                                    <div runat="server" id="divDayTop2" style="font-size:1px; line-height:1px; background-color:#E8EEF7; height:1px; margin-left:1px; margin-right:1px;"></div>
                                    <div runat="server" id="divDay" style="background-color:#E8EEF7; padding:4px 5px 3px 5px;">
                                          <asp:LinkButton ForeColor="Black" runat="server" ID="lbDay" Text="Day" Font-Underline="false" Font-Names="arial" Font-Size="13px"></asp:LinkButton>
                                    </div>                                                
                              </td>

I'd like to put that code that is duplicated into a single file and to call that resulting file in from the ascx files for easy management ( 1 edit for a fix rather than many). How can this be done?Start Free Trial
[+][-]05.29.2008 at 10:42AM PDT, ID: 21671464

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Programming for ASP.NET, .NET
Sign Up Now!
Solution Provided By: Joruus10
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.29.2008 at 10:47AM PDT, ID: 21671504

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628