Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
605 views
Welcome To Ask or Share your Answers For Others

1 Answer

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);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...