Hi, The problem is I am trying to declare "protected DataSet universeSet = new DataSet();" in my C# page behind the asp page. The variable is declared on the top of the page. I want the information to be stored inside the variable universeSet so I can retrieve it for later use.
Whenever I click a button on my webpage (asp:Button or asp:ImageButton ), the information in universeSet seem to be erased, I think this is because it is reloading the C# page, which the line "protected DataSet universeSet = new DataSet();" declares a fresh DataSet with no information inside.
How can I avoid reloading the variable, I can't take out " = new DataSet();" or I will get NullPointerExce ption.
Thank you.
2 3938
Hi, The problem is I am trying to declare "protected DataSet universeSet = new DataSet();" in my C# page behind the asp page. The variable is declared on the top of the page. I want the information to be stored inside the variable universeSet so I can retrieve it for later use.
Whenever I click a button on my webpage (asp:Button or asp:ImageButton ), the information in universeSet seem to be erased, I think this is because it is reloading the C# page, which the line "protected DataSet universeSet = new DataSet();" declares a fresh DataSet with no information inside.
How can I avoid reloading the variable, I can't take out " = new DataSet();" or I will get NullPointerExce ption.
Thank you.
hi friend,
just try with
" Protected static DataSet xxx= new DataSet();"
you may get ur need
Prabu
Wow thank you! It really did work! It's just a tiny code and was able to fix it, you're amazing, thanks.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: lsf_80 |
last post by:
I am using ASP.net and C# as code behind.
I wrote one function in the "page load" (code behind) and how can i call
back the variable in the aspx page?
Thank you.
if i put response.write, error message prompted: "WebService1.WebForm10.aa'
is inaccessible due to its protection level"
|
by: Alex |
last post by:
I'm having a problem porting an ASP solution to ASPX.
In the ASP solution I'm accessing a DCOM server, create sub DCOM objects and
call functions from VB script on the ASP pages.
The DCOM object handles are stored in session variables.
This works fine without a problem.
Ported it to ASPX, accessing the same DCOM server from code behind pages.
Still, usually no problems.
However sometimes I'm seeing an error stating that the DCOM handle...
|
by: Bob T |
last post by:
Hi All,
I am trying to pass a variable from my VB asp.net script (from for example
Sub Page_Load in mypage.aspx.vb) to my Client side script.
I have found and looked at a very good example "Client and Server Scripting
in Web Pages" but it only shows server side scripting that is written in
HTML in mypage.aspx and not script from mypage.aspx.vb. How can I pass a
variable value from mypage.aspx.vp to my client side script?
|
by: Machi |
last post by:
let say i have a web form with a button on it ... when i click the button, it will pop up one small window to allow me to save a pdf file, everything is done using code behind as below ... however, in javascript, i have set a global variable as a flag to indicate the number of times user click the buttion (let say flagNoOfClick), when user clicks the button once, it will set the flag (flagNoOfClick) to "true" (by using javascript). So, when user...
|
by: Ryan Taylor |
last post by:
Hi.
I need to be able to access a public code behind variable within my ASPX
page. The reason is that I have a user control "Header" which defines a
table layout, and is included in all my pages, at various levels in the
website heirarchy. The table requires a background image. My images folders
is at the root of the website, effectively "~/images/". I need the
background image to show whether I at a page in the root of my website or in...
| |
by: rbutch |
last post by:
does anyone know of a good place to go to get some ideas on datalists?
im building a web app, in asp.net (vb.net) and displaying data in a data list.
i want to be able to select any one of the first column items with a "onclick" and store the 'literal' in a variable (either session or global)
at this point i'm not picky at all.
ive tried using the OnItemCommand="someProc" in the code behind w/out much luck
any help is appreciated....
|
by: Alan Silver |
last post by:
Hello,
I am just looking at VWD and seeing what needs doing to take an existing
site I've written by hand and importing it into VWD. I've already
discovered that I need to rename my code-behind files to match the .aspx
file name so VWD will tie the two together, and I'm now wondering what
to do about the location of the code-behind files.
Is there any set convention for where the code-behind files live? I have
been putting them in the...
|
by: Pierre |
last post by:
Hello,
In an aspx page (mypage.aspx) from a web projet,
I would like to get the value of a variable of the projet that is declared
as public in a module.
The variable can be called from anywhere in the code behind page and in the
class files, but when I try to call it from an aspx page, it raises an
error.
<%=myvar%> in mypage.aspx raise an error : the name "myvar" is not declared.
|
by: kelvinweb |
last post by:
Hi All,
Is it possible to using variable store container.dataitem in
ItemTemplate ??
For example.
<ItemTemplate>
<%
Dim x
x = container.dataitem("LineNo")
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |