Losing images in GridView on postback

I've created this webpage where the client can update a page of events. They can also add an event including a photo. I'm very new at programming but I got the entire thing working. I went to upload it and everytime a button is clicked one of the photos disapears. I've looked all over the web for a way to fix it but most of the posts I don't understand. I realize it has something to do with the postback. Most of the code is in the aspx page. I have Enable ViewState="true" .

Should I post some of the code??

My coding is in vb

5/5/2009 4:19:11 AM
asp.net.state-management 8807 articles. 0 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 22
Get it on Google Play
Get it on Apple App Store

Yes, but first make a small demo replicating the problem. The demo should be as small as possible. If you post 500 lines of code, very few will look through it. But do post your (trimmed) code as without that we can't help you too much.

All that glitters is gold-
Only shooting stars break the mold.
5/5/2009 4:29:03 AM
One thing to check for is ensure you're only data binding the data once.  If you bind the data to the control, then the photo's that the users upload won't persist until you save them to either your database or where you're referencing the data for the GridView.

Malcolm Sheridan
Microsoft Certified Solution Developer
Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as
Answer" if a marked post does not actually answer your question.
5/5/2009 5:22:15 AM



Yes,u should post the code what u have written the code for the image .

i wanted to know which event your are calling for showing the image..

Let me know



Please click "mark as answer" if this post helped you.
5/5/2009 7:11:08 AM

Similar Artilces:

GridView loses it's state between postbacks
Hi,I have a GridView inside a MultiView, and although its EnableViewState property is set to True, it loses it's state through postbacks to the server.Does anyone know of something that may be causing the GridView to lose its state?The Scenario: I need it in a form where the user fills in their professional experience, and then they click "Add", and that data is added to the GridView.If they wish to add another professional experience, I retrieve the GridView's DataSource as a DataTable, create a new DataRow with the data the user suplied and then, add this DataRow to the D...

display image in Gridview from sql image in .Net 2005
Hi all, I need to Display the Image directly from SQL Database in the GridView as Thumnails. This i can do in .Net 2003 with Help of ItemDatabound Event and Template Column. But in the .Net 2005 there no ItemDatabound event in GridView. For Example I need to Show it like this:  Help Me ASAP.Tamil See :http://www.beansoftware.com/ASP.NET-Tutorials/Images-Database.aspxHope this helps. Vikram.S, DeveloperDiscountASP.NETInnovative ASP.NET Hosting & SQL Hosting Thanks a lot Sharma. It was very useful.  Tamil...

Image management for .Net
I am working on a website for a company who wishes to upload images. Preferably the images would be displayed as thumbnails and the of course when someone clicks on the thumbnail, the image would be displayed. Does anyone know of a software product that will work with Asp.net to manage images and display them as thumbnails. I imagine I could code this on my own, but I don't want to re-invent the wheel. Thanks in advance for the help. A.D. not exactly what you're looking for, but maybe this will help...

UpdatePanel with GridView inside of content place holder after partial postback image behind gridview is gone.
 Hi,  I am still pretty green with ajax controls so forgive me if this is a silly question. I have a GridView control inside of an UpdatePanel that is inside of a ContentPlaceHolder in a ContentPage. When I click on a page number to change the page and the grid reloads, actualy any action that causes the GridView to reload using the update panel causes the grid to take on the background color of the body which is defined for the Master Page. The first time the page loads I see the GridView just fine with the back ground image behind it for the ContentPlaceHolder but after partial...

State Management; .Net Profiler
Here is the situation with the customized profiler. I got a profiler class called SSOProfileProvider inheriting from ProfileProvider. I've implemented the Initilization, GetPropertyValues and SetPropertyValues. The Get... and Set.. are making a call to the database to store profile into the database. This class has been stored in the separate DLL called "Security.DLL" and there is a web site that is using this dll. The web.Config for this website is as follow:<profile enabled="true" inherits="AppProfileBase" defaultProvider="SSO" automat...

Control loses state during postback
Hi, I have checkboxlist and combobox which i am binding dynamically. When page lode event occures it populates the values from database and bind record to checkboxlist and combo. After that i select some option from checkboxlist and click on submit button and try to access the values of these controls(checkboxlist or selected value of dropdownlist) at code file i.e .cs file control loses it state and shows me item count 0 in their list. Please help me out to overcome this Issue.....Sachin EnableViewState =  "true" for the controls. It works...! ...

Losing FormsAuthentication on Gridview Postback
Hi am reeling under this strange prob of Losing FormsAuthentication value on Gridview Postback.In users personal account page i am using gridview to display some user specific stats.When i press page 2 or..page3 of this gridview the FormsAuthentication ticket (ie email in my case) is lost.Please suggest me............News & Reviews | Matrimonial | Mithila we need to see the FormsAuthentication configuration section , and the code that make the redirection ... are you using cookieless formsAuthentication  ticket? Place make sure that FormsAuthentication.SignOut() is not being cal...

radiobuttonlist losing state in gridview
I have a radiobutton list in a gridview.  On selected index change, I place the row in edit mode.  The problem is that when the row goes into edit mode, I lose the selected value of the radio button.  Any idea what could cause this? Hi, you don't tell too much about your case so I assume it is the following. When you change the grid to edit mode, you re-databind it.  And when that happens on postback event (after Page_Load), the created control (e.g databinding creates contros based on template) cannot load postback data anymore. I've explained this in with an...

Losing session state after postback
I have a webform with two listboxes. One is the parent and the other one is the child (meaning the child listbox gets populated depending on what is selected in the parent listbox). I have one dataset that has four related datatables in it. This data gets loaded during the Page_Load event. The child table in question, has 7 records in it, of which I need to filter out a smaller subset. I tried using the DataView, which was successfull, but I needed to save this filtered data across postbacks, and you can't save a dataview in session state because it's not serializable. So, I made a copy ...

lose image src on postback
Hi, I need to use an image server control on a page but am losing the image on postback from a button click event. On checking the page source there is no image src. Can anyone help? Andy Are you enabling the ViewState of the img control?regardsBilal Hadiar, MCP, MCTS, MCPD, MCTMicrosoft MVP - Telerik MVP No I'm not. I thought viewstate was enabled by default for all server controls. Hi, Do you set the initial src from codebehind? Inside an if Page.IsPostBack equals false test or not? Is the image inside a form tag with runat=server? If not, you have no viewstate. Do...

Javascript losing state on postback HELP!!!
i designed a dual menu using 2 listboxes. the code attached to the buttons to move items from one listbox to the other is client side javascript. this is necessary for speed. my listboxes arent remembering their state on postback. i can understand why. yet posting back every time a user wants to move an item is not an option either. surely there must be some clever way that I can retain my javascript functionality yet still remember the state during postbacks? You need to use a hidden input as a helper field to persist your client-side changes. This will allow you to resbuild the ne...

DropDownlist in Gridview lose data during postback
hi   I have a dropdownlist inside a gridview in Edit template the main problem that it lose data during postback , this ocuures when I bound it to linqdatasource  or when I insert item programatically , I think that the problem is in ViewState , I don't know how to solve If you cannot make thing good m make it looks like good--------------------------------------------------Always remember to click “Mark as Answer” on the post that helps you. Thank you! http://weblogs.asp.net/scottgu/archive/2007/07/16/linq-to-sql-part-5-binding-ui-using-the-asp-linqdatasource-control.aspxB...

Dropdownlist on masterpage loses its state after postback
 Hi,I have a project that uses masterpage. There is a dropdownlist on masterpage that lists categories. When I select a category, it redirects to products.aspx. But after page redirects, the dropdownlist's selected value is always first item. I want it to keep its state and show the selected category as selectedvalue.How can I do this   Hello cagataybalta, Since products.apx is a different page, it has a whole life of it's own.   Don't think of the master page as some sort of global shared control, it's simply a template that makes it easier for all p...

losing state with .net login form
using the default .net 2.0 login form on a site.  when i login, it sends me to a 2nd page in restricted folder with menu set according to role.  When a link is clicked on that menu to redirect to another file in the same folder am getting the ''System.Data.DataRowView' does not contain a property with the name 'ID'.'  error (looks like im sending an empty user value). if i am not logged in and click the same restricted file i had the error with before, i am directed to the login form.  After logging in via this route i am taken back to the pri...

Web resources about - Losing images in GridView on postback - asp.net.state-management

GridView SelectedItem Binding Gotcha in WinRT
Last night when I was doing some WinRT hacking I was trying to setup databinding to the selected item in the GridView control and I ran into ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Advanced Search Gridview Latest News Releases All ...

CNW Group
... Services Beyond the Wire About CNW my CNW CNW Access CNW Directories Financials Webcasts Events my CNW All News Releases Advanced Search Gridview ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Add a Filter Gridview Latest News Releases All Today ...

New CmdLets of Powershell 2.0
New CmdLets of Powershell 2.0

Price Drop: Softbox
... objects- create product reflection- changing the background with something more interestingUse it as:- softbox- honeycomb softbox- gridview ...

Profile.aspx: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Quick Answers - CodeProject
Questions - Free source code and tutorials for Software developers and Architects.; Updated: 25 Oct 2012

DotNetKicks.com - Upcoming stories
DotNetKicks.com is a community based news site edited by our members. It specialises in .NET development techniques, technologies and tools including ...

View Features - ExtendASP
Call 847-681-9827 or Request a Demo View Features Testimonials Pricing About Us Coming Soon ExtendASP exposes every feature, more than any other ...

Resources last updated: 12/31/2015 12:32:08 AM