add custom attribute to RadDatePicker

I’m trying to add a custom attribute on a RadDatePicker but it adds the attribute to the wrapper instead of the inputfield.
is there a way to add an attribute to the input field of a RadDatePicker

I found that if I opened the controls and selected the first value in my watch, I’d get the input field + it had an attributes attribute.
but when trying to add an attribute to the first Control, it gives a red squigly line saying that rdp.Controls[0].Attributes doesn’t exist.

my code:

RadDatePicker rdp = (RadDatePicker)control_object[control_id];
rdp.Attributes.Add("controlID", control_id);

rdp.Controls[0].Attributes.Add("controlID", control_id);

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I figured it out,

I had to define the rdp.Controls[0] as a radDateInput.

//1 liner
((RadDateInput)rdp.Controls[0]).Attributes.Add("controlID", control_id);

//2 lines
RadDateInput rdi = (RadDateInput)rdp.Controls[0];
rdi.Attributes.Add("controlID", control_id);


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x