Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6194123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:14:30+00:00 2026-05-24T03:14:30+00:00

Markup: <asp:ListView ID=lvGallery runat=server DataSourceID=SqlDataSource1> <LayoutTemplate> <table runat=server id=tableGallery> <tr runat=server id=itemPlaceHolder></tr> </table> </LayoutTemplate>

  • 0

Markup:

<asp:ListView ID="lvGallery" runat="server" DataSourceID="SqlDataSource1">
    <LayoutTemplate>
        <table runat="server" id="tableGallery">
            <tr runat="server" id="itemPlaceHolder"></tr>       
        </table>       
    </LayoutTemplate>
    <ItemTemplate>       
    <tr>
        <td>
            <div class="box_img2">
                <div class="g_size">
                    <a runat="server" id="linkImage">
                        <img id="Image1" runat="server" src="MyImage.jpg" />
                    </a>
                </div>         
            </div>
        </td>
    </tr>
   </ItemTemplate>
</asp:ListView>    
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="..."  ProviderName="System.Data.SqlClient"  SelectCommand="SELECT [Image] FROM [GalleryImages]"></asp:SqlDataSource>

Code-behind:

public void ProcessRequest(HttpContext context)
{
    //write your handler implementation here.
    string username = Convert.ToString(context.Request.QueryString["username"]);
    if (username != null)
    {
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter();
        byte[] arrContent;
        DataRow dr;
        string strSql;
        strSql = "Select Image from GalleryImages where username = '" + username + "'";
        da = new SqlDataAdapter(strSql, connection.ConnectionString);
        da.Fill(ds);
        dr = ds.Tables[0].Rows[0];
        arrContent = (byte[])dr["ImageFile"];
        context.Response.ContentType = "jpeg";
        context.Response.OutputStream.Write(arrContent, 0, arrContent.Length);
        context.Response.End();
    }
}

I have also added httphandlers section in web.config. But I don’t get the images in ListView control.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:14:31+00:00Added an answer on May 24, 2026 at 3:14 am

    Cool question. I would write a class implementing IHttpHandler which responds to requests for the image file(s).

    See my answer in the following question for an example of how to get file streams in and out of a SQL varbinary(max) field.

    How to make a fileupload interface in ASP.NET

    Don’t forget to use the correct MIME type when crafting the HTTP response.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following (trimmed) markup: <asp:Repeater ID=CostCategoryRepeater runat=server> <ItemTemplate> <div class=costCategory> <asp:Repeater ID=CostRepeater
I have this markup: <asp:Repeater ID=appsRepeater runat=server> <ItemTemplate> <li> <div class=clearfix> <a href=---some code
Repeater Markup: <asp:Repeater ID=stat_Rptr runat=server> <ItemTemplate> <asp:CheckBox ID=IsSelected_ChkBx runat=server Text='<%# Eval(Item) %>' /> &nbsp;<asp:TextBox
In my repeater I have the following markup: <asp:Repeater runat=server id=TeamsRepeater OnItemDataBound=TeamsRepeater_ItemDataBound ClientIDMode=Predictable> <ItemTemplate>
Why does this markup ... <asp:TextBox ID=TextBox1 runat=server CausesValidation=False></asp:TextBox> <asp:RegularExpressionValidator ID=RegExValidatorTextBox1 runat=server ControlToValidate=TextBox1 Text=Invalid
I have a item in a listView control like this <asp:Label ID=Label2 runat=server Text='<%#Eval(Open)
I have the following asp.net markup: <asp:TextBox ID=txtPassword runat=server TextMode=Password ValidationGroup=passwordValidation></asp:TextBox> <asp:RequiredFieldValidator ID=RequiredFieldValidator1 runat=server
Markup: <asp:GridView ID=GridView1 runat=Server> <Columns> <asp:BoundField DataField=status_column HeaderText=Status /> <asp:BoundField ... <asp:BoundField ... </Columns>
I have the following markup: <asp:DropDownList ID=dd1 AutoPostBack=true runat=server> <asp:ListItem Value=1>1</asp:ListItem> <asp:ListItem Value=2>2</asp:ListItem> </asp:DropDownList>
I have a .net page with following markup: <asp:TextBox ID=TextBox1 runat=server></asp:TextBox> <asp:Button ID=Button1 runat=server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.