Web Forms :: What Gets Executed During A Postback?
Mar 10, 2011I want to know if my variable "thepass" gets reinitialized each time there is a postback? code as follows:
[code]...
I want to know if my variable "thepass" gets reinitialized each time there is a postback? code as follows:
[code]...
I have problem with user control: MyCollection : UserControl
MyCollection contains:
[code]....
Works fine unless I register event for some button:
button1.Click += ...
When click on button, nothing happens - page does postback, refresh but event handler method is not executed. Generated HTML is bit strange. Every page control has correctly generated ClientID including parent container ID.
Button in this collection MyCollection has odd ClientID - itemsAddresses$button1
I've read that OnClick is executed on the server and onClientClick is executed on the client. Is it better to use OnClientClick to do something like close a modal popup?
If my understanding is correct then this would avoid a trip to the server to accomplish the same task. This would be great for something that doesn't need to make a round trip to the server and back.
I've reated a project containing 15 pages , (inculding one for logging in )well , i've noticed that actions located in the page_load function are not executed! (i've tested with changing the text of a label and a text box) and it's in all pages except the authentification page!i've read tht it's probably due to the DATETIME class used in pages. but is there any other explanation? or is there any way to fix the problem
View 3 RepliesPageMethod which supposed to be called/executed when "onChange' of dropdownlist is triggered is Not being executed. I have 3 dropdownlist being created at runtime/dynamically inside a compositecontrol class and loaded (.dll) in a page at runtime. I have added a scriptmanager in the master page and set EnablePageMethods to true, tried placing the webmethod function outside of the compositecontrol and in the page, still webmethod is not being called... Anyone has idea or solution to this problem of mine? Or another approach to retain the selected value of the dropdownlist inside this compositecontrol (.dll) that is being loaded in a page at runtime?
[Code]....
Can i run all validators when page is loaded. I need to show * in all input text fields that are necessary. I have require field validators for that fields, can i run it by default when page is loaded?
View 3 RepliesI have a page which allows the user to send email. After they click the submit button, I display a confirmation message. However, if the user clicks the browser's Refresh button once the confirmation message is displayed, the email is sent a second time (or a third, fourth, fifth, etc.). What can I do to prevent the Refresh button from resending the email?
View 6 Replies[Code]....
i am trying to do this is Global.asax file. but this method is not executed when the browser closes. or am i doing something wrong?
I have some problem with the custom validtor, I do validate at both client side & server side, and i have noticed that the client side code has been executed when I clicked Submit..
More details:
The page contains some Text boxes & one submit button, and all is client-server validated, the problem that when the end user selects the file path through browse control, the code will auto-fill in the file name textbox, and it gives the option to edit; The code which is doing this in the custom validtor client handler, here is the problem it is on_submit click handler, the script function has been called again....!
I have no idea if this is the correct behavior, But I don't want the script code to be executed when any server events fired... !
i have the code for asynchronous call to the database. i execute the sql command into the begin method that will executed onto the separate thread. now i want to execute the another database call asynchronously so that this also execute onto the separate thread. code for one database cal is here....
private SqlConnection con, con1;
private SqlCommand cmd, cmd1;
private SqlDataReader dr, dr1;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
AddOnPreRenderCompleteAsync(new BeginEventHandler(Begin),
new EndEventHandler(End)
);
}
}
/////////////BEGIN METHOD
IAsyncResult Begin(object sender, EventArgs e,AsyncCallback cb, object state)
{
string connect = "Data Source=.\SQLEXPRESS;Asynchronous Processing=true;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True";
con = new SqlConnection(connect);
con.Open();
cmd = new SqlCommand("SELECT FirstName,LastName,Age,Company,Profile FROM Person",con);
return cmd.BeginExecuteReader(cb, state);
}
//////END METHOD
void End(IAsyncResult ar)
{
dr = cmd.EndExecuteReader(ar);
Label2.Text = System.Threading.Thread.CurrentThread.GetHashCode().ToString();
GridView1.DataSource = dr;
GridView1.DataBind();
}
Why code <%= System.DateTime.Now.ToLongDateString() %> is not executed in ASP.NET.
<input class="input" name="url" id="url" type="text" runat="Server" style="width: 650px" onblur="this.value='<%= System.DateTime.Now.ToLongDateString() %>'" />
I have a web application developed in VS 2008. On a form, I have a <select> control that looks like this:
Code:
<select id="lstreports" class="width_280" size="1" name="lstreports" onserverclick="DisablePrintSchedule()" runat="server">
When make a selection from this control, the script DisablePrintSchedule() should fire but it doesn't. Below is my Javascript.
Code:
<script type="text/javascript">
function DisablePrintSchedule(){
alert('Made it here!');
var btn = document.getElementById('btnPrintSchedule');
[Code] ....
The first Alert isn't even executing. Is there anything I need to do in the code behind like Register the script?
I'm having some problems with the module urlrewriter.net for ASP.NET.I have a multilingual site with a URL like this;
~/home.aspx
To support languages I use this rewrite rule;
<rewrite url="~/de-DE/(.*)" to="~/$1"></rewrite>
Then in my code I get the de-DE part and set the right culture for the current thread. All of this works well.After I login on the website I get a message "Hello, user x" to show i'm logged in. When navigating to another page, it doesn't display this message anymore and it seems like the page comes from the cache or something with the old (not logged in) data. Also, when I attach the debugger, nothing is executed for this request. If I visit the page like ~/home.aspx instead of ~/de-DE/home.aspx, does problem does not occur.
Open new popup window without address bars in firefox & IE
I have the following code which works in ie(no addressbar, status bar, etc but not firefox..
function popUpDetails(trackNum) {
var newWindow = (window.open('popUpDetails.aspx?trackNum=' + trackNum, 'Title', 'width=540,height=265, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no, modal=no'));
}
I need to insert values from the frontend into a mysql table. I am using a 3 layer architecture. the below is the code that is written in my dataaccess layer. the query is not being executed.
public int Insert(List<EmployeeUInfo> objInsert)
{
try
{
DataTable dtInsertRow = new DataTable();
[Code]....
I have a nested ListView (Master/Detail) questionaire that was described in this posting: The inner list item must call a server method with three arguments. Thanks to several of you, I have code that properly generates the JavaScript; however, that code is not actually firing. Here is the declaration of the inner list view:
<asp:ListView ID="lstAnswers" runat="server" DataKeyNames="QuestionID" OnItemDataBound="lstAnswers_ItemDataBound">
<LayoutTemplate>
[code]...
Code:
01.If InStr( Request.ServerVariables("HTTP_REFERER"), "google") > 0 Then
KeyURL = Request.ServerVariables("HTTP_REFERER")
' Remove all up to q=
KeyLen = Len(KeyURL)
kStart = InStr( KeyURL, "q=" )
kStart = kStart + 1
KeyRight = KeyLen - kStart
Keyword = Right( keyURL, KeyRight )
[code]...
I have problem on page bellow, in gdvCar_DataBound I add three buttons, when I click on any of them, page go to postback but doesn't enter in gdvCar_RowCommand and then that buttons ( and images that I also add in gdvCar_DataBound) disaper. Grid is then full like gdvCar_DataBound isn't execute. My question is why it doesn't enter at gdvCar_RowCommand ?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HMS.library;
using System.Data.SqlClient;....................
Can i run all validators when page is loaded. I need to show * in all input text fields that are necessary. I have require field validators for that fields, can i run it by default when page is loaded?
View 2 RepliesCan ASP.NET Programs be executed with VISUAL BASIC Coding?
View 4 RepliesIs there anyway to capture the command the Gridview is executing for later use? I have gridview that uses parameters from a few textboxes, so its generating a custom statement. I am wondering is there anyway for me to get that statement either during or after it is executing it, and then returning the results. I need to save it, so that I can populate a CSV file with the data that was returned?
View 2 RepliesHow do I output/log the sql being executed behind the scenes by the Entity Framework in an asp .net mvc application? In my case I'm using a Sql Server 2005 database.
I found this question Linq to Sql logging, but I'm trying to figure out how to do this with the entity framework v1 and asp .net mvc 1.0.
I am implementing a CustomAuthorizeAttribute. I need to get the name of the action being executed. How can i get the name of current action name getting executed in the AuthorizeCore function which i am overriding?
View 1 RepliesI have an .aspx page. I populate a public variable in the code behind (.cs) page and then access that variable in JS on client side. I have the script declared after the FORM tag as below.
<body>
<form>
...
</form>
<script language="javascript" type="text/javascript">
debugger;
var data = "<%=cSharpData%>";
</script>
</body>
After postback this script does not get executed first time, but when I click on any other server button on the page, then it gets executed.
I'm new to web development so I'm not sure what's the best option for the problem that I'm having.Basically I have a web application that calls a web service for processing some data.This process may take a long time (hours) and I would to know if there is an easy way to send some status information to the client from time to time.Right now, the client makes the request from the browser and it just waits there until it finishes.
How can I send some information from the web service? I would like to send a percentage and some additional text specifying what is being done.