This is a migrated thread and some comments may be shown as answers.

[Solved] can we create Custom control using datepicker?

1 Answer 96 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 08 May 2009, 05:30 AM
Hi,
 I would like to know if we can create cusom or composite control using datepicker?? If so how can we do it? 

Thanks 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 08 May 2009, 09:42 AM
Hi John,

You can create Custom control using RadDatePicker as shown below.

CS:
 
 public class CustomDatePicker : RadDatePicker 
    { 
        public string PickerText 
        { 
            get { return _pickerText; } 
            set { _pickerText = value; } 
        } 
        private string _pickerText; 
        protected override void Render(HtmlTextWriter writer) 
        { 
            writer.Write(@"<span >{0}&nbsp;</span>", PickerText); 
            base.Render(writer); 
        } 
    } 
 
   //to add the custom control to the Page 
    protected void Page_Init(object sender, EventArgs e) 
    { 
        CustomDatePicker cusDtPkr = new CustomDatePicker(); 
        cusDtPkr.ID = "CustomDatePicker1"
        cusDtPkr.PickerText = "MyCustomDatePicker"
        cusDtPkr.BackColor = System.Drawing.Color.Pink; 
        form1.Controls.Add(cusDtPkr); 
    } 


Regards
Shinu.
Tags
Calendar
Asked by
John
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or