how to set width of datalist item

  • Thread starter Thread starter TomislaW
  • Start date Start date
T

TomislaW

is it possible to set width of ItemTemplate
i tried to set like this:
<ItemStyle Width='<% SomeProperty %>'></ItemStyle>

i get error:

'<% SomeProperty %>' can not be parsed as a unit as there are no numeric
values in it. Examples of valid unit strings are '1px' and '.5in'.
 
I think you can also give the itemTemplate a id and then set properties
through the id. Like this:

Sub Do_Something
ITS1.Width = SomeProperty
End Sub

<ItemStyle Id="ITS1" Width='<% SomeProperty %>'></ItemStyle>
This works with other server tags, hope it works in this case as well.
 
I did
it says:
CS0117: 'System.Web.UI.WebControls.TableItemStyle' does not contain a
definition for 'DataBinding'

Have you tried using databinding syntax?

<%# SomeProperty %>
 
Chad Devine said:
I think you can also give the itemTemplate a id and then set properties
through the id. Like this:

Sub Do_Something
ITS1.Width = SomeProperty
End Sub

i have datalist inside repeater so it is very difficult to access control
inside datalist
this is the reason why i using properties inside html, and not code behind
 
Back
Top