Solved

problems with Datalist column alignment

Posted on 2006-07-17
4
404 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 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

728 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