Two days ago i asked for some help with a Datalist problem that was resolved thanks to Jim and Co. It was solved using the ItemDataBound Event. I have a new problem, however, I was wondering if anyone can offer some suggestions.
I would like to extract a DataItem in the Items Template that is not assigned to a control in my HTML. I know how to do this through an assignment to a control but how can I do it if it's not assigned to anything?
Here is the HTML Code:
<ItemTemplate>
<asp:LinkButton id="Linkbutton3" runat="server" Text="View" CommandName="edit"></asp:LinkButton><I>
Org: <%# DataBinder.Eval(Container.DataItem, "school")%>
- <%# DataBinder.Eval(Container.DataItem, "school_name")%>
Rec. Date: <%# DataBinder.Eval(Container.DataItem, "rec_date")%> Status:
<%# status(DataBinder.Eval(Container.DataItem, "status"))%>
</I>
</ItemTemplate>
Here is my code behind so far:
Private Sub Datalist2_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles Datalist2.ItemDataBound
If e.Item.ItemType = ListItemType.Item Then
Dim txtStatus As TextBox = e.Item.FindControl("Textbox23")
End If
End Sub
Jim, Thanks again for your help earlier in the week that was perfect.
I would like to extract a DataItem in the Items Template that is not assigned to a control in my HTML. I know how to do this through an assignment to a control but how can I do it if it's not assigned to anything?
Here is the HTML Code:
<ItemTemplate>
<asp:LinkButton id="Linkbutton3" runat="server" Text="View" CommandName="edit"></asp:LinkButton><I>
Org: <%# DataBinder.Eval(Container.DataItem, "school")%>
- <%# DataBinder.Eval(Container.DataItem, "school_name")%>
Rec. Date: <%# DataBinder.Eval(Container.DataItem, "rec_date")%> Status:
<%# status(DataBinder.Eval(Container.DataItem, "status"))%>
</I>
</ItemTemplate>
Here is my code behind so far:
Private Sub Datalist2_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles Datalist2.ItemDataBound
If e.Item.ItemType = ListItemType.Item Then
Dim txtStatus As TextBox = e.Item.FindControl("Textbox23")
End If
End Sub
Jim, Thanks again for your help earlier in the week that was perfect.