473,382 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

retaining values after postback

Hi,

im using asp.net with c#.In my form i have a list of html radio button group in which if i select one,a text box and an image is loaded .This i have done thro. javascript.but in the same page im uploading another image.that image is displayed on a button click.so the page refreshes and the first image disappears.To retain this i again wrote a javascript on the same button click which tests the checked radio button and loads the text box and image again.The javascript function is working fine but the image disappears after the server side function execution.I changed the call from onclick to onblur of the button.But same result.can any one help me on this issue?



This is the function i have written for retaining the image

function preview2_retain()
{
var i;
for(i=0; i < document.getElementsByName("rbnationalfranchise"). length; i++)
{
if(document.getElementsByName("rbnationalfranchise ")[i].checked==true)
{
document.getElementById("txtTeamName").value=docum ent.getElementsByName("rbnationalfranchise")[i].value;
document.getElementById("txtTeamName").readOnly=tr ue;
document.getElementById("imgLogo").setAttribute("s rc","some path" + document.getElementsByName("rbnationalfranchise")[i].value + ".jpg");
}
}
}

and i have called this function like this on pageload

BtnPreview2.Attributes.Add("onblur", "preview2_retain();");
Oct 23 '08 #1
1 3753
nateraaaa
663 Expert 512MB
Instead of using javascript you may want to consider using a Session variable. The Session value will persist on postback. You can have an event that sets the Session variable value then on postback check to see if the Session variable is != null.

Nathan
Oct 23 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: JC | last post by:
Hi, I am a novice at .net and have created a page of text boxes that are populated from a database. I want the user to be able to change the values in the box then submit the page and have these...
0
by: Earl Teigrob | last post by:
I have a page that reads values from an XML file to display to the user. The page also has a control panel that allows administrators to update the XML file with new values. When an administrator...
2
by: Elliot M. Rodriguez | last post by:
I am not sure how to implement this. I have a DataGrid which is bound to a DataSet that the user creates by adding items from a dropdown box on my page. When the dropdownlist item is selected, a...
2
by: cFleury | last post by:
This system works in a intranet w/ some 200 stations and this particular form is retaining its values among different stations...like if I enter some values in the form on station 1 walk to station...
1
by: Scott H | last post by:
I have a page with several server controls placed on there at design time, including a blank table control. During runtime I add some controls to the table, including some checkboxes, which I...
4
by: Jeremy Jones | last post by:
I am currently building a custom combobox server control. I have followed pretty much any example, yet my textbox does not retain the data after postback. my LoadPostData function being fired...
3
by: =?Utf-8?B?ZGVuIDIwMDU=?= | last post by:
Hi, Trouble in retaining values of dropdownlist, textboxes, and other controls when dropdownlist selectedindexchanged event is triggered, the controls are inside a user control and this user...
5
by: PokerMan | last post by:
Hi I have 6 variables that i want to keep after a postback. I have achieved it by making them static, is this correct procedure? Thanks
2
by: Gabriel Pineda | last post by:
hi, i'm creating a table with rows on runtime. the rows are added through some option on the page (not from db). but when i do a postback a miss the info. how could i retain that info? please...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.