Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

4 Answers

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
add comment

Please try adding below code in databound event

DateTimeControl dtc = new DateTimeControl();

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

I don't think this is possible.

share|improve this answer
add comment

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
add comment

Your Answer

 
discard

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.