Solved

problems with Datalist column alignment

Posted on 2006-07-17
4
349 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
  • 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 250 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now