is this possible?

G

Guest

I have a datagrid with
<asp:TemplateColumn HeaderText="Needs">
<ItemTemplate>
<%# MySplit(DataBinder.Eval(Container.DataItem, "UnitRequestNeed")) %>
</ItemTemplate>
</asp:TemplateColumn>

my asp.vb page has the function:
Public Function MySplit(ByVal s As String)
Dim var
Dim strString As String
Dim arrArray() As String
Dim strItem As String
Dim x As Integer

strString = s
arrArray = strString.Split("/")
If arrArray.Length = "2" Then

var = "<asp:Button runat=""Server"" CommandArgument=" &arrArray(0)
&">"
Else
End If
Return var
End Function

When I try it I get the page displayed, but no button. It seems to be hard
coded in the html.
 
B

Brock Allen

This won't work, because the result needs to be a string to set in as content
or to a property on the layout that's already been parsed by ASP.NET. Handing
back <asp:TextBox> syntax at runtime is past when the ASP.NET parser runs
for the item template.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,196
Latest member
ScottChare

Latest Threads

Top