.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Struggling to remove ellipses when columns in a DataGridView are automatically truncated

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :Windows Application
Hi all, I've got approx. 20 columns in a DataGridView so screen real estate is a little limited! All the columns have a fixed width, and in my old DataGrid when the content was too big for cell it would simply disappear off the edge so a cell containing 'flibberty' would be in the table cell |flibber| In contrast, with datagridview this becomes |flibb...| - I'd really really like to get rid of these ellipses and get the old DataGrid behaviour for this case - but it doesn't seem straightforward at all, can anyone help? Thanks, Henri

View Complete Post

More Related Resource Links

Custom Editing Behavior for DataGridView TextBox Columns

For various reasons I'm using a DataGridView instead of a ListView, and while configuring the DataGridView to look like a ListView wasn't much of a problem, there's one thing that got on my nerves, which is the behavior of textbox cells in edit mode: It is much too easy to leave the edit mode accidentally, simply by pressing the cursor keys at the wrong time. For example when the text caret is positioned behind the last character of the textbox cell content, and you press the right arrow key

DataGridView>Edit Columns> Column Read Only property is unwilling to change

Hello, I am facing the following mystery: When changing the read only property of a column to false and reopening the "edit columns" window, it mysteriously turns back to true. Even when closing the designer and changing it in the designer code, the resulting execution does not allow edit, as well as when re-opening the designer you see true again.             this.numberDataGridViewTextBoxColumn1.DataPropertyName = "Number";             this.numberDataGridViewTextBoxColumn1.HeaderText = "Number";             this.numberDataGridViewTextBoxColumn1.Name = "numberDataGridViewTextBoxColumn1";             this.numberDataGridViewTextBoxColumn1.ReadOnly = true;//False is required We thought it might be related to data binding. rebinding the grid did not help as well. The is no other place in the code where it changes. Please advice, Thanks

DataGridView freeze columns issue

When i try to freeze a column that is off screen (to the right) when the DataGridView's (DGV) first displayed column is the first column in the DGV, the DGV refreshes and displays the DGV from the first column in the DGV. Also, the horizontal scrollbar on the bottom of the page disappears.  This means that i cannot see the unfrozen columns and i cant get over to view the column that I froze. This seems to behave differently from freezing a column in Excel, which freezes the columns you are currently viewing at that moment (not sending you back to the first row) and then the scroll bar applies to the frozen columns like normal. Is there a workaround for this? I tried setting the first displayed index for the column and I get an exception. I'm using .NET 3.5 on an XP machine.

Why are Identity columns automatically marked as "NOT FOR REPLICATION" for non-updateable Transactio

Hi, Replication has been a blind stop for me. I've always tried to avoid it. Anyway, I've got (non-updatable) transactional replication of data from a production database (SQL2008 R2) into a reporting database (SQL2005 SP3). There are a handful of tables with Identity columns. Looking at the Article table properties of the tables in question, I can see that "Identity Management" is set to Manual (and greyed so not changeable). Also the Identity columns of the source tables are now marked as NOT FOR REPLICATION. When I look at the replica tables, I can see that they also have an Identity on the Primary Key column. Looking at the "sp_MSins" procedures, I can see that the procedure does include the column with the Identity on it in the INSERT statement. So, having look at all this, I'm more confused that before. But, the number 1 vitally important thing for me is that the values in the Identity columns are "honoured" when replicated to the reporting database (i.e. as if I used the -E flag of BCP). And my first question is, is this the case? I've examined the data from a couple of tables, and currently it appears to be true, but I'm worried that this is just luck. Secondly, as the insert procedure includes the Identity column in the Insert (the the Identity is present in the replica), I'm assuming / guessing that the Distribution agen

Columns collection of a DataGridView within a UserControl won't serialize to designer

First of all, I've found this issue on connect which describes my problems exactly, however, I've been able to find a workaround but I don't find it acceptable so I appeal to you for an idea of how to resolve this as cleanly as possible. What I've done is, I've applied a custom designer to my UserControl like so [Designer(typeof(CustomControlDesigner))]public partial class DataGridViewTag : UserControl, ISupportInitialize In the CustomControlDesigner I don't do much at this point, I set selection rules and add a few DesignerVerbs. The important thing is, I also EnableDesignMode for the DataGridView in my UserControl. Then, I expose DataGridView's DataSource and Columns collection like this: [Editor(typeof(CollectionEditor), typeof(UITypeEditor))][Category("Grid")][DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]public DataGridViewColumnCollection Columns{    get { return dgvList.Columns; } set { dgvList.Columns.Clear(); foreach (DataGridViewColumn col in value) dgvList.Columns.Add(col); }} [AttributeProvider(typeof(IListSource))] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] [Category("Grid")] public object DataSource{ get { return dgvList.DataSource;&nbs

Problem with resizing DataGridView columns

When i resize a column in a DataGridView control the Click event is fired. Is there a way to prevent that?

Can someone show me how to remove blank columns from a matrix report with parameters?


I have a drilldown matrix report with 5 parameters that I group on. The users have the option of selecting any of these parameters when they preview the report. They can also select No grouping as one of the parameter option.   When I run the report and select for example, 4 parameters and the No grouping option, I get blank columns.  When I select no grouping, no data is displayed.  As a result, I get blank columns.  Is there a way to hide the blank columns?  I would appreciate any suggestions.  See table example below:



Datagridview automatically update in c# by two Forms.


Hi to every body.

Note: I use Windows Application not Web Application.

 I am programming a database(Library database) program whit C# and SQL Server. I have a Tabel suppose that tblBook that show the information about my library books. I have a MainForm that have a Datagridview that linked to my tblBook and show my Books information that inserted in tblBook. in Main Form I have a Button that open another Form(Name is frmNewBook) for inserting information about a new Book in my tblBook. when I open frmNewBook by that Button and insert a new record at this time I want the Main Form automaticaly Update and the Datagridview show also new record information automaticaly by closing the frmNewBook Form or by Pushing the button(Save New Record.) that's my question.

 thank a lot Saeed.



MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.

Adding Multiple Columns and Rows in GridView without using a Database

This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.

add columns with textboxes in gridview using C#

'm working on a shopping cart in a website and I have my items(which have been added to the cart) in an arraylist. And using these values I've read the rest of the values from the db and and have populated on the gridview successfully.

AutoCompleteStringCollection for text box in DataGridView 2.0

I have been searching for a way to have autocomplete in a DataGridTextBox
object. There does not appear to be an obvious way to do this like you would
for a TextBox outside of a grid using the AutoCompleteCustomSource. Any
thoughts on how I can add this collection? :)

Sorting GridView Columns Manually

We all know that GridView columns can be sorted automatically when SQLDataSource is being used. But what if you are not using SqlDataSource to populate the GridView. Sorting the GridView manually is pretty straight forward task take a look at the code below

dynamically adding sql server columns based on number of files in fileuploader


I want to create a new table to sql database at runtime.  The column names would be "Name", "Date", "Event".  I would also like to have one more column name "Image" but the problem is that since the amount of images will vary, I want the application to count the amount of files in the Multiple fileuploader and then add a image column to the table for the respected amount of files. 

For example if i am uploading 3 files in the multiple fileuploader, the names should be "Name", "Date", "Event", "Image1", "image2", Image3"

I also would like that table name to be name dynamically from the textbox Name when the user enters the information.


I have the following code to make a new table, but I dont know how to name the fields at runtime like previously asked please help!!!


Dim objConn As New SqlConnection("Server=<servername>;uid=<userid>;pwd=<password>;database=master")


How to let user edit selected gridview columns, not entire row



I've got a gridview I would like to let the user edit a couple of columns.  Seems like everything I'm coming across so far makes the entire row editable.  

Hopefully the solution isn't too complicated.  Can someone point me in the right direction?


Remove #Region from whole web site


Hi All,

I need to deliver source code to client and my boss need to remove all the comments and #region sections from the whole web site source code.

So is there any functionality available in visual studio 2010 or may be in an other 3rd party tool available to do so, which can remove all the #region from all over the source code ?

Otherwise my developers has to do donkey work.... :(( and I don't wish it. 

Any help or tips/tricks would be appreciated.


Automatically redirect to HTTPS and check if SSL is active



I've set in the web.config:

    <!-- User Authentication -->
    <authentication mode="Forms">
      <forms loginUrl="~/Page/View/Content/Login.aspx" timeout="2880" requireSSL="true" />

This works fine. If there is no ssl connection, the login form doesn't continue. But I would like to check if ssl is active (in codebehind) and, if it's possible, to automatically the user to the https page if he's currently on http. (I could do this job by manually redirect with page.response("https://url.../login.aspx"); but this is not really generic. For example if the webapp is moved to another domain it doesn't work anymore... I'm looking for something like: FormsAuthentication.RedirectWithSSL(); or so... :D)


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend