HI, I have a datalist which displays a list of staff, when a row is selected a Panel appears showing more details. This is the code that fires the Panel (Panel2):
Protected Sub MoreBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Panel1.Visible = False
Panel2.Visible = True
End Sub
Then I grab the details from the datalist and show them in Panel2 like this:
Protected Sub DataList4_ItemCommand(source As Object, e As DataListCommandEventArgs)
If e.CommandName = "Link" Then
Dim label1 As Label = DirectCast(DataList4.Items(e.Item.ItemIndex).FindControl("Label1"), Label)
Dim label2 As Label = DirectCast(DataList4.Items(e.Item.ItemIndex).FindControl("Label2"), Label)
Dim label3 As Label = DirectCast(DataList4.Items(e.Item.ItemIndex).FindControl("Label3"), Label)
Dim label4 As Label = DirectCast(DataList4.Items(e.Item.ItemIndex).FindControl("Label4"), Label)
Dim label5 As Label = DirectCast(DataList4.Items(e.Item.ItemIndex).FindControl("Label5"), Label)
UserNameBox.Text = label1.Text
PostBox.Text = label2.Text
SectionBox.Text = label3.Text
ServiceBox.Text = label4.Text
PhotoBox.Text = label5.Text
End If
End Sub
This all works fine but what I'd also like is to show the corresponding photo in Panel2 alongside the details.
I've tried passing the photo URL into the Panel via PhotoBox.Text but obviously this just shows the path to the photo.
Member
16 Points
122 Posts
display image in panel when datalist row is clicked
Feb 06, 2017 09:50 AM|wilsation|LINK
HI, I have a datalist which displays a list of staff, when a row is selected a Panel appears showing more details. This is the code that fires the Panel (Panel2):
Then I grab the details from the datalist and show them in Panel2 like this:
This all works fine but what I'd also like is to show the corresponding photo in Panel2 alongside the details.
I've tried passing the photo URL into the Panel via PhotoBox.Text but obviously this just shows the path to the photo.
Any help is much appreciated.
Member
16 Points
122 Posts
Re: display image in panel when datalist row is clicked
Feb 06, 2017 11:06 AM|wilsation|LINK
Fixed it with this:
And displayed it in the Panel with this:
All-Star
52493 Points
15665 Posts
Re: display image in panel when datalist row is clicked
Feb 06, 2017 12:21 PM|oned_gk|LINK
Use asp:image
Suwandi - Non Graduate Programmer