 |
|
 |
Hi
How can I manipulate the calender cells (say in demo project) so that when i click on them the calender browser comes up and i can select a new date. i have the calendercolumn.cs file from msdn http://msdn.microsoft.com/en-us/library/7tas5c80.aspx[^]
but i am having trouble implementing it.
thanks
|
|
|
|
 |
|
 |
To be able to search in column's where the columnname contains a space, replace the original GenerateFilterExpression function with:
Protected Function GenerateFilterExpression() As String
Dim dt As DataTable = Me.CurrentView.Table
Dim expr As String = ""
'MessageBox.Show(dt.Columns[this.SelectedHeaderField].DataType.ToString());
Select Case dt.Columns(Me.SelectedHeaderField).DataType.ToString()
Case "System.String"
expr = String.Format("[{0}] Like {1}", Me.SelectedHeaderField, "'{0}%'")
Case "System.Byte", "System.Decimal", "System.Double", "System.Int16", "System.Int32", "System.Int64"
expr = String.Format("[{0}] >= {1}", Me.SelectedHeaderField, "{0}")
Case "System.DateTime"
expr = String.Format("[{0}] >= {1}", Me.SelectedHeaderField, "#{0}#")
End Select
Return (expr)
End Function
|
|
|
|
 |
|
 |
How do I Disable some columns in the datagrid so that the user must not click the text
sam
|
|
|
|
 |
|
 |
Set the Column's MappingType to hidden and skip it when you generate your tablestyle...
|
|
|
|
 |
|
 |
make readonly that column then user cannot change any value.
datagridview1.Columns[columnIndex Here].ReadOnly = true;
altaf
|
|
|
|
 |
|
 |
Please Tell me that how i will retrive data from paricular cell after that CELL-CLICK event.
please send this on my emailid sachin_patil.1982@yahoo.com
sachin s. patil
-- modified at 6:45 Wednesday 14th June, 2006
|
|
|
|
 |
|
 |
Hi ,
Did you get answer to yours question?
I'm looking for getting data from a combo box into a table in a form,
Thanks,
Daniela
danish_bear
|
|
|
|
 |
|
 |
Something like this should work...
Dim bm As BindingManagerBase = Me.Datagrid1.BindingContext(Me.Datagrid1.DataSource, Me.Datagrid1.DataMember)
If bm.Count = 0 Then
Exit Sub
End If
Dim dr As DataRow = CType(bm.Current, DataRowView).Row
If IsNothing(dr) = False Then
'Copy the workorder ID value from the selected DataGrid row to the clipboard.
System.Windows.Forms.Clipboard.SetDataObject(dr("WorkOrderID").ToString)
End If
|
|
|
|
 |
|
 |
this is so simple to retreive data from datagridview cell.
string Value = datagridview1.Rows[e.RowIndex].Cells[cell Index].Value.ToString();
altaf
|
|
|
|
 |
|
 |
I decided to change this post 'cause I found that what I was doing before was innecessary. In fact there is an easiest way to achieve it, so, I update it to reflect what I finally did.
-- modified at 16:48 Monday 8th May, 2006
Hi,
First at all, thanks for this nice control. I only have a but:
This functionality assumes that the user is only going to use DataSets, DataTables, and DataViews as DataSources.
In fact, you can also use DataRelations and other types. In my case, I'm using a DataGrid set as follows:
grid.DataSource = dbDataSet;
grid.SetDataBinding(dbDataSet,"ActorInstance.ActorInstOutputInst");
The main table is named ActorInstance and its related records are in another table called "OutputInstance". I created a DataRelation called "ActorInstOutputInst", which relates these two tables. Using a normal DataGrid shows me the parent record and its related rows
in the DataGrid. As soon as I change the DataGrid for your class, I get a NullReferenceException in the following line:
dv = ((DataSet)this.DataSource).Tables[this.DataMember].DefaultView;
The problem here is that this.DataMember is equal to "ActorInstance.ActorInstOutputInst", which is a DataRelation and not a DataTable, so, it isn't in the "Tables" array from DataSource.
For the interested, I changed the code in order to make it work with DataRelations as well. I don't know how efficient it is, so, if you have a better way of doing this, please let me now (Perhaps there is a better way of doing this with .net 2.0, but at the moment I'm forced
to use .net 1.1).
I replaced the CurrentView Property definition of the CGridEx class by:
protected DataView CurrentView
{
get
{
DataView cv = null;
if ((this.DataSource is DataSet) && (this.DataMember.Length > 0))
{
// Turn off AutoSearch if DataSource is DataSet
// Why did you do this? I also tested AutoSearch = true with
// my setup and it worked.
// this.AutoSearch = false;
int dotPos;
if ((dotPos = this.DataMember.LastIndexOf(".")) >= 0)
{
//There is at least a dot in the DataMember string, which means
//that the DataGrid is bound to a DataRelation
//I found this hack to get the DataView of a DataRelation. It seems to work
CurrencyManager cm = (CurrencyManager)BindingContext[this.DataSource,this.DataMember];
cv = ((DataView)cm.List);
}
else
cv = ((DataSet)this.DataSource).Tables[this.DataMember].DefaultView;
}
else if (this.DataSource is DataTable)
cv = ((DataTable)this.DataSource).DefaultView;
else if (this.DataSource is DataView)
cv = (DataView)this.DataSource;
return cv;
}
}
Then It worked.
I have a final question:
1) Why do you set AutoSearch to false when the DataGrid is bound to a DataSet? Did you find a bug? I tried with AutoSerch = true and it seemed to work.
Best Regards
Josef
|
|
|
|
 |
|
 |
Control is very good. Only problem I have: Autosearch shows only matching rows and I need to show all rows with first matching row selected and highlighted. Can somebody advice how to achieve that.
Thank you.
|
|
|
|
 |
|
 |
I am a beginner ,Actaully i have a datagrid in winforms which adds updates new rows and changes made to the existing rows . Now i want to give the user a facility to query the datagrid.If the user clicks on query button , the datagrid should be cleared and allow the user to enter data in any cell and retrieve data as per the cell info entered , if data does not exist then return an error message.I am using SQL Server default database PUBS and tablename: authors
Pls note i want to search the database not just the datagrid.
The search query sould return all the matching results from the database
could anybody help me pls
Thanks in advance
my email is sayyedabdulrahim@hotmail.com, u could reply me there too
Sayyed
I am a beginner in c# and wish to learn more thru the forum
|
|
|
|
 |
|
 |
The datagrid is set to "ReadOnly". When I remove this restriction, I can change or modify a row, but when I reset the DataSource, I get an "null object" error.
Any workaround?
|
|
|
|
 |
|
 |
Hello,
there is a little problem between style and autosize.
if you use the default style (-1) and you load a first dataset, all ok.
then if you set datasource to null pb. I suggest to use :
if (this.DataSource != null)
{
if ((!this.DesignMode) && (!this.TableStyles.Contains(this.DefaultGridStyle)))
this.TableStyles.Add(this.DefaultGridStyle);
if ((GetCurrentStyle() == null) && (!this.DesignMode))
SetDefaultGridStyle();
if ((this.AutoSize) && (this.CurrentView != null))
AutoSizeGrid();
}
base.OnDataSourceChanged(e);
then if you load null for datasource : OK.
now if you set datasource to something with differents column, pb in the AutoSize...
Any patch ?!
ikos
|
|
|
|
 |
|
 |
I have changed the demo project to read from XML instead of Northwind database.
|
|
|
|
 |
|
 |
This could, possibly, be just what I'm looking for. If I can't run the demo though I don't even start looking at the source code:
An exception 'System.Data.SqlClient.SqlException' has occured in GridExDemo.exe'
Drew.
|
|
|
|
 |
|
 |
My guess is just database connection problem. Open up the source code and change the connection to your local Northwind database.
|
|
|
|
 |