Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

problems with Datalist column alignment

Posted on 2006-07-17
4
Medium Priority
?
422 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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

618 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