This is a migrated thread and some comments may be shown as answers.

Customize format AND/OR control for Popup radGrid EditForm

1 Answer 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tayonee
Top achievements
Rank 1
Tayonee asked on 20 Jul 2011, 10:07 PM
I have set up a radGrid for editing in PopUp mode. In the main grid I have customized both the header text and the DisplayFormatString of several columns. Everything looks good there. What I am noticing is that when the edit form shows up, the labels for the field controls are showing correctly BUT the DataFormatString is no longer being applied (date should be showing the short date format, and they incorrectly show the time as well).

So, I am wondering two things:

1.) Can you customize the DisplayFormatString of the dynamically created EditForm control content?
2.) Is it possible to substitute more "intelligent" controls for the textboxes that the EditForm uses? For example, I would like to use radDatePicker  controls for date input. 

I already know about creating completely custom templates - but am trying to find ways to accomplish the items above without essentially having to code the Edit form from scratch.

Ideas?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 21 Jul 2011, 06:05 AM
Hello Tayonee,

You can set DataFormatSting dynamically by accessing the BoundColumn in edit mode as shown below.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
      if (e.Item is GridEditableItem && e.Item.IsInEditMode)
      {
            GridEditableItem item = (GridEditableItem)e.Item;
            TextBox txtbox = item["ColumnUniqueName"].Controls[0] as TextBox;
            txtbox.DataFormatString="{0:##-##}";
      }
}

In order to use DatePicker for date input, you can use GridDateTimeColumn with option to choose RadDatePicker, RadDateTimePicker or RadTimePicker. Check the following demo which explains more about this.
Grid / Column Types.

Thanks,
Princy.
Tags
Grid
Asked by
Tayonee
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or