|
Rank: Newbie Groups: Member
Joined: 5/4/2010 Posts: 5
|
Hi. I'd like to create controls dynamically. That means adding '<eo:DatePicker id="<%= valName %>" ...' to a .ascx file and then calling the .ascx file.
Or, making a for bucle, and do the same....
Is it possible?
If it were possible, is also possible create new object from javascript?
Thank you in advance...
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi,
I don't think you can do that with ID attribute. You can do that with other attribute but not ID. This is a general ASP.NET rule and would be the same for any server control. It is not something special for our control.
In order to set the ID dynamically, you must set them in your code. For example, you can put ID="DatePicker1" in your .aspx and then do DatePicker1.ID = "whatever" in your code.
You can not create DatePicker control from JavaScript.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 5/4/2010 Posts: 5
|
Yes, I was not very lucid about the ID, you're right.
But there is not a way of creating dinamically (at least on the .aspx.vb code) a new control? Just to simplify, I'd like to put a button that adds 1 new line with a datepicker, so I can push that button X times.
I understand that I can't do that on javascript, but is there any way of doing it on the .vb code. The way you are telling me, I have to predefine the object on the .aspx, is that right?
Thanks for your quick answer.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi,
Of course you can always dynamically create control inside your .aspx.vb code. We told you that you can put a static DatePicker and then change ID because we thought you only needed to dynamically change IDs. However you can dynamically create a DatePicker just fine. It will be the same dynamically creating any other control. The DatePicker control is an ASP.NET server control. So there is no difference between it and any other standard server control in this regard.
As previously stated, you can not dynamically create the DatePicker control from JavaScript.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 5/4/2010 Posts: 5
|
Thanks for you quick answer, I'm gonna test this (and the others) controls, and I'm linking them very much...
|
|