if want to control if a statement is true or false in a literal, depanding on this the page should display an 'x' or a button
the x is already working but the button isn't, probably because it is serverside
i tried 2 ways to display the button but none worked...
the literal is inside a listview
does anyone know how i can get the button on the page?
here's my code:
<ItemTemplate runat="server">
<tr id="row" runat="server">
<td> <a href=<%# "detailrooster.aspx?DagID=" & Eval("DagID") %>><%#Eval("Datum").ToString.Substring(0, 9)%></a> </td>
<td> <%#Eval("Uur")%></td>
<td> <%#Eval("Naam")%></td>
<td align="center"><asp:Literal ID="LiteralBevestigd" runat="server" /> </td>
<td align="center"><asp:Literal ID="LiteralAfgekeurd" runat="server" /> </td>
</tr>
</ItemTemplate>
Private Sub Listview1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewItemEventArgs)
Dim LiteralBevestigd As Literal = e.Item.FindControl("LiteralBevestigd")
Dim LiteralAfgekeurd As Literal = e.Item.FindControl("LiteralAfgekeurd")
'dim myliteral as literal = CTYPE(sender,listview1)
Dim lvdiContainer As ListViewDataItem = CType(LiteralBevestigd.NamingContainer, ListViewDataItem)
Dim bevestigd As String = DataBinder.Eval(lvdiContainer.DataItem, "Bevestigd").ToString()
Dim afgekeurd As String = DataBinder.Eval(lvdiContainer.DataItem, "Afgekeurd").ToString()
If afgekeurd.Equals("False") And bevestigd.Equals("False") Then
LiteralAfgekeurd.Text &= String.Format(" <asp:Button ID=" & Chr(34) & "Button1" & Chr(34) & "runat=" & Chr(34) & "server" & Chr(34) & " Text=" & Chr(34) & "Button" & Chr(34) & " onclick=" & Chr(34) & "Button1_Click" & Chr(34) & "/> ", e.Item.ID)
LiteralBevestigd.Text &= "<asp:Button ID='Button2'runat='server' Text='Button' onclick='Button1_Click'/> "
Else
If bevestigd.Equals("True") Then
LiteralBevestigd.Text &= "x"
Else
LiteralAfgekeurd.Text &= "x"
End If
End If
End Sub
the x is already working but the button isn't, probably because it is serverside
i tried 2 ways to display the button but none worked...
the literal is inside a listview
does anyone know how i can get the button on the page?
here's my code:
<ItemTemplate runat="server">
<tr id="row" runat="server">
<td> <a href=<%# "detailrooster.aspx?DagID=" & Eval("DagID") %>><%#Eval("Datum").ToString.Substring(0, 9)%></a> </td>
<td> <%#Eval("Uur")%></td>
<td> <%#Eval("Naam")%></td>
<td align="center"><asp:Literal ID="LiteralBevestigd" runat="server" /> </td>
<td align="center"><asp:Literal ID="LiteralAfgekeurd" runat="server" /> </td>
</tr>
</ItemTemplate>
Private Sub Listview1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewItemEventArgs)
Dim LiteralBevestigd As Literal = e.Item.FindControl("LiteralBevestigd")
Dim LiteralAfgekeurd As Literal = e.Item.FindControl("LiteralAfgekeurd")
'dim myliteral as literal = CTYPE(sender,listview1)
Dim lvdiContainer As ListViewDataItem = CType(LiteralBevestigd.NamingContainer, ListViewDataItem)
Dim bevestigd As String = DataBinder.Eval(lvdiContainer.DataItem, "Bevestigd").ToString()
Dim afgekeurd As String = DataBinder.Eval(lvdiContainer.DataItem, "Afgekeurd").ToString()
If afgekeurd.Equals("False") And bevestigd.Equals("False") Then
LiteralAfgekeurd.Text &= String.Format(" <asp:Button ID=" & Chr(34) & "Button1" & Chr(34) & "runat=" & Chr(34) & "server" & Chr(34) & " Text=" & Chr(34) & "Button" & Chr(34) & " onclick=" & Chr(34) & "Button1_Click" & Chr(34) & "/> ", e.Item.ID)
LiteralBevestigd.Text &= "<asp:Button ID='Button2'runat='server' Text='Button' onclick='Button1_Click'/> "
Else
If bevestigd.Equals("True") Then
LiteralBevestigd.Text &= "x"
Else
LiteralAfgekeurd.Text &= "x"
End If
End If
End Sub