|
You're not going to find a way to delete a table when the browser is closed. Well, you may be able to trigger something with javascript, but I'd look to improve the design. Why do you need to creat temporary tables ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I am using the temp table for employee search. Initially i create a temp table,fill it with all employees and then work out on each emp search condition selected by user such as grade,dept and keeping only those tuples which satisfy the condition and delete all other and show the results in a datagrid.At the end when the user logs out or closes the window the table should be deleted. I appreciate ur concern but i can`t change the design.
|
|
|
|
|
OK, the design sounds terrible, good luck with it.
Your best bet is to create a table that stores employees with a key such as the session ID, and deletes them after a timeout, rather than hoping to catch when the browser is closed. This would mean one table, no temp tables, which is at least an improvement.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
http://ashishware.com/AJAXTT.shtml
Source code and some write up on creating AJAX tooltip for ASP.NET DatagridView.
Can be used with DataGrid(asp.net v1.x) with minor modification.
Hope u find it useful
|
|
|
|
|
This is a forum for questions. If you want to submit code, write an article for the site. No-one will ever find this post after tomorrow, when it's buried in questions.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I am fairly new!
My prob. is this
i have a some listboxes which i populated from a table.
Now in the "submit" button i have written an approproate code to insert the selected items to a table.
but what happens is, irrespective of the value i select, the first item gets inserted into the table ...
here is the code ... plz tell what's stupid in this!
---------------------------------------------------------------------------
private void Page_Load(object sender, System.EventArgs e)
{
if (!this.IsPostBack)
{
me = new common();
ds = new DataSet();
conn = new SqlConnection(me.conString);
sda = new SqlDataAdapter("select * from users",conn);
sda.Fill(ds,"users");
projman.DataSource = ds.Tables["users"].DefaultView;
projman.DataTextField = "username";
projman.DataBind();
projman.SelectedIndex = -1;
devlead.DataSource = ds.Tables["users"].DefaultView;
devlead.DataTextField = "username";
devlead.DataBind();
devlead.SelectedIndex = -1;
testlead.DataSource = ds.Tables["users"].DefaultView;
testlead.DataTextField = "username";
testlead.DataBind();
testlead.SelectedIndex = -1;
devteam.DataSource = ds.Tables["users"].DefaultView;
devteam.DataTextField = "username";
devteam.DataBind();
devteam.SelectedIndex = -1;
testfocal.DataSource = ds.Tables["users"].DefaultView;
testfocal.DataTextField = "username";
testfocal.DataBind();
testfocal.SelectedIndex = -1;
sqefocal.DataSource = ds.Tables["users"].DefaultView;
sqefocal.DataTextField = "username";
sqefocal.DataBind();
sqefocal.SelectedIndex = -1;
}
string pgmsg = Request.QueryString.Get("qmsg");
if (!(pgmsg==null))
{
if (pgmsg.Equals("exists"))
{
msg.Text = "The project ID or name exixts already, please enter different value!";
}
}
else
{
msg.Text = "";
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.submit.Click += new System.EventHandler(this.submit_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void submit_Click(object sender, System.EventArgs e)
{
Response.Write("")
string proid;
proid = domain.SelectedValue + "_" + subdomain.SelectedValue + "_" + projname.Text;
bool projExists = me.chkProj(proid);
if (!projExists)
{
projExists = me.chkProj(projname.Text);
}
else
{
Response.Redirect("newproj.aspx?qmsg=exists");
}
if (!projExists)
{
string userid;
string role;
string type;
string cmdText = "insert into " + Global.project + " values ('" + domain.SelectedValue + "','" + subdomain.SelectedValue + "','" + proid + "','" + projname.Text + "')";
conn = new SqlConnection(me.conString);
com = new SqlCommand(cmdText,conn);
com.Connection.Open();
com.ExecuteNonQuery();
com.Connection.Close();
me.attachUser(projman.SelectedItem.Value,proid,Global.projectmanager);
me.attachUser(testlead.SelectedItem.Value,proid,Global.testlead);
me.attachUser(devlead.SelectedItem.Value,proid,Global.devlead);
Response.Write(projman.SelectedItem.Value);
}
else
{
Response.Redirect("newproj.aspx?qmsg=exists");
}
}
}
-venkat
|
|
|
|
|
dravidan wrote: projname.Text + "')";
You're begging for a SQL injection attack here. You should read up on them. A better way to go is to sanitise all strings and use stored procs.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
That is not the code that you are running. It won't even compile.
Please show the real code. I don't want to look for errors in code that isn't even used.
---
single minded; short sighted; long gone;
|
|
|
|
|
Forget the code for a moment, can you plz tell how to save all the details of a listbox(details such as the currently selected index), say list1, in a place so that when a postback occurs i can reload the listbox list1, with the saved values.
the code compiles properly, but when a post back occurs, an obvoius error pops up, because of the fact that i only populate the listboxes on first load.
i suspect the error must be either in the load event or the click event thats why i posted em.
why do u say that this code wont compile?
plz help me out!
-venkat
|
|
|
|
|
You can only load the data on first load, precisely because if you reload it, you throw away your viewstate info, including the selected item. You get all this info for free, so long as you've not turned off viewstate. If you have, then you won't get it, and you won't have it to save anywhere else, either.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
dravidan wrote: why do u say that this code wont compile?
I presume he copied it into an empty project and attempted to compile it. Either that or he was astute enough to spot a compiler error by looking at the code posted.
|
|
|
|
|
dravidan wrote: Forget the code for a moment, can you plz tell how to save all the details of a listbox(details such as the currently selected index), say list1, in a place so that when a postback occurs i can reload the listbox list1, with the saved values.
Unless you turned off viewstate, the listbox will take care of that itself.
the code compiles properly
Then you should post that code.
dravidan wrote: i suspect the error must be either in the load event or the click event thats why i posted em.
Eh... no, you didn't. At least not the same version as you were using.
dravidan wrote: why do u say that this code wont compile?
Because it won't.
Look at the first line in the submit_Click method. Can you see why that won't compile?
---
single minded; short sighted; long gone;
|
|
|
|
|
please tell me how can i unzip the zip files ...
Feoze
|
|
|
|
|
Please don't cross post.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i set the maxRequestLength property in web.config to recieve files larger than 4 MB but when i upoload online, after some time page timeout messages display.... help me please.....
Feroze
|
|
|
|
|
You already have a thread about this. There is no need to start another thread about the same thing the same day.
---
single minded; short sighted; long gone;
|
|
|
|
|
I have datagrid on asp.net page.On page load the page fetch data from mssql database and bind it to the datagrid. There is one unusual problem.ie, "undefined" is displayed on all the rows and columns of the datagrid occassionally.
Please give me some hint to solve this panic problem.
Thanks for your valualbe information.
tprkash
|
|
|
|
|
Hi,
Does this "undefined" displayed on post back ?
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
Yeah."undefined" is displayed on post back.
tprakash
|
|
|
|
|
Hello,
I have a string that holds a number (sum of money).
To format the string as a currency I us:
string.format("{0:$#,##0.00}",Convert.ToDecimal(myObj.tostring()));
The problem is that if the number is negitive it saw as:
10,123- (the minus is from the right)
and I like it to be:
-10,123 (the minus from the left of the number).
How can I format it like this?
Thanks.
|
|
|
|
|
Are you saying that if it goes in as -10123 it comes out as 10,123-?
Is you culture setting affecting the placement possibly? I just tried this with VB.NET and it returns -$10,123.00.
If you have to just rework it then do a simple replace like this:
If strTest.IndexOf("-") = strTest.Length - 1 Then<br />
txtTest.Text = strTest.Replace(strTest, "-" & strTest.Remove(strTest.Length - 1, 1))<br />
End If
Cleako
|
|
|
|
|
When I restart the IIS for sometime I notice the following error when i try to access the web applications deployed on the IIS.
Error message from the Event Viewer:
The description for Event ID ( 1003 ) in Source ( ASP.NET 1.1.4322.0 ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event: 6092, 180.
Problem magically disappear after 15-20 mins and things work just fine. It looks like IIS can catch hold of ASP.NET framework for 15-20 after restart.
Can someone help please?
I want solve this stupid problem.
Global warming
|
|
|
|
|
Hello,
I'm a newbie trying to insert a quick-and-dirty Javascript email form in an .aspx page. For some reason, trying to execute the form returns a "Object reference not set to an instance of an object" error. Will the Javascript only work in a regular .html page, or can ASP.NET controls and Javascript play well together?
Any help or advice would be much appreciated. For reference, the javascript inserted is:
Header:
<[CODE]script name="JavaScript">
[/CODE]
Body:
[CODE]
Name | | E-mail | | Your message:
|
[/CODE]
|
|
|
|
|
The script is trying to set the location of the parent window. Does the window have a parent window?
After setting the location, the form will also be posted to the server. Is this intentional?
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks very much for replying.
I grabbed that code off of some site online; I have no idea why it was trying to do that. I read more about Javascript, and then realized it was sort of insane to use it on a .NET site when returning forms was one of the functions ASP.NET was made for in the first place...
Thanks again!
|
|
|
|