Gridview TextBox display problem

Posted on 2012-08-27
Last Modified: 2012-08-31

I have a gridview with a TextBox imbedded in a Template Field.  When users input a link such as in the textBox then click on update, I have a function that will search for any URLs and convert the text to link(s).

The problem I have is:
If the link is a long link, the column in the Gridview EXPANDS way too much were it makes the Gridview way too wide.

Is there a way to stop the Gridview from expanding???

Thank you!!!
Question by:Rad1
    LVL 16

    Assisted Solution

    by:Vikram Singh Saini
    Set width in item style in columns as:

    <asp:BoundField DataField="" HeaderText="" ItemStyle-Width="25px" />

    Open in new window

    LVL 26

    Accepted Solution

    TextBox shouldn't grow, possibly the label in the itemtemplate.
    In your head section add a style:
      <style type="text/css">
         .LongUrlLabel {overflow:hidden; }

    Open in new window

    Then in your Label declaration, set the CssClass
    <asp:Label ID="TheUrlLabel" runat="server" Text='<%# Bind("TheUrl") %>' CssClass="LongUrlLabel " />  

    Open in new window

    Alan ";0)

    Author Closing Comment

    Excellent. Did the job right!!!

    Thank you!

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now