E
Erik
Good Morning,
I am trying to dynamically generate an ImageButton in a datalist label
column. When I have a static reference to the image 'image/plus.gif', the
image is displayed in the label column.
However, when I try to adapt the html code to be dynamically defined in the
binding of the label column, the image is not displayed. Below is the sub
BindParentLabelColumn where the label text is assigned.
Any insight on the issue is greatly appreciated - I am stumped.
Thank you, Erik
Public Sub BindParentLabelColumn(ByVal sender As Object, ByVal e As EventArgs)
Dim lbl As Label = CType(sender, Label)
Dim strvals As String
Dim container As DataListItem = CType(lbl.NamingContainer,
DataListItem)
Dim dt As DataTable = Session("DataList_ParentDetailControls")
Dim dc As DataColumn
Dim sColumnValue As String
Dim sColumnName As String
strvals = "<tr>"
For Each dc In dt.Columns
sColumnName = dc.ColumnName
sColumnValue =
Convert.ToString(DataBinder.Eval(CType(container, DataListItem).DataItem,
dc.ColumnName))
strvals &= "<TD align='center' width='10'><asp:ImageButton
ID='Expand" + sColumnName + "' runat='server' CommandName='Select" +
sColumnName + "' ImageUrl='images/plus.gif'></asp:ImageButton></TD>" & _
"<TD align='center' width='80'>" + sColumnValue +
"</TD>"
End If
Next
strvals &= "</tr>"
lbl.Text = strvals
End Sub 'BindParentLabelColumn
I am trying to dynamically generate an ImageButton in a datalist label
column. When I have a static reference to the image 'image/plus.gif', the
image is displayed in the label column.
However, when I try to adapt the html code to be dynamically defined in the
binding of the label column, the image is not displayed. Below is the sub
BindParentLabelColumn where the label text is assigned.
Any insight on the issue is greatly appreciated - I am stumped.
Thank you, Erik
Public Sub BindParentLabelColumn(ByVal sender As Object, ByVal e As EventArgs)
Dim lbl As Label = CType(sender, Label)
Dim strvals As String
Dim container As DataListItem = CType(lbl.NamingContainer,
DataListItem)
Dim dt As DataTable = Session("DataList_ParentDetailControls")
Dim dc As DataColumn
Dim sColumnValue As String
Dim sColumnName As String
strvals = "<tr>"
For Each dc In dt.Columns
sColumnName = dc.ColumnName
sColumnValue =
Convert.ToString(DataBinder.Eval(CType(container, DataListItem).DataItem,
dc.ColumnName))
strvals &= "<TD align='center' width='10'><asp:ImageButton
ID='Expand" + sColumnName + "' runat='server' CommandName='Select" +
sColumnName + "' ImageUrl='images/plus.gif'></asp:ImageButton></TD>" & _
"<TD align='center' width='80'>" + sColumnValue +
"</TD>"
End If
Next
strvals &= "</tr>"
lbl.Text = strvals
End Sub 'BindParentLabelColumn