Solved

problems with Datalist column alignment

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

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…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 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