[Last Call] Learn how to a build a cloud-first strategyRegister Now


Gridview TextBox display problem

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

I have a gridview with a TextBox imbedded in a Template Field.  When users input a link such as http://www.amysite.com 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
Vikram Singh Saini earned 1000 total points
ID: 38339277
Set width in item style in columns as:

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

Open in new window

LVL 26

Accepted Solution

Alan Warren earned 1000 total points
ID: 38339569
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

ID: 38354963
Excellent. Did the job right!!!

Thank you!

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
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. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Loops Section Overview

830 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