Wednesday, March 28, 2012

TableCell Width

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:datagridSalut Andre,

La datagrid fait dj 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" <lostman@.cablevision.qc.ca> wrote in message
news:uhcEiCq6DHA.3860@.tk2msftngp13.phx.gbl...
> 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>
Une reponse en Francais, je n'en attendait pas autant ;o)))

L'ide 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 donnes sur des lignes diffrente par example..

Merci.

"Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> wrote in message
news:uccNiys6DHA.2412@.TK2MSFTNGP09.phx.gbl...
> Salut Andre,
> La datagrid fait dj 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" <lostman@.cablevision.qc.ca> wrote in message
> news:uhcEiCq6DHA.3860@.tk2msftngp13.phx.gbl...
> > 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
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 franais. Jai passe sept
ans Qubec [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" <lostman@.cablevision.qc.ca> wrote in message
news:ereXSky6DHA.4012@.tk2msftngp13.phx.gbl...
> Une reponse en Francais, je n'en attendait pas autant ;o)))
> L'ide 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 donnes sur des lignes diffrente par example..
> Merci.
>
> "Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> wrote in message
> news:uccNiys6DHA.2412@.TK2MSFTNGP09.phx.gbl...
>> Salut Andre,
>>
>> La datagrid fait dj 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" <lostman@.cablevision.qc.ca> wrote in message
>> news:uhcEiCq6DHA.3860@.tk2msftngp13.phx.gbl...
>> > 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>
>>>>

0 comments:

Post a Comment