TableCell Width

A

Andre

Hi,

Did someone know why this code does'nt work (The TableCell Width).
The cell don't have 600 and 150 like writed in width="600" and
width="150".


<asp:datagrid id="DataGrid1" runat="server"
AutoGenerateColumns="false" ShowHeader="false" ShowFooter="false">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Table>
<asp:TableRow>
<asp:TableCell Width="600">
<%# container.dataitem("Service")%>
</asp:TableCell>
<asp:TableCell Width="150">
Price :
<%# databinder.eval(container.dataitem,"price","{0:c}")%>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
 
K

Ken Cox [Microsoft MVP]

Salut Andre,

La datagrid fait déjà une table, et ton code tente d'en ajouter une. Tu
ferais mieux de te servir d'une Label.

The datagrid already creates a table, and your code is attempting to add
another. You'd do better using a Label:

<asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False"
ShowHeader="False">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Label id="Label2" runat="server" Width="600px"></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Label id="Label3" runat="server" Width="150px"></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>

Ken
Microsoft MVP [ASP.NET]
Toronto
 
A

Andre

Une reponse en Francais, je n'en attendait pas autant ;o)))

L'idée des Label m'a sauver la vie.. de facon contourner :)
J'ai donc incorporer des Label dans ma table, donc mes Width fonctionne
parfaitement !!

Car avec seulement des Label la disposition est moin evidente, pour inscrire
les données sur des lignes différente par example..

Merci.


Ken Cox said:
Salut Andre,

La datagrid fait déjà une table, et ton code tente d'en ajouter une. Tu
ferais mieux de te servir d'une Label.

The datagrid already creates a table, and your code is attempting to add
another. You'd do better using a Label:

<asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False"
ShowHeader="False">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Label id="Label2" runat="server" Width="600px"></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Label id="Label3" runat="server" Width="150px"></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>

Ken
Microsoft MVP [ASP.NET]
Toronto

Andre said:
Hi,

Did someone know why this code does'nt work (The TableCell Width).
The cell don't have 600 and 150 like writed in width="600" and
width="150".


<asp:datagrid id="DataGrid1" runat="server"
AutoGenerateColumns="false" ShowHeader="false" ShowFooter="false">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Table>
<asp:TableRow>
<asp:TableCell Width="600">
<%# container.dataitem("Service")%>
</asp:TableCell>
<asp:TableCell Width="150">
Price :
<%# databinder.eval(container.dataitem,"price","{0:c}")%>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
 
K

Ken Cox [Microsoft MVP]

Salut André,

Je suis content que ça fonctionne pour toi.

En passant, il y a un newsgroup francophone
(microsoft.public.fr.dotnet.aspnet) au cas ou tu en aurais besoin.

(Il est rare à Toronto que je puisse sortir mon français. J’ai passe sept
ans à Québec [Ste-Foy].)

Ken
Toronto



I'm glad that works for you.

BTW, there's a francophone newsgroup (microsoft.public.fr.dotnet.aspnet) in
case you ever need it.

(I don't often get a chance in Toronto to use my French. I lived in Ste-Foy
for seven years.)



Andre said:
Une reponse en Francais, je n'en attendait pas autant ;o)))

L'idée des Label m'a sauver la vie.. de facon contourner :)
J'ai donc incorporer des Label dans ma table, donc mes Width fonctionne
parfaitement !!

Car avec seulement des Label la disposition est moin evidente, pour
inscrire
les données sur des lignes différente par example..

Merci.


Ken Cox said:
Salut Andre,

La datagrid fait déjà une table, et ton code tente d'en ajouter une. Tu
ferais mieux de te servir d'une Label.

The datagrid already creates a table, and your code is attempting to add
another. You'd do better using a Label:

<asp:datagrid id="DataGrid1" runat="server"
AutoGenerateColumns="False"
ShowHeader="False">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Label id="Label2" runat="server" Width="600px"></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Label id="Label3" runat="server" Width="150px"></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>

Ken
Microsoft MVP [ASP.NET]
Toronto

Andre said:
Hi,

Did someone know why this code does'nt work (The TableCell Width).
The cell don't have 600 and 150 like writed in width="600" and
width="150".


<asp:datagrid id="DataGrid1" runat="server"
AutoGenerateColumns="false" ShowHeader="false" ShowFooter="false">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Table>
<asp:TableRow>
<asp:TableCell Width="600">
<%# container.dataitem("Service")%>
</asp:TableCell>
<asp:TableCell Width="150">
Price :
<%# databinder.eval(container.dataitem,"price","{0:c}")%>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,216
Latest member
topweb3twitterchannels

Latest Threads

Top