|
V. wrote: Please explain... I find this hard to believe
If I do:
CON.Open(...); in one function. Do some stuff with it and after eg. leaving the page and doing CON.Close();
it doesn't close?
This seems very hard to believe, ESPECIALLY if I would put my CON object in a Session object??
Now you got me confused...
When you put an object in session, the code is being serialized into xml.
The object is recreated on each postback.
For example
<br />
plubic class TryToPutMeInSession<br />
{<br />
<br />
public TryToPutMeInSession ()<br />
{<br />
}<br />
<br />
}<br />
<br />
Anything that is not disposed of after the postack will stay in memory until the aspnet worker process (aspnet_wp.exe) removes it form memory. You don't have any control of this. Calling the garbage collector certainly won't help for the object is location in another thread.
Edit: you can put the following in session, it needs the serizlizable tag.
For example
<br />
[Serializable]<br />
plubic class TryToPutMeInSession<br />
{<br />
<br />
public TryToPutMeInSession ()<br />
{<br />
}<br />
<br />
}<br />
I didn't get any requirements for the signature
modified on Wednesday, December 19, 2007 11:10:04 AM
|
|
|
|
|
Putting the connection in the session is not going to be your answer, and is really not good practice. If you are able to put the connection into the session to begin with - do you have access to common methods to create and close connections?
|
|
|
|
|
Paddy Boyd wrote: do you have access to common methods to create and close connections?
of course you do...
Paddy Boyd wrote: and is really not good practice
The entire site is bullsh*t and i'm taking this oppertunity to tell my boss to rewrite it asap, but the client ís waiting for a fix like "now".
|
|
|
|
|
Sorry, as in wrapper methods like:
SqlConnection conn;
public SqlConnection GetConnection()
{
conn = new SqlConnection(connString);
conn.open();
return conn;
}
public void CloseConnection()
{
conn.close();
}
I'm guessing not.
The client might be waiting... If the code is as much of a mess as you say it is, then there might not be a quick stopgap fix for this problem. Write a scheduled script to restart the DB every so often...
|
|
|
|
|
That was about what I was planning to propose to my boss. To use the IIS recycler thing or something.
Thanks !
|
|
|
|
|
Well, I was wrong. If you use "In-process" mode of session state it does in fact keep your object in memory.
http://www.informit.com/articles/article.aspx?p=29457&seqNum=4[^]
If you don't use in-process, it stores it as xml.
But regardless, it was a poor choice to code it that way and you should fix it.
I didn't get any requirements for the signature
|
|
|
|
|
It takes a great man to admit a mistake .
Seriously though, don't worry, I really appreciated the help in any way !
(thanks for the link btw)
|
|
|
|
|
Hi
I have a Panel, which contains 'customer information', ie date of order etc. Input is aided by extenders, checkBox, date validation etc. All out of the box microsoft Ajax extenders. Works a treat. I have a close button - which when clicked, fires some javascript to remove the panel from the DOM, and then calls a webservice. The user doesn't care about the webservice, they're just pleased the panel has gone (quickly).
But....removing the panel does not remove the Script that the Ajax library injected into the page. So if they load up the Panel for the same customer, javascript errors are abound saying you can't add the same control twice - for each extender I try and add.
So...how can I, via javascript, remove the script that was added by the extender, or is there a safe way to remove the whole extender, including script, clientside. I really don't want a postback here.
Cheers
Malc
Small angry dogs
|
|
|
|
|
hello frndz.
i am using a dataset. and i want to retrivw value from that.
for that i am using
Textbox1.Text = dsAppData.Tables[0].Columns[0].ToString();
Textbox2..Text = dsAppData.Tables[0].Columns[1].ToString();
where "dsAppData" is the name of my dataset
... well through this i am getting the value.
but here the problem is.
if there are 20values neeed to be retrived from dataset.
the each time when i retrive the value i must use dataset.
so here i think it reduces the perfermance of the application as it hits
the database each time i populate the data from it.
so is ther any other way to retrive data from dataset only using once
means for the first time when we use the dataset we will keep all the requiered value
from it.
plz i need ur suggestion
|
|
|
|
|
DataSet is logical database. you can use it in connection less envirment. so it does not have any direct connection with database.
if you go through the details of ADO.NET , you will see there is connection oriented and connection less mode. and Dataset comes under the connection less mode.
So i think there should not be any performance issue if you use this .
Using DataSets in ADO.NET [^]
|
|
|
|
|
Hi,
Guys anyone having idea about the Tools/ Third party Tools/ Mechanism to utilise already existing Visual Basic Forms into Asp.net Applicaiton.
Here I am explaining Completly:
Using RCW/Com Interop i am able to use the Class and methods. But if a class library contains Windows Forms as well, how can i utilise them.
Any suggestion regarding this will be a great help !
Thanks in Advance.
|
|
|
|
|
You would be much better (and it would probably be a lot easier), to simply re-write your forms in asp.net.
If your code separation has been done well, this shouldn't be a big problem.
|
|
|
|
|
Thanks for your suggestion !
That is the end solution ! Only Web Page creation is not a matter, Lots of events codes are associated with Win Form, so how to deals about that.
|
|
|
|
|
That's unfortunate, it would be handier for you if all that code was abstracted out, but anyway. You will need to rewrite these, if only for the reason that winforms is stateful and asp.net is stateless - i imagine that a lot of your event code will not work because of this.
|
|
|
|
|
Hi All,
I am using CascadingDropDown on my web page and when I click on the save button I have to save all the data into database, which works fine.
But I want to set the values of CascadingDropDown to Select again.
Ex: I have 2 combo and when I say save then these combo's must be set to Select Country and other one to Select State.
Please help me with this.
Thanks in advance....
|
|
|
|
|
I have templatefield in detailsview and I want to hide a particular templatefield on some condition. You are using DataField property of boundfield that is not possible in case of templatefield, so if you have some idea what to do with templatefield then please help me. Any suggestion is welcome. Thanks.
|
|
|
|
|
How do i use an array of HtmlGenericControl. This is how i have tried to use.
HtmlGenericControl objUl = new HtmlGenericControl("ul");
HtmlGenericControl objLi = new HtmlGenericControl[5]("li");
objUl.ID = "nav";
objLi[0].InnerHtml = "First element";
objLi[1].InnerHtml = "Second Element";
objUl.Controls.Add(objLi[0]);
objUl.Controls.Add(objLi[1]);
mainDiv.Controls.Add(objUl);
where mainDiv is a server control. It is giving following error
Cannot apply indexing with [] to an expression of type 'System.Web.UI.HtmlControls.HtmlGenericControl'
Is it correct approach to build html body with an array of HtmlGenericControl? if yes then how do i use it . If no then whjat should be the approach....?please help
|
|
|
|
|
HtmlGenericControl[] objLi = {new HtmlGenericControl(),new HtmlGenericControl(),new HtmlGenericControl(), new HtmlGenericControl(), new HtmlGenericControl()}:
objLi[0].InnerHtml = "First element";
objLi[1].InnerHtml = "Second Element";
modified on Wednesday, December 19, 2007 7:32:47 AM
|
|
|
|
|
except that will fail with Null reference exception as you have not instantiated objLi[0] or objLi[1]
HtmlGenericControl[] objLi = new HtmlGenericControl[5];<br />
objLi[0] = new HtmlGenericControl();<br />
objLi[0].InnerHtml = "First element";<br />
objLi[1] = new HtmlGenericControl();<br />
objLi[1].InnerHtml = "Second Element";
|
|
|
|
|
exactly. I was on a mobile. So became lazy to type !
|
|
|
|
|
Hi,
If the Textbox value is empty then, when i click "Ok" button an alert should display as "Please Enter the value for textbox" and simultaneously i have to display an "*"(Asteristic) only if the textbox is empty. Otherwise don't display.
Please help me..
if(document.getElementById('txtbox').value=="")
{
alert('Enter text value');
return false;
}
-------
<asp:textbox id="txtTickInfo" runat="server"></asp:textbox>
<asp:label id="Asteristic" runat="server" forecolor="Red" text="*" visible="false"></asp:label>
<div class="ForumMod">modified on Wednesday, December 19, 2007 7:04:52 AM</div>
|
|
|
|
|
So what's the problem here ? Why don't you use validation control ?
|
|
|
|
|
yes here i used validation as below you see
if(document.getElementById('txtvalue').value=="")
{
alert('Entertext value');
document.getElementById('Asteristic').style.display="inline";
return false;
}
but it says "Object required".
How can i display the "*"(label control) only if the textbox is null?
|
|
|
|
|
PeriyasamyRamachandran wrote: if(document.getElementById('txtvalue').value=="")
I guess your textbox name is txtTickInfo. Check that
|
|
|
|
|
Your textbox id is txtTickInfo, not txtbox.
|
|
|
|