+ Start a Discussion

How to create columns dynamically ?

Hi everyone,


I created one object, which have fields like Start date, weeks etc.,. and also i created one custom button named as "Add". 


Coming to my requirement, if i give start date as 6/11/2012 and weeks as 3 then click on add button i want to show the pageblock table with below columns


startdate , weeks, 6/11/2012, 13/11/2012, 20/11/2012. and also these 3 week values will be in input form.


here my main intention is, how to create these type of columns dynamically? and also how to take the week values

 because if i take week value as 5 then i want to populate the coloumns 5 times dynamically. so here main thing is weeks  and startdate. based on weeks i want to populte the columns. if i give 5 weeks then i want first column as start date and remaining 4 columns will populate with further week values. And also another thing is, after giving these values where i want to store the values. For this waht i want to create???


So please give the solution to me ASAP. 






Hi ankit,



Actually i am displaying columns as dynamically, but after entering the value in that where i could store those details. Upto now i taken one String varible in apex class, and i am repeating that column many times, but after saving that record where i vl store those record. For this what i will take either field or anything else?


Give the solution as soon as possible?