views:

37

answers:

1

itemtemplate width not working. i make width="50" bit it is never 50but is always more then 50. is it possible to make with on td that gridview create?

<asp:GridView ID="gwTemporaryCities" runat="server" AutoGenerateColumns="False">
    <Columns>
        <asp:TemplateField HeaderText="Ime">
            <ItemTemplate>
                <asp:Label ID="lblName" runat="server" 
                    Text='<%# StripHTML(Eval("Name")) != "" ? StripHTML(Eval("Name")) : "/" %>'></asp:Label>                    
            </ItemTemplate>
        </asp:TemplateField>  
        <asp:TemplateField>
            <ItemTemplate>
                <asp:LinkButton ID="lnkBtnDelete" runat="server" Text="Odstrani" CommandName="DeleteTemporaryCity" Width="50"
                    CommandArgument='<%# Eval("idTemporaryCities") %>' 
                    OnCommand="lnkBtnDelete_Command" CausesValidation="False"></asp:LinkButton>
                <asp:ConfirmButtonExtender ID="cbeDelete" ConfirmText="Ali ste prepričani, da želite odstraniti mesto?"
                    runat="server" TargetControlID="lnkBtnDelete">
                    </asp:ConfirmButtonExtender>
            </ItemTemplate>
        </asp:TemplateField>                         
    </Columns>
    </asp:GridView
A: 

You're not setting the width of the ItemTemplate, but of one of the controls contained within the item template

On top of that, the control you're setting the width on is a LinkButton, which is effectively the same as saying:

<a href="[...]" width="50">Odstrani</a>

But depending on your font, the text "Odstrani" is probably wider than 50 pixels, so this width setting is likely to be ignored as there's no way to break that one word under 50 pixels.

Zhaph - Ben Duguid
hmm so i must use datalist instead of gridview like CapSoft said if i want to make td 50px width?
senzacionale