I created a collection which is derived from ArrayList and implements
IBindingList and ITypedList.
Then I bound the DataSource of a data grid into the collection. It could
show up the data but the column heading is not in the right order, for eg. I
want "ID" column to be the first column but it showed as the second column.
Another problem is that anyway i can leave a blank row in the grid to add a
new row automatically if the user selected and tyepd something there ?
Thanks 5 2534
Hello,
To define which columns are visible and in what order, you will need to
create a custom System.Windows. Forms.DataGridT ableStyle with a set of
System.Windows. Forms.DataGridC olumnStyle-s.
The availability of the blank row at the bottom is controlled by the
AllowNew property of the IBindingList interface. As far as I remember,
returning "true" will result in this row being displayed.
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"K" <k@taka.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. I created a collection which is derived from ArrayList and implements IBindingList and ITypedList.
Then I bound the DataSource of a data grid into the collection. It could show up the data but the column heading is not in the right order, for eg.
I want "ID" column to be the first column but it showed as the second
column. Another problem is that anyway i can leave a blank row in the grid to add
a new row automatically if the user selected and tyepd something there ?
Thanks
Thanks so much for your quick resonse. I'll try DataGridColumnS tyle, but for
AllowNew matter, my collection class is returning true for
IBindingList.Al lowNew, and the blank row doesn't show up too.
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:ul******** ******@TK2MSFTN GP10.phx.gbl... Hello,
To define which columns are visible and in what order, you will need to create a custom System.Windows. Forms.DataGridT ableStyle with a set of System.Windows. Forms.DataGridC olumnStyle-s.
The availability of the blank row at the bottom is controlled by the AllowNew property of the IBindingList interface. As far as I remember, returning "true" will result in this row being displayed.
-- Dmitriy Lapshin [C# / .NET MVP] X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx Bring the power of unit testing to VS .NET IDE
"K" <k@taka.com> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. I created a collection which is derived from ArrayList and implements IBindingList and ITypedList.
Then I bound the DataSource of a data grid into the collection. It could show up the data but the column heading is not in the right order, for
eg. I want "ID" column to be the first column but it showed as the second column. Another problem is that anyway i can leave a blank row in the grid to
add a new row automatically if the user selected and tyepd something there ?
Thanks
You're welcome. You can also ensure this (quoted from the MSDN Library):
-------------------
Remarks
If IList.IsFixedSi ze or IList.IsReadOnl y is true, this property returns
false.
-------------------
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"K" <k@taka.com> wrote in message
news:Oq******** *****@TK2MSFTNG P12.phx.gbl... Thanks so much for your quick resonse. I'll try DataGridColumnS tyle, but
for AllowNew matter, my collection class is returning true for IBindingList.Al lowNew, and the blank row doesn't show up too.
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote in message news:ul******** ******@TK2MSFTN GP10.phx.gbl... Hello,
To define which columns are visible and in what order, you will need to create a custom System.Windows. Forms.DataGridT ableStyle with a set of System.Windows. Forms.DataGridC olumnStyle-s.
The availability of the blank row at the bottom is controlled by the AllowNew property of the IBindingList interface. As far as I remember, returning "true" will result in this row being displayed.
-- Dmitriy Lapshin [C# / .NET MVP] X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx Bring the power of unit testing to VS .NET IDE
"K" <k@taka.com> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. I created a collection which is derived from ArrayList and implements IBindingList and ITypedList.
Then I bound the DataSource of a data grid into the collection. It
could show up the data but the column heading is not in the right order, for eg. I want "ID" column to be the first column but it showed as the second column. Another problem is that anyway i can leave a blank row in the grid to
add a new row automatically if the user selected and tyepd something there ?
Thanks
My collection is derived from ArraryList, and I checked from MSDN, the
default for IList.IsReadOnl y and IList.IsFixedSi ze are both "false". In my
collection, the IBindingList.Al lowEdit, IBindingList.Al lowRemvoe and
IBindingList.Al lowNew are both true. But, DataGrid still didn't show up the
blank row for me to create a new row.
For the row column ordering, I tried to add TabeStyles in design time called
"headerStyl e" and in it, i added two DataGridColumnS tyles,
1. Header Text -> "Choices" , Mapping Name -> "ID"
2. Header Text -> "Wording", Mapping Name -> "Wording"
where ID and Wording are the actual properties in my contained objects.
Is it because I bind the datasource at run time to my collection, so the
headers didn't show up correctly ??
I got one more confused. What should i put in Mapping Name for my Table
Style "headerStyl e" ? ( I just leave it blank now )
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. You're welcome. You can also ensure this (quoted from the MSDN Library):
------------------- Remarks If IList.IsFixedSi ze or IList.IsReadOnl y is true, this property returns false. -------------------
-- Dmitriy Lapshin [C# / .NET MVP] X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx Bring the power of unit testing to VS .NET IDE
"K" <k@taka.com> wrote in message news:Oq******** *****@TK2MSFTNG P12.phx.gbl... Thanks so much for your quick resonse. I'll try DataGridColumnS tyle, but for AllowNew matter, my collection class is returning true for IBindingList.Al lowNew, and the blank row doesn't show up too.
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om>
wrote in message news:ul******** ******@TK2MSFTN GP10.phx.gbl... Hello,
To define which columns are visible and in what order, you will need
to create a custom System.Windows. Forms.DataGridT ableStyle with a set of System.Windows. Forms.DataGridC olumnStyle-s.
The availability of the blank row at the bottom is controlled by the AllowNew property of the IBindingList interface. As far as I remember, returning "true" will result in this row being displayed.
-- Dmitriy Lapshin [C# / .NET MVP] X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx Bring the power of unit testing to VS .NET IDE
"K" <k@taka.com> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. > I created a collection which is derived from ArrayList and
implements > IBindingList and ITypedList. > > Then I bound the DataSource of a data grid into the collection. It could > show up the data but the column heading is not in the right order,
for eg. I > want "ID" column to be the first column but it showed as the second column. > > Another problem is that anyway i can leave a blank row in the grid
to add a > new row automatically if the user selected and tyepd something there
? > > Thanks > >
> My collection is derived from ArraryList, and I checked from MSDN, the default for IList.IsReadOnl y and IList.IsFixedSi ze are both "false". In my collection, the IBindingList.Al lowEdit, IBindingList.Al lowRemvoe and IBindingList.Al lowNew are both true. But, DataGrid still didn't show up
the blank row for me to create a new row.
To be honest, I have no idea. It is of course virtually possible that
DataGrid has a hard-coded type check, and if the type is not DataTable or
DataView, the "new" row never appears, but how one can find it out?
Is it because I bind the datasource at run time to my collection, so the headers didn't show up correctly ??
You should create DataGridTableSt yle/DataGridColumnS tyle before binding the
data source. You should also use the SetDataBinding method.
I got one more confused. What should i put in Mapping Name for my Table Style "headerStyl e" ? ( I just leave it blank now )
I think its value should be equal to the grid's DataMember property value.
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"K" <k@taka.com> wrote in message
news:e5******** ******@TK2MSFTN GP10.phx.gbl... My collection is derived from ArraryList, and I checked from MSDN, the default for IList.IsReadOnl y and IList.IsFixedSi ze are both "false". In my collection, the IBindingList.Al lowEdit, IBindingList.Al lowRemvoe and IBindingList.Al lowNew are both true. But, DataGrid still didn't show up
the blank row for me to create a new row.
For the row column ordering, I tried to add TabeStyles in design time
called "headerStyl e" and in it, i added two DataGridColumnS tyles, 1. Header Text -> "Choices" , Mapping Name -> "ID" 2. Header Text -> "Wording", Mapping Name -> "Wording"
where ID and Wording are the actual properties in my contained objects.
Is it because I bind the datasource at run time to my collection, so the headers didn't show up correctly ??
I got one more confused. What should i put in Mapping Name for my Table Style "headerStyl e" ? ( I just leave it blank now ) "Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. You're welcome. You can also ensure this (quoted from the MSDN Library):
------------------- Remarks If IList.IsFixedSi ze or IList.IsReadOnl y is true, this property returns false. -------------------
-- Dmitriy Lapshin [C# / .NET MVP] X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx Bring the power of unit testing to VS .NET IDE
"K" <k@taka.com> wrote in message news:Oq******** *****@TK2MSFTNG P12.phx.gbl... Thanks so much for your quick resonse. I'll try DataGridColumnS tyle,
but for AllowNew matter, my collection class is returning true for IBindingList.Al lowNew, and the blank row doesn't show up too.
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote in message news:ul******** ******@TK2MSFTN GP10.phx.gbl... > Hello, > > To define which columns are visible and in what order, you will need to > create a custom System.Windows. Forms.DataGridT ableStyle with a set
of > System.Windows. Forms.DataGridC olumnStyle-s. > > The availability of the blank row at the bottom is controlled by the > AllowNew property of the IBindingList interface. As far as I
remember, > returning "true" will result in this row being displayed. > > -- > Dmitriy Lapshin [C# / .NET MVP] > X-Unity Test Studio > http://x-unity.miik.com.ua/teststudio.aspx > Bring the power of unit testing to VS .NET IDE > > "K" <k@taka.com> wrote in message > news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. > > I created a collection which is derived from ArrayList and implements > > IBindingList and ITypedList. > > > > Then I bound the DataSource of a data grid into the collection. It
could > > show up the data but the column heading is not in the right order, for eg. > I > > want "ID" column to be the first column but it showed as the
second > column. > > > > Another problem is that anyway i can leave a blank row in the grid to add > a > > new row automatically if the user selected and tyepd something
there ? > > > > Thanks > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jeff |
last post by:
IDE: VS 2003 :NET
OS: XP Pro
My app have a form with a tab-control on it. The tab-control have 2
tabpages. One of the tabpages displays a datagrid, and the other tabpage
displays details (order date, name, address etc) about the selected row in
the datagrid...
My problem is when I enter a new record in the details tabpage (saves data
to database), and go back to the datagrid. Only the data from the PM-table
|
by: Steve B. |
last post by:
I have a DataGrid on the left and TextBoxes (TB) on the right. The TB's
reflect the contents of the grid cells.
Sorting of columns (both thru VS and programmatically) work fine except,
when the form/grid first opens up and the grid is immediately sorted the TB
don't reflect the sorted data of the First row of the grid.
Note: Initially the black grid indicator arrow points to the first row. If
the user choses another row and then sorts...
|
by: Dave |
last post by:
The question I have is how to -=> Effectively <=- and -=> Efficently <=-
bind a DataGrid to a 1 deep organizational chart, where "R" would be a
row of data and 1..N would be the columns of the row. I need to have the
data displayed and updated/added, so I will need 2 way binding.
+---+
| R | (View this in NotePad)
+---+
|
|
by: Alpha |
last post by:
I have several textboxes that I need to chang the text when the selection row
is changed in a datagrid. I have the following code. This textbox displayes
the initial selection but when I click on different rows in the datagrid, the
textbox content doesn't change to reflect the change. How can I address
this?
Also, If the user change the text in the textbox then how do I refesh the
display in the datagrid to reflect the changes?
...
|
by: John Richardson |
last post by:
I've been bothered for some time about my DataGrid not populating my rows
very quickly. I have about 10K rows loading into the grid.
I create a datatable dt with 2 columns, an ID and a display. The ID is a
member of the keys array.
I then create a DataView dv over the table, and sort it by Display and ID
column (in case of duplicate Display).
I then set my DataGrid.DataSource = dv;
I then load the datatable with my rows, and this is...
| |
by: Jim Heavey |
last post by:
Trying to figure out the technique which should be used
to add rows to a datagrid. I am thinking that I would
want an "Add" button on the footer, but I am not quite
sure how to do that. Is that the best method? Do you
have a sample of how to do this?
|
by: Manny Chohan |
last post by:
hi guys, my code is returning an array and i need to create datagrid so that
i can have sorting and implement prev....next function on it to navigate. is
there any way this can be done in codebehind file. I am using c#.
Thanks
Manny
|
by: MichaelY |
last post by:
Ok...I'm gonna regret this...but here goes....(promise I'm not trolling)
After several years of using the provided ASP.NET data display controls
(DataGrids, Repeaters, and now the GridView amoung others), I cannot deny
that there is an ENORMOUS amount of functionality crammed into these controls
- kudos to MS!!!
However, more and more, I have been encountering situations where I need
EXPLICIT control over the rendered HTML in a grid...
|
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= |
last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor
information and the details loads the documents for that vendor in a
datagrid. Everything is working fine until I click in the child datagrid and
then go to the combobox and choose another vendor. When the new vendor is
loaded nothing shows in the datagrid but the itemsource shows the info is
there. Know if I click on the child cell and then click back on the...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |