3 Answers, 1 is accepted
0

Emanuel Varga
Top achievements
Rank 1
answered on 24 Oct 2010, 06:12 PM
Hello Tooraj,
Yes, and i have some questions, do you want the FA datetime picker element to be always visible or just in edit mode?
In normal mode can you use a normal GridViewDateTime column with a custom format?
Best Regards,
Emanuel Varga
Yes, and i have some questions, do you want the FA datetime picker element to be always visible or just in edit mode?
In normal mode can you use a normal GridViewDateTime column with a custom format?
Best Regards,
Emanuel Varga
0

Emanuel Varga
Top achievements
Rank 1
answered on 24 Oct 2010, 07:26 PM
Hello again Tooraj,
Can you please try this:
I didn't change the default date format in this example but i think you can manage that, but for editing the FADatePicker is used, please let me know if this is ok for you.
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
Can you please try this:
using
System;
using
System.ComponentModel;
using
System.Drawing;
using
System.Windows.Forms;
using
FarsiLibrary.Win.Controls;
using
Telerik.WinControls;
using
Telerik.WinControls.UI;
using
System.Security.Cryptography;
using
System.Text;
public
partial
class
Form1 : Form
{
private
RadGridView radGridView1;
public
Form1()
{
InitializeComponent();
this
.Size =
new
System.Drawing.Size(500, 300);
LoadGrid();
}
private
void
LoadGrid()
{
this
.Controls.Add(radGridView1 =
new
RadGridView());
radGridView1.Dock = DockStyle.Fill;
radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
radGridView1.CellBeginEdit +=
new
GridViewCellCancelEventHandler(radGridView1_CellBeginEdit);
radGridView1.CellEndEdit +=
new
GridViewCellEventHandler(radGridView1_CellEndEdit);
radGridView1.DataSource =
new
TestsCollection(10);
}
void
radGridView1_CellEndEdit(
object
sender, GridViewCellEventArgs e)
{
if
(radGridView1.Columns[e.ColumnIndex].Name ==
"Date"
)
{
if
(
this
.radGridView1.CurrentCell.Children.Count == 1)
{
this
.radGridView1.CurrentCell.Children.RemoveAt(0);
}
}
}
void
radGridView1_CellBeginEdit(
object
sender, GridViewCellCancelEventArgs e)
{
if
(radGridView1.Columns[e.ColumnIndex].Name ==
"Date"
)
{
var activeEditor = radGridView1.ActiveEditor
as
RadDateTimeEditor;
FADatePicker dateTimePicker =
new
FADatePicker();
dateTimePicker.SelectedDateTimeChanged +=
delegate
{ activeEditor.Value = dateTimePicker.SelectedDateTime; };
dateTimePicker.SelectedDateTime = (DateTime)activeEditor.Value;
RadHostItem item =
new
RadHostItem(dateTimePicker);
this
.radGridView1.CurrentCell.Children.Add(item);
}
}
}
#region Helpers
internal
class
Test
{
public
int
Id {
get
;
set
; }
public
string
Name {
get
;
set
; }
public
DateTime Date {
get
;
set
; }
public
Test(
int
id,
string
name, DateTime date)
{
this
.Id = id;
this
.Name = name;
this
.Date = date;
}
}
internal
class
TestsCollection : BindingList<Test>
{
public
TestsCollection(
int
noItems)
{
for
(
int
i = 0; i < noItems; i++)
{
this
.Add(
new
Test(i,
"item"
+ i, DateTime.Now.AddDays(i)));
}
}
}
#endregion Helpers
I didn't change the default date format in this example but i think you can manage that, but for editing the FADatePicker is used, please let me know if this is ok for you.
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
0

Emanuel Varga
Top achievements
Rank 1
answered on 25 Oct 2010, 02:08 PM
Hello again,
I was just wondering if you had the chance to test the code in my previous post?
Did it solve your problems?
Best Regards,
Emanuel Varga
I was just wondering if you had the chance to test the code in my previous post?
Did it solve your problems?
Best Regards,
Emanuel Varga