i have two dropdow list in content page (month & year). i need code to show check box when i select month from dropdown. if month is january it wil show 31 check box, if februaty it will show 28 like that.. can any one help..
Server-side you can handle the selectedindexchanged event. In there you read the days in month (there's a method for that) then add items to a checkboxlist accordingly.
sat200787
Member
2 Points
4 Posts
how to show check box in content page
Feb 29, 2012 07:42 AM|LINK
i have two dropdow list in content page (month & year). i need code to show check box when i select month from dropdown. if month is january it wil show 31 check box, if februaty it will show 28 like that.. can any one help..
MetalAsp.Net
All-Star
112752 Points
18373 Posts
Moderator
Re: how to show check box in content page
Feb 29, 2012 07:51 AM|LINK
Server-side you can handle the selectedindexchanged event. In there you read the days in month (there's a method for that) then add items to a checkboxlist accordingly.
sat200787
Member
2 Points
4 Posts
Re: how to show check box in content page
Feb 29, 2012 09:34 AM|LINK
can u provide code for that.. in dropdownlist i have members ( january, february...)
vijay.reddy5...
Member
529 Points
265 Posts
Re: how to show check box in content page
Feb 29, 2012 09:57 AM|LINK
Try like this ....
use this function to get how many days in the selected month
function daysInMonth(month,year) { return new Date(year, month, 0).getDate(); }Based On the count Create checkboxes .. like ..
Assume your drop id is drpmnth and to shown checkboxes create a div as id divid
$('#drpmnth').change(function() { var days = daysInMonth($('#drpmnth option:selected').attr('value'),2012) for(var i=0; i< days; i++) { $('#divid').append("<input type=\"checkbox\" />"); } });Check my website for ASP.Net Articles -
My Website