|
List Info
Thread: RE: Error displaying images in gridview
|
|
| RE: Error displaying images in gridview |
  United States |
2008-05-01 11:55:39 |
|
It looks like you're not setting the MIME Type of the page that's binarywriting out the jpg file.
Date: Thu, 1 May 2008 20:52:24 +0530 From: mishradipak gmail.com To: aspnet-databases aspadvice.com Subject: [aspnet-databases] RE: Error displaying images in gridview
|
Dear Tim,Rafeeq
This is the error i am getting.......
Thanks for the help.
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
An invalid character was found in text content. Error processing resource 'http://localhost:1277/fmgerp/preorder/imgdisp4.a...
|
On Wed, Apr 30, 2008 at 9:36 PM, dipak mishra < mishradipa k gmail.com">mishradipak gmail.com> wrote:
Yes I did,
I will copy the error tomorrow and will post it here.
Thanks in advance
Regards
On Wed, Apr 30, 2008 at 5:25 PM, Tim Curtin < tjc_tek  hotmail.co m">tjc_tek hotmail.com> wrote:
Dipak, did you add the code in 'Catch'&nb sp;to write out an exception to a label control?
> Date: Tue, 29 Apr 2008 18:12:30 +0530
> From: kpmrafeeq gmail.com">kpmrafeeq gmail.com > Subject: [aspnet-databases] RE: Error displaying images in gridview > To: aspnet-databases aspadvice.com">aspnet-databases aspadvice.com > > Hi Dipak, > > Just a thought, Try if you have any problem on connecting to the database > server from production instance, as it working on development instance even > remotely, Just have a look if any issue with connection from production > instance. > > *Regards, > Rafeeq > Keralam.* > > On Tue, Apr 29, 2008 at 5:57 PM, dipak mishra < mishradipak gmail.com">mishradipak gmail.com> wrote: > > > Dear Tim, Rafeeq, > > I tried the code but again its not showing Images in Grid View. > > I dont know wats the prob with it. > > It Shows images on my development machine but not on system. > > My payment is stuck bcos of this error.Since on developments machine it > > works well .... while on client side it sometimes stops showing the > > image.Also same data base works well on our system. > > > > Need Help.Dont know wat to do..since no error on develpmnt system. > > > > Regards > > > > > > > > On Wed, Apr 23, 2008 at 7:27 PM, Tim Curtin < tjc_tek hotmail.com">tjc_tek hotmail.com> wrote: > > > > > 1. Maybe you're supressing an exception. write it out to a label > > > control. > > > 2. try setting the response.contenttype before you response.binarywrite > > > the image bits. > > > *Do While** (rdimg.Read()) * > > > * Response.ClearHeaders()* > > > * Response.ClearContent()* > > > * Response.ContentType = "image/jpg"* > > > Response.BinaryWrite(rdimg.Item("sampimg")) > > > > > > Loop > > > > > > Incidently, you should add a 'Finally' where you close the connection. > > > Finally always runs regardless of an exception > > > > > > sub page_load(...) > > > Me.lblMessage.Text = "" > > > end sub > > > > > > function theFunction > > > > > > > > > dim con as new SqlConnection() > > > Try > > > con.connectionstring = > > > ConfigurationManager.ConnectionStrings("connectionstring").connectionstring > > > ....... > > > > > > Catch ex As Exception > > > Me.lblMessage.Text = ex.Message 'View an exception > > > Finally > > > If con.State <> ConnectionState.Closed() Then con.Close() > > > End Try > > > > > > > > > Tim > > > > > > ------------------------------ > > > Date: Wed, 23 Apr 2008 10:36:49 +0530 > > > > > > From: mishradipak gmail.com">mishradipak gmail.com > > > To: aspnet-databases aspadvice.com">aspnet-databases aspadvice.com > > > Subject: [aspnet-databases] RE: Error displaying images in gridview > > > > > > Dear Tim > > > here is the code............ for grid view...............SampImg is the > > > name of the column to display image which has been converted to templte > > > column ..........formaturl is the function used to pass the sno which is > > > identity and primary key. > > > > > > <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" > > > CellPadding="4" > > > DataKeyNames="snoart" DataSourceID="SqlDataSource4" ForeColor="#333333" > > > GridLines="None" AllowPaging="True" AllowSorting="True"> > > > <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> > > > <Columns> > > > <asp:CommandField ShowSelectButton="True" /> > > > <asp:BoundField DataField="snoart" HeaderText="SNoArt" InsertVisible > > > ="False" ReadOnly="True" > > > SortExpression="snoart" /> > > > <asp:BoundField DataField="sampname" HeaderText="SampName" > > > SortExpression="sampname" /> > > > <asp:BoundField DataField="artdesign" HeaderText="ArtDesign" > > > SortExpression="artdesign" /> > > > <asp:TemplateField HeaderText="SampImg" SortExpression="sampimg"> > > > <EditItemTemplate> > > > <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("sampimg") %> > > > '></asp:TextBox> > > > </EditItemTemplate> > > > <ItemTemplate> > > > <asp:Image ID="Image1" width="75" Height="75" runat="server" ImageUrl='<%# > > > formaturl(databinder.Eval(container.dataitem,("snoart"))) %>' /> > > > </ItemTemplate> > > > </asp:TemplateField> > > > </Columns> > > > <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> > > > <EditRowStyle BackColor="#999999" /> > > > <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor > > > ="#333333" /> > > > <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign > > > ="Center" /> > > > <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> > > > <AlternatingRowStyle BackColor= | |