|
Hi, what s the use of the following command in the top of the coding.
if (!Page.IsPostBack)
Can anyone explain?
|
|
|
|
|
Karthick_gc wrote: what s the use of the following command in the top of the coding.
It can be anywhere, but normally it will be at or near the top of the Page_Load method.
Karthick_gc wrote: if (!Page.IsPostBack)
It runs a section of code conditionall based on whether this page is posted back or not.
IsPostBack is a boolean that returns true if the page is posted back. i.e. the user has already seen the page and has now pressed a button that has caused an HTTP POST request back to the server.
Normally, you need to initialise stuff on the first display of the page, hence the if not IsPostBack. This information would be normally held in viewstate so that on subsequent displays of the page it can retrieve the information from the viewstate and you don't have to repeat the initialisation.
Does this help?
|
|
|
|
|
Hi All,
Can somebody help me to access an XML webservice using Jquery in asp.net 2.0. I have tried googleing, but all the examples are using datetype=JSON which is not working in my project.It will be great if one can help me out to access the same web service by the fastest means but with out using AJAX.
Many Thanks,
D'Kng
|
|
|
|
|
Hi to all,
I am working on a shopping cart project. Now there is a situation that whenever adds the same product again and again, only quantity should be updated instead of adding a new everytime. I unable to do this. I tried like this.
1 protected void Page_Load(object sender, EventArgs e)
2 {
3 try
4 {
5 HyperLink HLink = (HyperLink)Master.FindControl("HyperLink3");
6 if (HLink != null)
7 {
8 HLink.Enabled = false;
9 }
10
11
12 if (!Page.IsPostBack)
13 {
14 if (Session["Cart"] == null)
15 {
16 Lblmsg.Visible = true;
17 dt = new DataTable();
18 dt.Columns.Add("REF", typeof(string));
19 dt.Columns.Add("Description", typeof(string));
20 dt.Columns.Add("QTY", typeof(int));
21 dt.Columns.Add("Price", typeof(float));
22 dt.Columns.Add("Cost", typeof(float));
23 get_data();
24 Session["Cart"] = dt;
25 }
26 else
27 {
28 Lblmsg.Visible = false;
29 dt = (DataTable)Session["Cart"];
30 get_data();
31 update_for_same();
32 Session["Cart"] = dt;
33 }
34 }
35 }
36 catch(Exception ee)
37 {
38 Lblmsg.Text = ee.Message;
39 }
40 }
41
42 public void get_data()
43 {
44 try
45 {
46 pro_id = Request.QueryString["pr_id"];
47 quanti = Convert.ToInt32(Request.QueryString["quant"]);
48
49 if (pro_id != null)
50 {
51 SqlConnection con = new SqlConnection("Server=.; Database=eclsc; Trusted_Connection=yes");
52 SqlCommand cmd = new SqlCommand();
53 cmd.Connection = con;
54 cmd.CommandText = "select ICEMACHINES.product_id,ICEMACHINES.sh_desc,ICEMACHINES.price from ICEMACHINES where ICEMACHINES.product_id LIKE @product_id union select GLASSWARE.product_id,GLASSWARE.sh_desc,GLASSWARE.price from GLASSWARE where GLASSWARE.product_id LIKE @product_id ";
55 cmd.Parameters.Add("@product_id", SqlDbType.NVarChar, 50).Value = pro_id;
56 cmd.Connection.Open();
57 SqlDataReader rdr = cmd.ExecuteReader();
58 ArrayList arRole1 = new ArrayList();
59
60 while (rdr.Read())
61 {
62 desc = (rdr["sh_desc"]).ToString();
63 id = (rdr["product_id"]).ToString();
64 unitprice = Convert.ToSingle((rdr["price"]));
65 cost = unitprice * quanti;
66
67 }
68 cmd.Connection.Close();
69
70 DataRow myrow = dt.NewRow();
71 myrow["REF"] = id;
72 myrow["Description"] = desc;
73 myrow["QTY"] = quanti;
74 myrow["Price"] = unitprice;
75 myrow["Cost"] = cost;
76
77 dt.Rows.Add(myrow);
78 dt.AcceptChanges();
79 Session["data"] = dt;
80 GridView1.DataSource = dt;
81 GridView1.DataBind();
82
83
84 }
85 else
86 {
87 int a = 1;
88 }
89 total_items = total_items + quanti;
90 total_Price = total_Price + cost;
91 Session["items"] = total_items;
92 Session["value"] = total_Price;
93 }
94 catch(Exception ee)
95 {
96 Lblmsg.Text = ee.Message;
97 }
98 }
99
100 public void update_for_same()
101 {
102 try
103 {
104 foreach (GridViewRow rowItem in GridView1.Rows)
105 {
106 count = GridView1.Rows.Count;
107
108 index = rowItem.RowIndex;
109
110 id3 = GridView1.DataKeys[index].Value.ToString();
111
112
113 TextBox TxtQTY = (TextBox)rowItem.Cells[2].FindControl("TxtQTY");
114 Txt2 = Convert.ToInt32(TxtQTY.Text);
115 }
116 }
117 catch(Exception ee)
118 {
119 Lblmsg.Text = ee.Message;
120 }
121 }
But I dont know how to do this. Please assist me.
cheers,
sneha
|
|
|
|
|
sneha Choudhary wrote: only quantity should be updated instead of adding a new everytime.
Datatable has a Select method. You can use it to get a specific product from the datable. If you are getting any rows, update it, else insert a new item.
Don't you think keeping shopping cart information in a session is a bad idea?
|
|
|
|
|
Hi,
Thanks for the reply.
Actually I am very new in web development. So can you please tell me the reason why I should not use session for shopping cart information.
waiting for your reply.
cheers,
sneha
|
|
|
|
|
use hash tables when ur using session for shopping cart
cheers
venu gopal reddy
|
|
|
|
|
Hello Venu gopal reddy,
Thanks for your response.I am too worried for this issue.
You mean to say if I have to transfer certain data from one page to another I should use hash table.
I just want to share certain things with you.
Actually I used session variables to carry the data of datatable to another page.
Is it not safe?
waiting for your reply...
cheers,
sneha
|
|
|
|
|
hi sneha.
recently i worked on shopping cart. i want to share some experience with u
Hash functions are mostly used to speed up table lookup or data comparison tasks — such as finding items in a database, detecting duplicated or similar records in a large file
Hashtable HT2== (Hashtable) Session["basket"];
coming to sessions when ever the session expires u will get error
and even sessions will degrade the performance
regards
venu gopal reddy
|
|
|
|
|
venu656 wrote: hi sneha.
recently i worked on shopping cart. i want to share some experience with u
Hash functions are mostly used to speed up table lookup or data comparison tasks — such as finding items in a database, detecting duplicated or similar records in a large file
Hashtable HT2== (Hashtable) Session["basket"];
coming to sessions when ever the session expires u will get error
and even sessions will degrade the performance
regards
venu gopal reddy
Hi,
Thanks for sharing your views. I want to know a little more about this.
If we will increase the session expiration time then also it will give the error?
I have never used hashtable so I will study it in detail. Thanks for your advice.
cheers,
sneha
|
|
|
|
|
hi,
if u increase the session time the problem will not persist but what i want to expalin is that it is heavy weight ...
|
|
|
|
|
venu656 wrote: hi,
if u increase the session time the problem will not persist but what i want to expalin is that it is heavy weight ...
Hi,
I got your point. Thanks a lot for your help.
Looking forward for the great help in future.
cheers,
sneha
|
|
|
|
|
all the best
feel free to ask
regards
venu656@gmail.com
|
|
|
|
|
I am frequently facing this message from my Web Application hosted at third party server.
Problem description is as below:
Could not load file or assembly 'App_Code' or one of its dependencies. There is not enough space on the disk. (Exception from HRESULT: 0x80070070)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'App_Code' or one of its dependencies. There is not enough space on the disk. (Exception from HRESULT: 0x80070070)
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'App_Code' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace:
[FileLoadException: Could not load file or assembly 'App_Code' or one of its dependencies. There is not enough space on the disk. (Exception from HRESULT: 0x80070070)]
System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +54
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +211
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +141
System.Reflection.Assembly.Load(String assemblyString) +25
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +32
[ConfigurationErrorsException: Could not load file or assembly 'App_Code' or one of its dependencies. There is not enough space on the disk. (Exception from HRESULT: 0x80070070)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +596
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +211
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +46
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +177
System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) +267
System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) +39
System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors) +429
System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +75
System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +582
System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +93
System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +111
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +54
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +31
System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +139
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +128
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +161
Can any one help me out?
Thanks in advance.
|
|
|
|
|
Can you Check the Disk Space and tell us how much is left
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
HI,
it occupies
28743.75 MB of 150000.00 MB ( i.e. only 19.16%) of total disk space is used.
Rgds
Mangal
|
|
|
|
|
Check the Following:
1) missing read/write access on the server
2) That's pretty clearly a disk space error. While your account may have plenty of disk space available, the error might refer to the operating system partition on the machine - since the error occurs when assemblies are being loaded into memory which likely will occur on the OS disk. Your Web space is probably on a different partition than the OS, and there is probably plenty of space there.
3) The resolution for this problem is to removed the some unused files in the server's C drive and now everything is fine.
Hope this Can Help
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
Vuyiswa Maseko thanks for your prompt answer.
Let me check this solution.
Rgds
Mangal
|
|
|
|
|
Well, this[^] was my first hit when I searched.
|
|
|
|
|
I have a .exe file that will be on cilent PC that is push from the server.
after that I want to execute that same file from the server.
is that possible? How am I going to go around doing that?
Thanks
yoshikev
|
|
|
|
|
Only if you make it an active X control, then it can run in the browser. otherwise, no. Are you surprised ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
is there any samples out there ??
all this are to work in the background?
thanks
yoshikev
|
|
|
|
|
There's samples of ActiveX controls, probably not many, given how rarely they are used. They run in the page. Not in the background. If the user changes pages, they stop running.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Writing some new virus delivery code??
|
|
|
|
|
Hello experts
I have a directory in InetPub/WWWRoot/ASPApp/a.asp file with code <%="Hello World"%>
ASPApp is WebShared.
Am getting following error.
------------------------------------------------------------------------------------------------
Error Type:
Active Server Pages, ASP 0223 (0x80004005)
METADATA tag contains a Type Library specification that does not match any
Registry entry.
/ASPApp/global.asa, line 2
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
Page:
GET /ASPApp/a.asp
|
|
|
|
|