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

RadDatePicker OnDateSelected event

1 Answer 55 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Farjana
Top achievements
Rank 1
Farjana asked on 11 Nov 2013, 06:47 AM
Hi,

Can you tell me how to get the id of a dynamically created control in jquery
I am creating a RadDatePicker dynamically in C# like:
 RadDatePicker rd = new RadDatePicker();
rd.ID = "rd_"+ "i_"+ count;
rd.ClientEvents.OnDateSelected = "dateSelected";

where i and count are some dynamically generated variables.

Now inside javascript func:
function dateSelected(sender, args) 
        {
// get the id of the sender(date picker) control;
}

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 11 Nov 2013, 11:04 AM
Hi Farjana,

Please have a look into the sample code I tried for your scenario.

C#:
protected void Page_Load(object sender, EventArgs e)
{
    int count = 5;
    RadDatePicker rd = new RadDatePicker();
    rd.ID = "rd_" + "i_" + count;
    rd.ClientEvents.OnDateSelected = "dateSelected";
    this.form1.Controls.Add(rd);
}

JavaScript:
<script type="text/javascript">
    function dateSelected(sender, args) {
        alert(sender.get_id());
    }
</script>

Thanks,
Shinu.
Tags
General Discussions
Asked by
Farjana
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or