DateTimeControl is inside grid and I bind the grid inside !ispostback section, on row databound of grid I find that datetimecontrol and disable it.

When button click event (outside of grid), the DateTimeControl gets enabled.

There is no code inside button click event.

How can I solve this issue?

  • And you haven't written any code on Button_Click event? Commented Dec 18, 2012 at 5:45
  • no i hadn't written any code on Button_Click. Commented Dec 18, 2012 at 5:46
  • DateTimeControl is inside grid and i bind grid inside !ispostback section, on row databound of grid i find that datetimecontrol and disabled it. Commented Dec 18, 2012 at 5:53
  • I think it would be easier if you just show us your problematic code.
    – Mike
    Commented Dec 28, 2012 at 15:05

4 Answers 4


I don't think this is possible.


Please be more specific to what you want to achieve. Instead of you binding dateTime control at !ispostback section why don't you try adding a date and time column to SharePoint list.

If you are using the data from external sources such as sql then you should consider using external list in BDC which is for same purpose i.e. binding a Sharepoint list from external datasource .


Please try adding below code in databound event

DateTimeControl dtc = new DateTimeControl();

((TextBox)dtc.Controls[0]).ReadOnly = true;

I think you can disable it in two ways.

The first one is code behind how @Manish shows to you (I don't know if it works). The 2nd way is using JavaScript in combo with JQuery:

1 - Select the element base on its id

2 - Then disable the textbox and the button on the DateTime control (if you provide the rendered HTML I can write to you the required JQuery code)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.