|
Comments and Discussions
|
 |
|

|
<a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyId=9F783224-9871-4EEA-B1D5-F3140A253DB6&displaylang=en">http://www.microsoft.com/downloads/en/details.aspx?FamilyId=9F783224-9871-4EEA-B1D5-F3140A253DB6&displaylang=en</a>[<a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyId=9F783224-9871-4EEA-B1D5-F3140A253DB6&displaylang=en" target="_blank" title="New Window">^</a>] <a href="http://www.mssqltips.com/tip.asp?tip=1690">http://www.mssqltips.com/tip.asp?tip=1690</a>[<a href="http://www.mssqltips.com/tip.asp?tip=1690" target="_blank" title="New Window">^</a>] <a href="http://www.mssqltips.com/tutorial.asp?tutorial=226">http://www.mssqltips.com/tutorial.asp?tutorial=226</a>[<a href="http://www.mssqltips.com/tutorial.asp?tutorial=226" target="_blank" title="New Window">^</a>] <a href="http://www.mssqltips.com/tutorial.asp?tutorial=222">http://www.mssqltips.com/tutorial.asp?tutorial=222</a>[<a href="http://www.mssqltips.com/tutorial.asp?tutorial=222" target="_blank" title="New Window">^</a>]
-- Modified Monday, May 2, 2011 11:15 AM
|
|
|
|

|
Hi ,
I am submitting a html form in ASP.NET 1.1, to a websphere server. I am browsing excel file and submitting through ActiveX object to Websphere server, by sybmitting form with action as Websphere hosted address.
Whenever I login to app, and try to upload the file with above functionality, for the first time, I get redirected to Login.aspx automatically. But when I re-login again and does the same thing as above, the file is uploaded successfully.
Can you please help me regarding this, as I have maintained releative values of timeout for session and form-authentication in web.config file.
- Ajay K
|
|
|
|

|
///////////////////////////////////////////////////////////////////////////////////// #include <iostream> string StringToUpper(string); string StringToLower(string); int main(){ string strInput = "UPPER TO LOWER:ABC"; string strOutput = StringToLower(strInput); cout << strOutput; cout << "\n"; strInput = "lower to upper:xyz"; strOutput = StringToUpper(strInput); cout << strOutput; return 0; } string StringToUpper(string strToConvert) { //change each element of the string to upper case for(unsigned int i=0;i<strToConvert.length();i++) { strToConvert[i] = std::toupper(strToConvert[i]); } return strToConvert;//return the converted string } string StringToLower(string strToConvert) { //change each element of the string to upper case for(unsigned int i=0;i<strToConvert.length();i++) { strToConvert[i] = std::tolower(strToConvert[i]); } return strToConvert;//return the converted string } ------------------------------------------------------------------------------------- Output: upper to lower:abc LOWER TO UPPER:XYZ -------------------------------------------------------------------------------------
------------------------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////////////// #include <iostream> int main () { int n; cout << "Enter length: "; cin >> n; cout << endl; for (int row=0; row<=n; row++) { for (int col=n; col>row; col--) { cout<<'*'; } cout << endl; // end the line. } return 0; } ------------------------------------------------------------------------------------- Output: Enter length: 6 ****** ***** **** *** ** * |||||||||||||Test With Different Inputs|||||||||||||||||||| Enter length: 5 ***** **** *** ** * ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////////////// #include <iostream> int main () { string strInput; cout << "Enter alphabets in sequence i.e., (ABCDEFG): "; cin >> strInput; cout << endl; for (unsigned int row=0; row<strInput.length(); row++) { for (unsigned int col=0; col<=row; col++) { cout<<strInput[col]; } cout << endl; // end the line. } return 0; } ------------------------------------------------------------------------------------- Output: Enter alphabets in sequence i.e., (ABCDEFG): "; ABCDE A AB ABC ABCD ABCDE |||||||||||||Test With Different Inputs|||||||||||||||||||| Enter alphabets in sequence i.e., (ABCDEFG): "; ABCDEF A AB ABC ABCD ABCDE ABCDEF -------------------------------------------------------------------------------------
------------------------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////////////// #include <iostream.h> int main() { int a, b, c, e, n=4, t=1, m=0; for (a = e = 1; a<=n; e++, n--) { for (b = 1; b<n; b++) cout << " "; for (c = 1; 2*e - 1 >= c; c++) { if(c<=1) { m++; cout << m; } else { if(t==0) { m++; cout << m; t=1; } else { cout << " "; t=0; } } } cout << endl; } return 0; } ------------------------------------------------------------------------------------- Output: 1 2 3 4 5 6 7 8 9 10 ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////////////// #include <iostream.h> int main() { int a, b, c, e, n=4, t=1, m=0; for (a = e = 1; a<n; e++, n--) { for (b = 1; b<n; b++) cout << " "; for (c = 1; 2*e - 1 >= c; c++) { if(c<=1) { m++; if(m==4) { cout << " "; } cout << m; } else { if(t==0) { if(m<=3) { m++; cout << m; t=1; } } else { cout << " "; t=0; } } } cout << endl; } return 0; } ************************************************************************************ Another Solution ************************************************************************************ #include <iostream> int main () { cout << " 1 "; cout << endl; cout << "2 3"; cout << endl; cout << " 4 "; return 0; } ------------------------------------------------------------------------------------- Output: 1 2 3 4 ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////////////// #include <iostream.h> int main() { int num1,num2,num3,largeNum; cout << "Enter first number: "; cin >> num1; cout << "Enter second number: "; cin >> num2; cout << "Enter thirld number: "; cin >> num3; if(num1>num2) { if(num1>num3) largeNum=num1; else largeNum=num3; } else { if(num2>num3) largeNum=num2; else largeNum=num3; } cout << "Large number is: "; cout << largeNum; return 0; } ------------------------------------------------------------------------------------- Output: Enter first number: 1 Enter second number: 2 Enter thirld number: 3 Large number is: 3 ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////////////// #include <iostream.h> int main() { string str1,str2,str3; cout << "Enter first string: "; cin >> str1; cout << "Enter second string: "; cin >> str2; cout << endl; // end the line. cout << "Frist String: " + str1; cout << endl; // end the line. cout << "Second String: " + str2; str3=str1; str1=str2; str2=str3; cout << endl; // end the line. cout << "After copy:"; cout << endl; // end the line. cout << "Frist String: " + str1; cout << endl; // end the line. cout << "Second String: " + str2; return 0; } ------------------------------------------------------------------------------------- Enter first string: A Enter second string: B Frist String: A Second String: B After copy: Frist String: B Second String: A ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////////////// #include <iostream.h> int main() { string str1,str2; cout << "Enter first string: "; cin >> str1; cout << "Enter second string: "; cin >> str2; cout << endl; // end the line. cout << "Frist String: " + str1; cout << endl; // end the line. cout << "Second String: " + str2; cout << endl; // end the line. cout << "After Concatenation:"; cout << endl; // end the line. cout << str1 + str2; return 0; } ------------------------------------------------------------------------------------- Output: Enter first string: A Enter second string: B Frist String: A Second String: B After Concatenation: AB ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////////////// #include <iostream.h> int main() { float radius,pi=3.1416,output; int choice=2; cout << "Enter radius of circle: "; cin >> radius; cout << "Enter your choice: Area=0, Perimeter=1: "; cin >> choice; switch(choice) { case 0: output=pi*radius*radius; cout << "Area: "; cout << output; break; case 1: output=2*pi*radius; cout << "Perimeter: "; cout << output; break; default: cout << "Wrong Choice !"; break; } return 0; } ------------------------------------------------------------------------------------- Output: Enter radius of circle: 3 Enter your choice: Area=0, Perimeter=1: 0 Area: 28.2744 |||||||||||||Test With Different Inputs|||||||||||||||||||| Enter radius of circle: 3 Enter your choice: Area=0, Perimeter=1: 1 Perimeter: 18.8496 |||||||||||||Test With Different Inputs|||||||||||||||||||| Enter radius of circle: 3 Enter your choice: Area=0, Perimeter=1: 2 Wrong Choice ! ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////////////// #include <iostream> int main () { int n; string bline; cout << "Enter square side length: "; cin >> n; cout << endl; // end the line. for (int i=1; i<=n; i++) { cout<<"* "; bline+="* "; if(i==n) { cout << endl; // end the line. for (int j=1; j<=n-2; j++) { cout<<"* "; for (int k=1; k<=n-2; k++) { cout<<" "; } cout<<"* "; cout << endl; // end the line. } cout << bline; } } return 0; } ------------------------------------------------------------------------------------- Output: Enter square side length: 5 * * * * * * * * * * * * * * * * |||||||||||||Test With Different Inputs|||||||||||||||||||| Enter square side length: 4 * * * * * * * * * * * * ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////////////// #include <iostream> #include <math.h> using namespace std; int main () { int a=0,b=4,c=6; cout << "Enter A: "; cin >> a; cout << "Enter B: "; cin >> b; cout << "Enter C: "; cin >> c; if(a!=0) { float d; d=b*b-4*a*c;//this is the discriminant. cout << d; cout << endl; if(d>0)//if d>0 then the equation has two roots. { float x1,x2; x1=(-b*sqrt(d))/(2*a); x2=(-b-sqrt(d))/(2*a); cout << "x=" << x1 << " OR x=" << x2 << endl; } else if(d==0)//if d=0 it has a double root. { float x; x=(-b)/(2*a); cout << "x=" << x << endl; } else { cout << "It has no root."; } } else { if(b!=0)//if a=0 and b!=0 it has one root. (It's linear) { float x; x=(-c)/b; cout << "x=" << x << endl; } else { if(c!=0) { cout << "No Root."; } else { cout << "Indefinite."; } } } return 0; } ------------------------------------------------------------------------------------- Output: Enter A: 2 Enter B: 3 Enter C: 4 It has no root. |||||||||||||Test With Different Inputs|||||||||||||||||||| Enter A: 2 Enter B: 10 Enter C: 4 x=-20.6155 OR x=-4.56155 |||||||||||||Test With Different Inputs|||||||||||||||||||| Enter A: 2 Enter B: 4 Enter C: 2 x=-1 |||||||||||||Test With Different Inputs|||||||||||||||||||| Enter A: 0 Enter B: 4 Enter C: 8 x=-2 |||||||||||||Test With Different Inputs|||||||||||||||||||| Enter A: 0 Enter B: 0 Enter C: 2 No Root. |||||||||||||Test With Different Inputs|||||||||||||||||||| Enter A: 0 Enter B: 0 Enter C: 0 Indefinite. -------------------------------------------------------------------------------------
-- Modified Friday, September 3, 2010 5:49 AM
|
|
|
|

|
below is my condition on button click
IF condition is i=2 then "IMG_LOGIN.Attributes.Add("onclick", "noPostBack('http://web5.server.com/AuthUser.aspx');");" line executes and if next time click on button and i=1 still page moves "'http://web5.server.com/AuthUser.aspx'" instead of "'http://web4.server.com/AuthUser.aspx'".
if (i==1)
IMG_LOGIN.Attributes.Add("onclick", "noPostBack('http://web4.server.com/AuthUser.aspx');");
else
IMG_LOGIN.Attributes.Add("onclick", "noPostBack('http://web5.server.com/AuthUser.aspx');");
|
|
|
|

|
Thanks so much to the author of this article. I was facing an issue involving a login for a site. I was able to use the information here to enable a post back from a http page to a https page thus solving my requirement for secure login without making the whole page https. And with a bit of luck i wont get the mixed content message, but have to test for that.
Thanks again.
Dave
|
|
|
|
|

|
why not use the PostBackUrl for posting to another aspx page?????
|
|
|
|

|
There is no PostBackUrl feature in .Net 1.1. The article was written in 2003.
|
|
|
|

|
sorry,i didn't pay attention to the date.
have a nice day.
|
|
|
|

|
Hi,
when user try to save data he enter and click submit button we check for the duplicate entries for that records
If we find the user enter data is alreadyu in the database then we have to show one pop-up saying that " you enter duplicate entries" if user click on "ok" then anyway we have to save that entry otherwise we not save that entry.
for to check the this I use "OnClientClick=ConfirmMsg();" event of button and in that javascript i call server side code using call back.
But not worked 100%.
Please suggest me any different way for the same.
Thanks & Regards,
Rakesh.
|
|
|
|

|
it works fine but norton takes it as phishing and doesn't allow posting to the second page. any help would be appreciated. thanks
|
|
|
|

|
Method:
void SendPOSTRequestTo( string url, string variableName, string queryString )
{
HttpWebRequest POST = WebRequest.Create( url ) as HttpWebRequest;
POST.Method = "POST";
POST.ContentType = "application/x-www-form-urlencoded";
POST.Headers.Add( variableName, GetQueryFrom( queryString ) );
POST.ContentLength = 0;
byte[] data = new ASCIIEncoding().GetBytes( "" );
Stream st = POST.GetRequestStream();
st.Write( data, 0, data.Length );
st.Close();
Encoding enc = Encoding.GetEncoding( 1252 );
WebResponse webResponse = POST.GetResponse();
StreamReader srResponse = new StreamReader( webResponse.GetResponseStream(), enc );
Response.Write( srResponse.ReadToEnd() );
}
string GetQueryFrom( string queryString )
{
Uri uri = new Uri( queryString );
return uri.Query.Substring(1);
}
Usage:
SendPOSTRequestTo( "www.YourCompany.com/DefaultPage.aspx", "request", queryString );
I'm using this code in an ASP .NET 1.1 app where the previous developers were sending a string built from user choices through GET. Now the string can have more than 2083 characters and can't be sent trough GET[^].
now is looking much better :P
|
|
|
|

|
Change the form's action property when the button is clicked by adding the following dhtml to the button tag:
onclick="document.forms[0].action='https://www.paypal.com/cgi-bin/webscr'"
|
|
|
|

|
That only works if the page you are posting to is not an ASP.Net page. If the ViewState is posted the target page will throw an exception.
|
|
|
|

|
I've tried using the solution on a page which contains runtime created controls as well as validation controls. It's supposed to post the information inputted by the user on those dynamic controls to another page which was written in coldfusion.
However, I've encountered this error : "Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster."
What could be the problem? Your help would be much appreciated.
|
|
|
|

|
Try removing the Viewstate in the Javascript function. See the Just Remove ViewState post below.
|
|
|
|

|
Response.Write("<form id=form1 method=POST action=viewLogFrm.aspx runat="server">");
Response.Write("<INPUT type=submit name=LID value=View >");
Response.Write ("</form>");
then how can i get the submit button name on viewLogFrm.aspx ?
|
|
|
|

|
Hi,
In our asp.net 1.1 application client has told us to maintain one session per application means only one user can login at a time and if another user tries to login then we should tell that user that another user has already logged in. So all these things i finished doing but i am facing a problem when user closes the window directly without bieng logging out and the default session timeout is about 20 minutes so if a user has closed the window another user cannot login for another 20 minutes till the session expires.
So to avoid this using javascript i have written a function which will execute onbeforepageload event which will post to the login page with a querysting parameter which tells that the user has clicked the logout button and i am ending the session of that user. This is working fine for the close window but also it is getting executed when we refresh the page. through some javascript coding i got succeede to avoid the F5 refresh but we have to avoid even others options of refresh also. and we cannot disable those options.
hope you have understood my problem. So can anybody please help in this matter how to solve this problem.
Thanks in advance
Syed Saleem
|
|
|
|

|
Hi,
By mistake I voted this as 1. apologies. Anyways, its really of great intrest.
-Vineet
|
|
|
|

|
Hi,
In our asp.net 1.1 application client has told us to maintain one session per application means only one user can login at a time and if another user tries to login then we should tell that user that another user has already logged in. So all these things i finished doing but i am facing a problem when user closes the window directly without bieng logging out and the default session timeout is about 20 minutes so if a user has closed the window another user cannot login for another 20 minutes till the session expires.
So to avoid this using javascript i have written a function which will execute onbeforepageload event which will post to the login page with a querysting parameter which tells that the user has clicked the logout button and i am ending the session of that user. This is working fine for the close window but also it is getting executed when we refresh the page. through some javascript coding i got succeede to avoid the F5 refresh but we have to avoid even others options of refresh also. and we cannot disable those options.
hope you have understood my problem. So can anybody please help in this matter how to solve this problem.
Thanks in advance
Syed Saleem
|
|
|
|

|
Thanks .. I was looking for.
morteza
|
|
|
|

|
Viewstate can be a security issue as well as a bandwidth waster. I would just delete it.
Instead of:
document.forms[0].__VIEWSTATE.name = 'NOVIEWSTATE';
document.forms[0].__VIEWSTATE.value = '';
Use:
document.forms[0].removeChild( document.forms[0].__VIEWSTATE );
|
|
|
|

|
Thanks -- it was so useful
|
|
|
|

|
Thanks very much. This is the one i'm exactly looking for.
Kas_Aspnet
|
|
|
|

|
This looks like a pretty decent approach, but what about just disabling the viewstate completely? Has anyone tried just overriding the base class's functions which generate the viewstate? Maybe something like the following (VB version):
Protected Overrides Sub SavePageStateToPersistenceMedium(ByVal viewState As Object)
End Sub
Protected Overrides Function LoadPageStateFromPersistenceMedium() As Object
Return Nothing
End Function
Protected Overrides Function SaveViewState() As Object
Return Nothing
End Function
|
|
|
|

|
It worked for me!
Thanks a lot!!!
|
|
|
|

|
I am currently working on a web-site which I want to have the ability for the user to log in from every page and once loged in display a welcome message in place of the log in form. The problem is dot net does not allow multiple programmable form elements and a standard form element will not work inside a runat="server" form. It is easy to simulate multiple forms but not to secure them with ssl because you simulate multiple forms after the info is already posted back with a server.redirect, which would post back in clear text. I thought about making every page secure, but the problem there is (besides the speed issues) search engines will not index secure pages and I wan't to show up in search engines. There is no way that I know of to not do an unsecure post back when the user fills in the log in information. Putting the login form outside the runat="server" form would work but would not allow changes to the form once the user was loged in. I see this type of thing done on so many web-sites and in other languages it would be easy. This is a real problem caused by Dot Net not allowing multiple forms. Does anyone know a work around that does not include using javascript to change the action property to https. This won't work if the user has javascript turned off and I wan't this to be secure even if the user doesn't allow scripting. It would be easy to make the user click a secure link to the login form but this seems too much like giving up and causes the user extra time and effort. For an example of what I am talking about, take a look at the main page of www.wachovia.com. In the upper left is a form to login securely along with other posting forms on the same page. This login form will post securely. I want to be able to do that and retain programmatic control of that area. Sounds simple, but not in Dot Net.
|
|
|
|

|
This method does not work when the sessionState tag's "cookieless" attribute in the web.config file is set to "true". Request.Form variables on the recipient page is empty.
Is there a workaround to this problem?
Thanks,
Menard
|
|
|
|

|
Thanks heaps, that was just what I was looking for!
|
|
|
|

|
Hi,
I need to post my form to another aspx page, the stuff is i need to submit it when it satisfies some condition in server side. For example if I click the button it will check the flag is true in server side then it should be posted to another page.
I am looking for ur answer guys.
Thanx,
Senthil
|
|
|
|

|
i had written one client side function in the html section
<script language="javascript">
Function check()
{
alert('Hai this is mani');
}
</script>
now i have placed a web server control in page
the name of the control is button1.
my requirement is when i click on the button1 the client side function should be called.
i.e when i click button1 at runtime check function should be called and it should display the alert message
please reply me soon.
thanks.
|
|
|
|

|
do this in the code behind on the page load event in a if not ispostback ....
button1.attributes.add("onclick","javascript:check();")
this can be used for any standard js client side events
|
|
|
|

|
javascript:check();
sorry forgot the :
|
|
|
|

|
javascript:check()
sorry forgot the :
|
|
|
|

|
i had created tow web pages
|
|
|
|

|
Hi,
I have added 1 line of javascript in order to have my form posted to a new window.
function noPostBack(sNewFormAction)
{
document.forms[0].target = "new"; // new line added
document.forms[0].action = sNewFormAction;
document.forms[0].__VIEWSTATE.name = 'NOVIEWSTATE';
}
It works fine, but there is another problem.
My other autopost back control also execute it when I click on them.
For example, I have 2 radio buttons which will auto postback when i click to select different records.
And I have a button which i click to post to another new window for some report genertaion(this is where i use the javascript).
But after I click on the button(it works fine),then i try to click any of the radio button to view different records, a new window still pop up.
How can i disable this? Or rather, the line of javascript i've added is incorrect?
Thanks & regards,
pllms
|
|
|
|

|
Once the button is clicked the form action is set to the new target. When you try to use the radio buttons after clicking the button they can't postback because the post target has been changed.
Try adding a javascript onclick handler for the radio buttons that sets the form action back to the page itself.
|
|
|
|

|
Hi,
I have tried to add "Submit.Attributes.Add("onclick", "noPostBack('POPDF.aspx');") " in the Page_Load.
It works fine.
But then I realise my Postback function cannot work anymore.
Example, my Edit function of my Datagrid.
Is there a way that i can get both of these working in the same aspx file?
Regards,
pllms
|
|
|
|

|
Technically, you can't have a single page do a postback and post to another page simultaneously. It is one or the other. You do have some options though when using the postback and then transferring to another page:
- Allow the page to postback, the usen
Response.Redirect with a query string you create from the postback. This is the easiest, but obviously there are limitations with the query string. You would just need to decipher whether the postback was from the grid or some other button before redirecting.
- Allow the page to postback, then do a
Server.Transfer when the postback is not from the grid. This allows you to process on the postback and keep the Request.Form intact for the second page. The drawback is that the URL the user sees does not change for the second page.
- Allow the page to do the postback, and if the event is not from the grid then create an HTTP post to another page. This is the third option I described above in the article. There is a an article here describing how to do an HTTP post to another page from a postback.
|
|
|
|

|
hi
i have a framed page with two frames top and buttom
in the buttom page i have a button
when the user clicks the button i want some session varibles set and then to load a page into the TOP frame
i have writen a script :
<script language="javascript">
function LoadReport(){
parent.frames(0).location.href = "VehicleManagment.aspx"
}
</script>
im using the attribute.add(onclick,LoadReport()) on the page_load event to set the the button onclick event
but when i run the page and press the button the top frame gets refreshed only after i press the button the second time
my understanding of this machanism is the first when i press the button the page gets posted back and server side code is axecuted acording to the event handler inside the code behind
but when does the client side script (JS onclick event handler) gets executed?
when the page returns to the client browser?
after?
or does it gets executed on the server thus gets lost?
i hope this aint too outofway of your topic here
|
|
|
|

|
I tried what you described. I created a quick example made of 4 pages:
twoframe.html
<html>
<frameset rows="50%, *" frameborder="1">
<frame name="top" src="topframe.aspx">
<frame name="bottom" src="bottomframe.aspx">
</frameset>
</html>
topframe.aspx and newtop.aspx that are essentially empty, just some text so I can see what page is loading.
Here is what I put in bottomframe.aspx:
<%@ Page Language="VB" %>
<script runat="server">
Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Test.text = "Try This"
Test.attributes.add("onclick","LoadReport()")
if IsPostback then
Posted.Text = "I posted back"
end if
end sub
</script>
<html>
<head>
<script language="javascript">
function LoadReport(){
alert('In Function');
parent.frames(0).location.href = "newtop.aspx"
}
</script>
</head>
<body>
<h2>Bottom</h2>
<form runat="server">
<asp:Button id="Test" runat="server" Text="Button"></asp:Button>
<asp:label id="Posted" runat="server"></asp:label>
</form>
</body>
</html>
When I click the button, here is what happens:
- Client function "LoadReport" fires
- Top frame reloads new page
- Postback occurs, label is updated
I hope this helps illustrate when the events are firing. I am not sure why the client event doesn't seem to happen for you. Make sure the client code fires by adding an alert or some other visible result to confirm that it really happens.
Dave
|
|
|
|

|
Hello dave,
first thanks alot for fast reply
after reading your response i added the alert and indeed it fires each time i press the button but.....
after trying again and again i found this info about what hapns
i am using the lower frame as a form for the user to input diffrent criteria like dates and names
when the user clicks the button and the page in the LOWER frame is posted back i save these values into a session variable
when the page of the TOP frame is loaded it uses the session values to generate a report based on sql2000 data (works ok)
now
when ever i change a value in the lower frame and then press the button
first the alert fires wich means the onclick local JS has been fired
then it gets posted back but it does not yet refreshes the TOP frame
only when control is back in the client browser and then i press the button a second time
only then the TOP frame refreshes and the report is generated with the new values
if i keep pressing the values without changing the or i press another buton the should similiarly fire a local JS to load a diffrent page into the TOP frame then it gets refreshd atonce
i guess what i realy need is in some way to have the lower frame postback
to have the session variables updated on the server side code
and THEN
when the page returns to the user and before the user can interact with it i want the local JS to fire and refresh the TOP frame
i think this describe fairly the order of events i need
i hope im not taking to much of your time but if you can point me in the write direction to achive this ill be gratefull
thanks again
Daniel Chotzen
D.C.S israel
|
|
|
|

|
The top frame is loading before the postback to the bottom frame is done because the client event is happening before the postback and therefore is not seeing the session variables in the state you need until the second time.
What you probably need to do is add Javascript to the bottom page after the postback that causes the top page to reload. The page object has a method called RegisterStartupScript that will do allow you to add Javascript that will run when the page loads. Just call it when handling the postback, and have the startup script call the function to refresh the top page.
I'm glad I could help. Good luck.
Dave
|
|
|
|

|
Hi!
If I use the NOVIEWSTATE solution, the new form opened with
page.IsPostBack = True.
Any idea??
Thanks in advance.
Hergass
Hergass
|
|
|
|

|
I tried it and get the opposite result. In the SecondForm.aspx file I added a new label control named "State". I modified the code to read as follows:
private void Page_Load(object sender, System.EventArgs e)
{
Result.Text = Request.Form["SomeText"].ToString();
State.Text = this.IsPostBack.ToString();
}
When I run the page the State label always contains False. Maybe if you posted your code we could see why your result is different?
Dave
|
|
|
|

|
I've been able to reproduce the problem... it's when you add a listbox and turn "AutoPostBack" to true. Now the Page.IsPostBack value on your posting page (web2.aspx) is always "True". I have no solution at this time... anybody?!?
John
|
|
|
|

|
hi am also facing the same problem like Hergass . whenever i post data ispostback return true in the posted page. can you tell me any way to get rid of it.
I have added the javascript code to the link button dynamically in the page where javascript is written. And it is working fine apart from this ispostback problem.
thanks is advance
kajal
|
|
|
|

|
After some digging around I have found a solution. I hit the same problem, and after some trial and error found that it was caused by having a LinkButton in the form. I'm sure there are other controls that cause this though...
When the LinkButton is present, two additional ASP.Net form values appear called __EVENTTARGET and __EVENTARGUMENT. The presence of these seems to set Page.IsPostBack = true when you initially post to the new aspx page. To resolve this you need to remove these values (if present) as part of the javascript, in a similar way to removing __VIEWSTATE as suggested in an earlier post, i.e.:
document.forms[0].removeChild( document.forms[0].__VIEWSTATE );
if (document.forms[0].__EVENTTARGET)
document.forms[0].removeChild( document.forms[0].__EVENTTARGET );
if (document.forms[0].__EVENTARGUMENT)
document.forms[0].removeChild( document.forms[0].__EVENTARGUMENT );
Hope this helps, regards
Andy
What are you going to do? Set the dogs on me, or the bees, or the dogs with bees in their mouths, and every time they bark they shoot bees?
|
|
|
|

|
I have found a problem with this method:
If you post from Page1.aspx to Page2.aspx and hit the "Back" button of your browser in order to return to Page1.aspx then you won't be able to make any postback on this page.
Because we have renamed the "__VIEWSTATE" field to "NOVIEWSTATE", Page1.aspx has lost all information to make his roundtrip.
Solution:
In Page1.aspx, test if the field "NOVIEWSTATE" exist (at the page load) and in this case, rename it "__VIEWSTATE".
Like this:
<SCRIPT language="JavaScript">
onload = RenameViewstate
function RenameViewstate()
{
if (document.forms[0].NOVIEWSTATE != undefined) {document.forms[0].NOVIEWSTATE.name='__VIEWSTATE'}
}
</SCRIPT>
b_i_c_k
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
Use JavaScript to bypass the ASP.NET postback process and post an ASP.NET form to another location.
Type | Article |
Licence | |
First Posted | 18 Jun 2003 |
Views | 500,045 |
Bookmarked | 110 times |
|
|