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

Top 5 Contributors of the Month
Post New Web Links

change the datagridview layout

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :Windows Application

Dear all,

In my project, I am using some third-party datagrid and also datagridview. How to convert below code to be using in datagridview??

(1) change the width of the columns

(2) align the cells

(3) Columns format

foreach(UltraGridColumn temp in dtg.DisplayLayout.Bands[i].Columns)

                    if (temp.DataType == typeof(DateTime))
                        temp.Format = "yyyy-MM-dd";
                        temp.Width = 90;
                    else if (temp.DataType == typeof(string))

View Complete Post

More Related Resource Links

Change grid view from table to other HTML layout



You'll have to excuse my ignorance, I'm coming at this from a front-end perspective, and don't really know how to deal with data views in ASP.NET.

Basically, I'm trying to change the layout of some repeated data from a straight table, to something more design-heavy.  It's the same data, just re-organised slightly.  The current ASP.NET code looks like this:

                    <asp:GridView ID="GVMoments" runat="server" AllowPaging="True" AllowSorting="True"
                        AutoGenerateColumns="False" PageSize="20" RowHeaderColumn="FirstName"
                        SkinID="GroupSkin" DataKeyNames="moment_id" 
                        <PagerSettings Mode="NumericFirstLast" PageButtonCount="20" Position="TopAndBottom" />
                        <RowStyle />
                                <asp:BoundField DataField="moment_id" HeaderText="moment_id" ReadOnly="True" SortExpression="moment_id"
                                    Visible="False" In

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

How to Change the Color of Link Label which is a Datagridview Column on a Row Selection?

Hi All I have a Link label as one of the column of Datagridview & also my SelectionBackColor set to Blue. Is there any way that i can change the link label color on a particular row selection as now my selectionbackcolor & link label color is matching...I am unable to the contents of that link label column. Should i do this on design level or in code level? Pls Help

How can I change XSL in WSS 3.0 for Search Layout - I need to add a button\link "Edit Item"?

Hi, WSS 3.0 on SQL Server 2008 for Workgroups Does anyone know where the xsl file is to change the Search Layout (NOT MOSS) and/or do you know of any links that are useful? Thanks. John.

List.aspx:datagridview Change the links to parent table from Details to list


The List Page display  child Entity using the  gridview each row will have  link to the  parent 


How can I change the link so it shows the parent but in list view(using list.aspx) not detailes (detailes.aspx)view






I checked the



List.aspx:datagridview Change the links to parent table from Details to list


The List Page displays a child Entity using the  gridview, each row  has a to link to the  parent in detailes view how can I change to list view .

use list.aspx?parent=32 not detailes.aspx ?parentId=32

keyboard layout change dynamically


Hi everybody,

I am having two text boxes, txtEnglish and txtHindi on an asp.net web page. when txtEnglish is

getting the focus, the keyboard layout should be changed. There is an API function 'LoadKeyboardLayout' for this purpose. but this API is not working well!!!!. and also

i have to call this 'LoadKeyboardLayout' from the javascript.

Or any other method is there in Javascript to change the keyboard layout???

If any one can help me,

please make it fast, bcos it's urgent and i am hanging on this for three days.

how to change the existing page Layout (Share Point 2007)


Hi All,


i have page with some content in a two webpart Zone. I want to change it another layout (3 Webpart zone).

Is there any direct way that i can change the Layout and the content remain intact. (Share Point 2007)

Thanks and Regards Er.Pradipta Nayak

DataTable Bound to DatagridView DataRowState.Modified not getting change on first row


Updating the first record listed in my DataGridView that is bound to my DataTable . When I run Save process I run through this line of code to get all records that have been modified:


If I have changed the first record in my DataGridView my modifiedRows DataTable is Null. If I change any of the following records they are in my modifiedRows DataTable .
I have tried changing other records in my DataGridView first and then changing the first record then running the Save process and still....other records are there and the first record is not.....

Also....I checked the unitDataDT and it has the change. I sorted the datagridview to try and update a different record and it still did not add the change to the modifiedRows Datatable....so it seems to not work for the first record listed in the DataGridView.

Any ideas?

DataGridView - Event triggered when row change while SelectionMode is DataGridViewSelectionMode.Full



I have a data grid view with SelectionMode == DataGridViewSelectionMode.FullRowSelect.  I was wondering if there is an event triggered when the row selected is changed?  I have tried SelectionChanged, CurrentCellChanged, RowEnter, CellClick but none of these events get triggered when the row selected is changed while SelectionMode == DataGridViewSelectionMode.FullRowSelect.  

Change Content Type then Change Page Layout of an Existing Page


One of our content managers has added about 10 new web pages but has used the wrong page layout.  The site that these pages are in has 3 options of page layout that can be used.  They are:

(WDC Article) One Column-Std
(WDC Article) Two Column-Std
(WDC News) Public Notices and News

As you can see, there are 2 content types within the site.  The content manager has used the "(WDC Article) One Column-Std" page layout instead of the "(WDC News) Public Notices and News" page layout.

I have tried to edit the page layout via the 'Page Settings and Schedule' area but I only get the "(WDC Article) One Column-Std" and "(WDC Article) Two Column-Std" page layout options - there is no option to select "(WDC News) Public Notices and News".

I have tried to change the page content type from WDC Article to WDC News so I will have the "(WDC News) Public Notices and News" page layout option but it keeps reverting back to WDC Article or I get an error.

Any ideas of how I can change all pages that use "(WDC Article) One Column-Std" page layout to "(WDC News) Public Notices and News" page layout (the correct layout)?

Thanks :)

how to change the layout of the blog or create custom blog in visual studio for sharepoint 2007


i want to change the layout of the blog display in the following  layout of display

<TABLE border=0 rules=none cellspacing=0 cellpadding=2>

    <TR vAlign=top>

      <TD height=95 rowspan=2 width=95 align=middle><A href="<SOURCE URL>" target=”_blank”><IMG border=0 src="<PICTURE URL>"></A></TD>

      <TD><STRONG>Source: <A href="<SOURCE URL>" target=”_blank”><SOURCE NAME></A> | </strong><A href="<SOURCE URL>" target=”_blank”>Rea

c# 2008 Datagridview numericupdown cell not working properly. Odd layout behaviour


Hi all,

Francesco from Italy here, working with MS products since I was professionally born... that's like a century ago or something like that!

This is my 1st post in MSDN forums, so I hope it would be well accepted :)


I'm working with datagrdiview and custom numericupdown cell. I started from here


So, I downloaded the code attached there, opened the solution with Visual studio 2008, processed the automatic upgrade from 2005 to 2008 and started to play a bit with it.

It works pretty well, since I tried to use it the way you can see in this project


What do I do?

- I have a MDI form containing a simple child form 

- the child form has a splitcontainer, containing a treeview in the left panel

- the treeeview has 4 nodes and, clicking node 1 or 2, loads an usercontrol, containing datagridview with the custom numericoupdown object.

It looks great!

But... if you play a bit with the fields, you'll get an odd behaviour.

The first object I interact with works pretty well. The second object (hosted by the other usercontrol) has a funny behaviour... It simply doesn't work properly.

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

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? :)

How to Localize Windows Forms and Change the Language at Runtime

Localization is the process of customizing your application to a particular language, culture or locale. Visual Studio provides support for localizing Windows Forms with much ease. In this article, we will see how to localize windows forms and give the user the ability to change to his preferred language at runtime.
When you run a localized application, the appearance is determined by two culture values. The UICulture property is used to specify which resource files will be loaded for the form. The Culture property, on the other hand, determines how strings such as dates, numerals, and currency amounts are formatted.
Let us see the steps required to create a localized form. You can then expand this example and adopt the same approach for the rest of the forms in your project

Selected to change the background color of the page



As this site, http://www.borfin.com.tr/genel/Default.aspx, How can I change the background color selected pages.

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