J
James Moore
I've got a datagrid. One of the elements in the grid is a comma-seperated
string. I'd like to split the string and create N linkbuttons, one for each
element of the string.
Creating the grid with the original string isn't a problem, but I'm not sure
what the best way is to create the individual linkbuttons.
My first thought was to create a method that split the string and stashed
the array inside the page object as a public property. That works fine, but
then how do I get the property set as the datasource for the repeater? I
tried this sort of thing:
<asp:Repeater id=blarg DataSource='<%# m_test %>' Runat=server>
<ItemTemplate>
foo <%# Container.DataItem %> bar
</ItemTemplate>
</asp:Repeater>
where m_test is the public field (yes, bad style, just playing around here),
but I never get any of the "foo whatever bar" template items written out,
even when I hardcode m_test to simply return something like string []
{"one", "two", "three"}.
I'm actually thinking this is a pretty dubiuos way to solve the problem,
given that the property exposed is going to be fairly dynamic (different for
every row, based on the CSV string).
Can anyone point me to a good explanation of what's going on behind the
scenes for datasources? I'd love an article that talks about precisely what
sort of code gets hooked up/generated and talks about the complete lifecycle
of data binding.
- James
(e-mail address removed)
string. I'd like to split the string and create N linkbuttons, one for each
element of the string.
Creating the grid with the original string isn't a problem, but I'm not sure
what the best way is to create the individual linkbuttons.
My first thought was to create a method that split the string and stashed
the array inside the page object as a public property. That works fine, but
then how do I get the property set as the datasource for the repeater? I
tried this sort of thing:
<asp:Repeater id=blarg DataSource='<%# m_test %>' Runat=server>
<ItemTemplate>
foo <%# Container.DataItem %> bar
</ItemTemplate>
</asp:Repeater>
where m_test is the public field (yes, bad style, just playing around here),
but I never get any of the "foo whatever bar" template items written out,
even when I hardcode m_test to simply return something like string []
{"one", "two", "three"}.
I'm actually thinking this is a pretty dubiuos way to solve the problem,
given that the property exposed is going to be fairly dynamic (different for
every row, based on the CSV string).
Can anyone point me to a good explanation of what's going on behind the
scenes for datasources? I'd love an article that talks about precisely what
sort of code gets hooked up/generated and talks about the complete lifecycle
of data binding.
- James
(e-mail address removed)