C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

To sravanKumar


Posted Date: 10 Jan 2009      Posted By: Syed Shakeer Hussain       Member Level: Diamond     Points: 1   Responses: 2



Hi

I didnot use id in ashx.
Plz tell how to use it


Thanks & Regards!
Syed Shakeer Hussain





Responses

Author: saravanakumar    10 Jan 2009Member Level: GoldRating: 4 out of 54 out of 54 out of 54 out of 5     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 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 1

you code with Explanation Help me Lot
Very Very Very Thkq u.........
...


Thanks & Regards!
Syed Shakeer Hussain



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : what is the code behind technic how it impltements?
Previous : huge database takes time to retrieve in Datagrid
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use