SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
And you haven't written any code on Button_Click event? – Arsalan Adam Khatri Dec 18 '12 at 5:45
no i hadn't written any code on Button_Click. – Hitesh Chandegara Dec 18 '12 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. – Hitesh Chandegara Dec 18 '12 at 5:53
I think it would be easier if you just show us your problematic code. – Mike Dec 28 '12 at 15:05

I don't think this is possible.

share|improve this answer

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 .

share|improve this answer

Please try adding below code in databound event

DateTimeControl dtc = new DateTimeControl();

((TextBox)dtc.Controls[0]).ReadOnly = true;
share|improve this answer

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)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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