|
The CheckBox control has an AutoPostBack[^] property. Set it to true to get the control to initiate a postback when it is clicked. Wire all your checkboxes to the same event handler. When a postback occurs, the sender argument of your event handler will contain a reference to the control that initiated the postback.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks for responding.
I don't need the value of the checkbox (in the sender object). Instead, I need the value of the key field for the row clicked (which is in a hidden field in the GridView control).
Thanks
|
|
|
|
|
On Checkbox_Checkchanged event you can get the handle of the current Gridview row using Sender object, eg.
this.Parent.NamingContainer which is gridviewRow
Postmaster
http://www.programmingknowledge.com/[^]
|
|
|
|
|
Thanks for the help. Got it!
|
|
|
|
|
I need to perform some operations when the browser leaves an ASP.NET page. How can I embed such validation? In other words, is there any event out there that is triggered when the browser leaves the page? (And not Unload, since such event is only triggered when the page is removed from memory.)
Thanks in advance.
Stupidity is an International Association - Enrique Jardiel Poncela
|
|
|
|
|
There is no server side event that can detect when the user leaves a page. Once the page is rendered, the server has no knowledge of the actions taken in the browser.
You can, however, detect when a page is unloaded from client script. Take a peek at the onunload event, especially as it pertains to the document object. If you hook that event, you can make an asynchronous call to the server and perform whatever tasks that you need to.
Hope that helps.
--Jesse "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|
|
Ok, I'll try that OnUnload event thing you mention. Thanks a lot!
Stupidity is an International Association - Enrique Jardiel Poncela
|
|
|
|
|
This is what I have in web.config:
<sessionstate mode="InProc" cookieless="false" timeout="20" />
Also this is the piece of code in all my page_loads after the Login,
Dim emp as Employee = Session.Item("employee")
If emp is Nothing Then
Response.Redirect("Login.aspx")
End if
After like 20 seconds or so, no matter whatever page I am in, if I click a button or something to cause a Postback I am redirected to the Login page. Am I missing something here?
I am using VS 2005, IIS 6.0 (on a remote server)
1. I have checked the server, it shows time out of 20 mins
2. If I add a breakpoint at Session_End event in my Globals.asax its hit after 15-20 secs and Application_End event is hit immediately
Thanks for reading!
|
|
|
|
|
Nobody ha! I posted the same question in the Asp.net forums. Is my problem weird or am I being just plain stupid???
|
|
|
|
|
place the page_load code in page_init event handler
Put the code in an IF statement
IF NOT Page.IsPostBack is Nothing
|
|
|
|
|
Thank you so much for the reply!
1. I already have that IF block and porting that piece of code to Page_Init did not solve my problem.
2. No matter what I do (even if I do nothing/keep causing postbacks), Session_End event in my Global.asax is hit in like 20 seconds or so, EVERY time. I am confused. It used to work well with VS 2003. I have both installed in my PC, btw and my IIS version is 6.0 and I have configured my IIS for this particular project to be of Version 2.0
|
|
|
|
|
Adding something which I think is relevant
My website is under the Default Website group in IIS and when I right-click on the default web sites to view the properties, it shows the ASP.Net version as 1.1 and the new website I am developing is on VS2005 and framework 2.0. Problem, is it?
|
|
|
|
|
can be.
via start->run->cmd
go to cd C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
run aspnet_regiis -i
framework 2.0 is now default.
|
|
|
|
|
If at all anyone else bangs their head for a similar issue, here is the magic wand. Pull out the Event log in the Server box. It showed,
Event Type: Information
Event Source: W3SVC
Event Category: None
Event ID: 1077
Date: 4/3/2008
Time: 11:18:13 AM
User: N/A
Computer: LABHONTS2005A
Description:
A worker process with process id of '11468' serving application pool 'mkasivii2_0' has requested a recycle because it reached its virtual memory limit.
So this thing causes the session to recycle, so you should contact the server people. Hope this helps another frustrated developer
|
|
|
|
|
i am using asp.net 2.0 ,C#
Acually i am facing issue of speed as database server is remote .
I want to know how to fill data asynchronously to one dropdownlist based on other dropdownlist.
Is this approach improve the perfomance
please suggest
Thank you.
regards
imran khan
|
|
|
|
|
mohd imran abdul aziz wrote: I want to know how to fill data asynchronously to one dropdownlist based on other dropdownlist.
You would use ASP.NET AJAX[^] to do this. Information tutorials are available at the address I gave you.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I'm assuming that you are using the ASP.NET AJAX library, and that you're attempting to perform your drop-down manipulation on the client side. If that is the case, then you may wish to have a look at the AJAX Control Toolkit's Cascading DropDown[^] control. If I understand your post correctly, it does exactly what you're looking for.
As to whether it will improve performance or not, that is difficult to say. As with anything performance related, its much wiser to measure and not to speculate.
Hope that helps.
--Jesse "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|
|
|
Guys,
I am having nightmare in figuring out how i can pass the initial search phrase from the seach page to subsequent ascx controls, i can see it appearing on the first ascx control contained in master page, when i load the subsequent ascx control it gets lost, i need to capture the search phrase on first page and keep passing it to as QueryString to other subsequent pages by appending it to the URL of the page.
Can anyone help?
Thanks
happy coding!
|
|
|
|
|
If you are attempting to pass this value around different pages of your application, then you would have to rewrite all urls that the data is relevant to so that they include the query string argument. Unless I misunderstand your intent, what you're actually trying to do is take a value from the query string and treat it as a piece of shared state, across multiple pieces of content in your application. I would recommend that you consider using the ASP.NET Session object, unless your environment makes that prohibitive for some reason.
Hope that helps a bit.
--Jesse "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|
|
make sure that within your application where ever you are redirecting to some other page you url with query string is not overwritten. make sure you are passing the query string parameter as well.
Faraz Shah Khan
MCP, MCAD.Net
Blog
|
|
|
|
|
I have this piece of code which is called everytime to check for session- when the application starts and before every page is displayed.
if(Context.Session != null)
{
if(Session.IsNewSession)
{
string _sCookieHeader = Request.Headers["Cookie"];
if((_sCookieHeader != null) &&(_sCookieHeader.IndexOf("ASP.NET_SessionId") >= 0))
{
Response.Redirect("SessionExpire.aspx");
}
}
}
else
Response.Redirect("SessionExpire.aspx");
It works fine everywhere except for production server where it always takes me to SessionExpire page. I have checked the cookie settings and its the same on production server as others. I would appreciate if someone could tell me what can I do to fix it on that server. Is it that Context.Session is always null or something with the cookies?
Thanks
|
|
|
|
|
Is there some specific reason you aren't using Session.Start in the Global.asx file?
led mike
|
|
|
|
|
My first page is a login page and when user logs in, I want to start a session and keep track of it afterwards. If I use Session.Start in global.asax file, it will create a session as soon as the application starts. Is that correct??
|
|
|
|
|
No, Session.OnStart or whatever it's called is executed on a new session. the Application.OnStart or whatever it's called is for when the applications starts.
led mike
|
|
|
|