| Author: saravanakumar 10 Jan 2009 | Member Level: Gold | Rating:    Points: 6 |
hi syed,
cosider this as ur repeater, <asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand"> <HeaderTemplate> </HeaderTemplate> <ItemTemplate> <div style="height:90px;"> <asp:Image ID="Image1" runat="server" ImageUrl='<%# "hnd_SearchProfilePic.ashx?id="+Eval("Uid") %>' Height="85px" Width="85px" /> </div>
<div style="height:12px;"><strong>User ID : </strong><%# DataBinder.Eval(Container.DataItem, "Uid")%></div> <div style="height:20px;"><strong>Name : </strong><%# DataBinder.Eval(Container.DataItem, "Name")%></div> <td width="45%" style="font-family:Verdana; font-size:10px; color:Gray;"> <div style="height:20px;"><strong>Age : </strong><%# DataBinder.Eval(Container.DataItem, "Age")%></div> </ItemTemplate> <FooterTemplate> </FooterTemplate> </asp:Repeater>
int his repeater the UserID,Name,Age and Photo.
U have to add the UserID as query string for ashx page as below, ImageUrl='<%# "hnd_SearchProfilePic.ashx?id="+Eval("Uid") %>'
Now in hnd_SearchProfilePic.ashx page,
string str_UsrID = context.Request.QueryString["id"]; // get the query string.
sqlcon = new SqlConnection(ConfigurationSettings.AppSettings["Connection"].ToString()); sqlcon.Open(); sqlcmd = new SqlCommand("SELECT img_Photo1 FROM tb_Usr_Photo WHERE str_UsrId='" + str_UsrID + "'", sqlcon); SqlDataReader sqlreader = sqlcmd.ExecuteReader(); sqlreader.Read(); if (sqlreader.HasRows) { context.Response.ContentType = "image/bmp"; context.Response.BinaryWrite((byte[])sqlreader["img_Photo1"]); } sqlcon.Close();
regards, saravan
|
| Author: Syed Shakeer Hussain 10 Jan 2009 | Member Level: Diamond | Rating:  Points: 1 |
you code with Explanation Help me Lot Very Very Very Thkq u......... ...
Thanks & Regards! Syed Shakeer Hussain
|