|
-
Dec 27th, 2004, 12:06 AM
#1
Thread Starter
Frenzied Member
Data Grid [RESOLVED]
Hi all,
I need an editable datagrid with one row only. Means, if user enters one record in the datagrid, I dont want to add a new row in the data grid.
Thanks.
Last edited by usamaalam; Dec 29th, 2004 at 04:59 AM.
Reason: Resolved
-
Dec 27th, 2004, 02:37 PM
#2
Sleep mode
There is property for allowing cells editing , I forgot what's called . If you're not so happy with the exist DataGrid , try the ones in CodeProject.com with more functions .
-
Dec 28th, 2004, 02:37 PM
#3
Thread Starter
Frenzied Member
Re: Data Grid [RESOLVED]
Would you please provide me link of that datagrid.
Last edited by usamaalam; Dec 29th, 2004 at 04:56 AM.
Reason: Resolved
-
Dec 28th, 2004, 02:56 PM
#4
Re: Data Grid
 Originally Posted by usamaalam
Hi all,
I need an editable datagrid with one row only. Means, if user enters one record in the datagrid, I dont want to add a new row in the data grid.
Thanks.
Do you mean an Unbounded DataGrid or do you mean you want to allow user to add new rows to existing data in the datagrid?
If its the first case then all you need to do is create a DataTable an empty one and then bind to datasource to that DataTable.
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Dec 28th, 2004, 03:02 PM
#5
Thread Starter
Frenzied Member
Re: Data Grid
I need an unbound editable datagrid with only one row. Means when user enters record in the first row, I dont want to add second row and restrict datagrid to be only for one record.
-
Dec 28th, 2004, 04:00 PM
#6
Re: Data Grid
 Originally Posted by usamaalam
I need an unbound editable datagrid with only one row. Means when user enters record in the first row, I dont want to add second row and restrict datagrid to be only for one record.
Here is an example, i have added an empty row and then disabled AllowNew property. You could also check the RowChanged event and disable it there if you need to allow n number of rows in future instead of one.
Here is the code :
Code:
private void Form1_Load(object sender, System.EventArgs e)
{
DataTable dt = new DataTable();
dt.Columns.Add("Children Name", Type.GetType("System.String"));
dt.Columns.Add("Age", Type.GetType("System.Int32"));
dt.Columns.Add("Sex", Type.GetType("System.String"));
object [] d = {"",0,""};
dt.Rows.Add(d);
this.dataGrid1.DataSource = dt.DefaultView;
((DataView)this.dataGrid1.DataSource).AllowNew=false;
//dt.RowChanged+=new DataRowChangeEventHandler(dt_RowChanged);
}
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|