K
King Coffee
Hi,
The following is the code snippet I'm trying to develop. The select method
GetPics returns a collection (filtered by Request["AptID"]) of image
filenames from a DB. The primary field returned by GetPics is "PicID". I
want the GridView to display the images per rowset filename DB field.
<asp:GridView ID="GridView1" Runat="server" DataSourceID="ObjectDataSource1"
DataKeyNames="PicID" onrowdatabound="GridView1_RowDataBound" >
<Columns>
<asp:templatefield HeaderText="Photo">
<itemtemplate>
<asp:Image ID="Image1" runat="server" />
</itemtemplate>
</asp:templatefield>
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1"
TypeName=".Pics"
DataObjectTypeName="Pics"
SelectMethod="GetPics"
Runat="server" >
<SelectParameters>
<asp:QueryStringParameter QueryStringField="AptID" Type="Int32"
Name="AptId" />
</SelectParameters>
</asp:ObjectDataSource>
_________________________________________________________________________
protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Image img = e.Row.FindControl("Image1") as Image;
img.ImageUrl = "~/Gallery/4/Thumbs/" + ???;
}
}
Thanks,
King
The following is the code snippet I'm trying to develop. The select method
GetPics returns a collection (filtered by Request["AptID"]) of image
filenames from a DB. The primary field returned by GetPics is "PicID". I
want the GridView to display the images per rowset filename DB field.
<asp:GridView ID="GridView1" Runat="server" DataSourceID="ObjectDataSource1"
DataKeyNames="PicID" onrowdatabound="GridView1_RowDataBound" >
<Columns>
<asp:templatefield HeaderText="Photo">
<itemtemplate>
<asp:Image ID="Image1" runat="server" />
</itemtemplate>
</asp:templatefield>
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1"
TypeName=".Pics"
DataObjectTypeName="Pics"
SelectMethod="GetPics"
Runat="server" >
<SelectParameters>
<asp:QueryStringParameter QueryStringField="AptID" Type="Int32"
Name="AptId" />
</SelectParameters>
</asp:ObjectDataSource>
_________________________________________________________________________
protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Image img = e.Row.FindControl("Image1") as Image;
img.ImageUrl = "~/Gallery/4/Thumbs/" + ???;
}
}
Thanks,
King