?
Solved

problems with Datalist column alignment

Posted on 2006-07-17
4
Medium Priority
?
411 Views
Last Modified: 2006-11-18
hi,
i have the following DataList: (i added the <table> etc tags inside the datagrid after seeing some other posts)

<asp:datalist id="DataList1" runat="server" BackColor="#999999" BorderColor="#33ff99">                                    
      <ItemTemplate>
            <asp:Table>
                  <asp:TableRow>
                        <asp:TableCell Width="10%">
                              <asp:Label ID="ID" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ID")%>' Visible="False">
                              </asp:Label>
                        </asp:TableCell>
                        <asp:TableCell Width="40%">
                              <asp:Label ID="desc" Runat="server" text='<%# DataBinder.Eval(Container.DataItem, "free_MainSection_Section_Category")%>'>
                              </asp:Label>
                        </asp:TableCell>
                        <asp:TableCell Width="50%">
                              <asp:TextBox Runat="server" ID="freeText"></asp:TextBox>
                        </asp:TableCell>
                  </asp:TableRow>
            </asp:Table>
      </ItemTemplate>
</asp:datalist>                  

and I cannot get the columns to align i.e. [textfield] under textfield:
TALC:Appearance:finish   [textfield]
TALC:Lighting:painted as moulded/chrome   [textfield]

I managed to get them aligned if i place the <asp:table> outside the datagrid and the <tr> <td> inside the Itemtemplate but it then screws out the main table alignment. Could you please give me some help. 10x.
                  

                              
      
0
Comment
Question by:stephen_rota
[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
  • 2
  • 2
4 Comments
 
LVL 7

Expert Comment

by:skvikram
ID: 17122665
Place the entire datalist code as it is inside the outer table <tr><td></td></tr> tags

i.e.
<table>
<tr><td>
'''DATALIST CODE HERE'''
</td></tr>
</table>
0
 

Author Comment

by:stephen_rota
ID: 17128464
i tried that and now i have:
<tr>
      <td>&nbsp;</td>
      <td>
            <table>
                  <tr>
                        <td>                                                      
                              <asp:datalist id="DataList1" runat="server" BackColor="#999999" BorderColor="#33ff99">                                                                        
                                    <ItemTemplate>
                                          <asp:Table>
                                                <asp:TableRow>
                                                      <asp:TableCell Width="10%">
                                                            <asp:Label ID="ID" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ID")%>' Visible="False">
                                                      </asp:Label>
                                                      </asp:TableCell>
                                                      <asp:TableCell Width="40%">
                                                            <asp:Label ID="desc" Runat="server" text='<%# DataBinder.Eval(Container.DataItem, "free_MainSection_Section_Category")%>'>
                                                            </asp:Label>
                                                      </asp:TableCell>
                                                      <asp:TableCell Width="50%">
                                                            <asp:TextBox Runat="server" ID="freeText"></asp:TextBox>
                                                      </asp:TableCell>
                                                </asp:TableRow>
                                          </asp:Table>
                                    </ItemTemplate>
                              </asp:datalist>
                        </td>
                  </tr>
            </table>                                          
      </td>
</tr>

but to no avail.
0
 
LVL 7

Accepted Solution

by:
skvikram earned 750 total points
ID: 17128826
I managed to get them aligned if i place the <asp:table> outside the datagrid and the <tr> <td> inside the Itemtemplate

you get the data grid alignment this way RIGHT!

Now place <asp:table>....</asp:table> ( containing ur itemtemplates inside <tr><td> tags ) inside another outer table <tr><td></td></tr> tags and align this table cell accordingly
0
 

Author Comment

by:stephen_rota
ID: 17152172
skvikram: that is you mean like this:
<asp:Table>                                                            
      <asp:datalist id="DataList1" runat="server" BackColor="#999999" BorderColor="#33ff99">
            <ItemTemplate>                                                                                    
                  <tr>
                        <td>
                              <asp:Label ID="ID" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ID")%>' Visible="False">
                              </asp:Label>
                        </td>
                        <td>
                              <asp:Label ID="desc" Runat="server" text='<%# DataBinder.Eval(Container.DataItem, "free_MainSection_Section_Category")%>'>
                              </asp:Label>
                        </td>
                        <td>
                              <asp:TextBox Runat="server" ID="freeText"></asp:TextBox>
                        </td>
                  </tr>                                                                              
            </ItemTemplate>
      </asp:datalist>                                                                  
</asp:table>

i.e.               <table> //mian pg table
                        <asp:table>
                                <datalist>
                                    <tr>
                                       <td>                                                            
it worked fine. thanks a lot. I will just wait a bit to see if you reply and will close the query. Again thanks a lot, it would have taken me ages to figure out..lets' face it i would not have figured it out :) Thnaks again!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

762 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