How to set a constant width for a gridview column.

2011-04-24

In one of my pages I wanted to show Error Log stored in the database to a gridview.
In that there is Error Descritpion column which has got very large text. I only wanted to display the beginning of the Error Description. On selecting the particular error description a pop up page comes & display the description in detail. So how can we set the Error Description column a constant width & text to be displayed only at the beginning.

1. Create a template column place a link button inside a table
2. Set the width of the LinkButton
3. Set Style property overflow:hidden
4. Set the ItemStyle for this template & define width & set Wrap=false

that is like this


<asp:TemplateField>

<HeaderTemplate>Product Description</HeaderTemplate>



<ItemTemplate>



<table>

<tr>

<td>

<asp:LinkButton id="lnkProductDescription" runat="server" Text='<%# Eval("ProductDescription") %>' Width="150px" style="overflow:hidden;"></asp:LinkButton>

</td>

</tr>

</table>



</ItemTemplate>

<%--For making the Wrap of the column to be disabled --%>

<ItemStyle Width="150px" Wrap="false" />



</asp:TemplateField>













4 comments:

Anonymous said...

What's up to every body, it'ѕ my fiгst pay a quick visit
оf thіs ωebpage; this websіte carrіes amazing аnԁ асtuallу fine ѕtuff ԁeѕigned
for readeгs.

Here іs my website ... Amerіcas Carԁroom Poker
Bonus ()

Anonymous said...

Whаt's Happening i am new to this, I stumbled upon this I have discovered It positively useful and it has helped me out loads. I am hoping to contribute & aid other customers like its aided me. Good job.

My blog BlackChipPoker Promotions ()

Anonymous said...

Fantastic bеаt ! Ι wish tο appгеntice at the samе
tіme аѕ you amenԁ your
ωebsite, hоw саn i ѕubscribе for a blοg websіte?
The account аided me a acceρtable
dеal. I ωerе a little bit familiar οf this your brоadcaѕt ргοvided vіvid clеаr сoncеpt

mу blοg post :: MintedPoker Offer - -

Anonymous said...

Great website! Here's my poker link, which has nothing to do with this website.