Showing posts with label button. Show all posts
Showing posts with label button. Show all posts

Thursday, March 29, 2012

Please click the back button on your browser and

Hi All,

In my one project, at many aspx pages I am getting below error.
Could anyone please give me solution of this.
================
Please click the back button on your browser and try again.Session state is
not available in this context.
================
I really tried to solve this a lot but could not get the solution.

Thanking you in advance,
RahulSeems sessions are disabled for your application and being used everywhere
inside applications...

Sudhakar Sadasivuni
http://weblogs.asp.net/ssadasivuni
MyUG : http://www.mugh.net

"Rahul Borade" wrote:

> Hi All,
> In my one project, at many aspx pages I am getting below error.
> Could anyone please give me solution of this.
> ================
> Please click the back button on your browser and try again.Session state is
> not available in this context.
> ================
> I really tried to solve this a lot but could not get the solution.
> Thanking you in advance,
> Rahul
>
Hi,

Thanks for your immediate reply!

But, if I check session on other aspx pages, the session
state is perfectly available.

What could be any other possiblity for this ... can you
please tell me ...

>--Original Message--
>Seems sessions are disabled for your application and
being used everywhere
>inside applications...
>
>Sudhakar Sadasivuni
>http://weblogs.asp.net/ssadasivuni
>MyUG : http://www.mugh.net
>
>"Rahul Borade" wrote:
>> Hi All,
>>
>> In my one project, at many aspx pages I am getting
below error.
>> Could anyone please give me solution of this.
>> ================
>> Please click the back button on your browser and try
again.Session state is
>> not available in this context.
>> ================
>> I really tried to solve this a lot but could not get
the solution.
>>
>> Thanking you in advance,
>> Rahul
>>
>>
>>
>.

Please click the back button on your browser and

Hi All,
In my one project, at many aspx pages I am getting below error.
Could anyone please give me solution of this.
================
Please click the back button on your browser and try again.Session state is
not available in this context.
================
I really tried to solve this a lot but could not get the solution.
Thanking you in advance,
RahulSeems sessions are disabled for your application and being used everywhere
inside applications...
Sudhakar Sadasivuni
[url]http://weblogs.asp.net/sasivuni[/url]
MyUG : http://www.mugh.net
"Rahul Borade" wrote:

> Hi All,
> In my one project, at many aspx pages I am getting below error.
> Could anyone please give me solution of this.
> ================
> Please click the back button on your browser and try again.Session state i
s
> not available in this context.
> ================
> I really tried to solve this a lot but could not get the solution.
> Thanking you in advance,
> Rahul
>
>
Hi,
Thanks for your immediate reply!
But, if I check session on other aspx pages, the session
state is perfectly available.
What could be any other possiblity for this ... can you
please tell me ...

>--Original Message--
>Seems sessions are disabled for your application and
being used everywhere
>inside applications...
>
>Sudhakar Sadasivuni
>[url]http://weblogs.asp.net/sasivuni[/url]
>MyUG : http://www.mugh.net
>
>"Rahul Borade" wrote:
>
below error.
again.Session state is
the solution.
>.
>

Monday, March 26, 2012

Please help - how to create a Printer Friendly web page...

Dear Experts,
I've got a trouble problem that I need your help. The scenario is the
following:

1) I need to add a "Print" button to my web page;
2) by clicking this button, the web page should be able to print out a
well-formatted web page (printer friendly ). That means, I need to adjust the
printing margins (left, top, right, bottom) programmatically.

I really have no idea on how to achieve this but I know this is a very
typical scenario. Could you please give me some advices? Please help.

Thanks a lot.
TiggerAs long as the targetted browser is IE >= 5 you can use the onbeforeprint
and on afterprint events in javascript
(I found this out yeterday)
I wrote the code below to hide a print button and decrease the width when
the document is printed
Hope this helps,
mortb

<head>
<script language="javascript">
var originalWidth;
function window.onbeforeprint()
{
originalWidth = document.getElementById('_tblResult').style.width;
document.getElementById('_tblResult').style.width = '625px';
document.getElementById('_btnPrint').style.display = 'none';
}
function window.onafterprint()
{
document.getElementById('_tblResult').style.width = originalWidth;
document.getElementById('_btnPrint').style.display = 'inline';
}
</script>
</HEAD
"Tigger" <Tigger@.discussions.microsoft.com> wrote in message
news:C2D9F1F1-954D-448A-A201-BAAA332C866E@.microsoft.com...
> Dear Experts,
> I've got a trouble problem that I need your help. The scenario is the
> following:
> 1) I need to add a "Print" button to my web page;
> 2) by clicking this button, the web page should be able to print out a
> well-formatted web page (printer friendly ). That means, I need to adjust
> the
> printing margins (left, top, right, bottom) programmatically.
> I really have no idea on how to achieve this but I know this is a very
> typical scenario. Could you please give me some advices? Please help.
> Thanks a lot.
> Tigger
>
Use a media-specific print stylesheet.
For example, try slapping this in a file called print.css
@.page { 0.75in; }
And putting this line in your HTML
<link rel="stylesheet" type="text/css" href="http://links.10026.com/?link=print.css" media="print"
At this point, you should be able to print from your browser normally. If
you need to initiate printing from a button, you should be able to do
something like this:
<input type="button" value="Print me!" onclick="window.print()"
This article might give you some ideas on other things you can do with this
techinque: http://www.alistapart.com/articles/goingtoprint/
And there's always the CSS reference: http://www.w3.org/TR/CSS21/

"Tigger" wrote:

> Dear Experts,
> I've got a trouble problem that I need your help. The scenario is the
> following:
> 1) I need to add a "Print" button to my web page;
> 2) by clicking this button, the web page should be able to print out a
> well-formatted web page (printer friendly ). That means, I need to adjust the
> printing margins (left, top, right, bottom) programmatically.
> I really have no idea on how to achieve this but I know this is a very
> typical scenario. Could you please give me some advices? Please help.
> Thanks a lot.
> Tigger
>
>

Please help - how to create a Printer Friendly web page...

Dear Experts,
I've got a trouble problem that I need your help. The scenario is the
following:
1) I need to add a "Print" button to my web page;
2) by clicking this button, the web page should be able to print out a
well-formatted web page (printer friendly ). That means, I need to adjust th
e
printing margins (left, top, right, bottom) programmatically.
I really have no idea on how to achieve this but I know this is a very
typical scenario. Could you please give me some advices? Please help.
Thanks a lot.
TiggerAs long as the targetted browser is IE >= 5 you can use the onbeforeprint
and on afterprint events in javascript
(I found this out yeterday)
I wrote the code below to hide a print button and decrease the width when
the document is printed
Hope this helps,
mortb
<head>
<script language="javascript">
var originalWidth;
function window.onbeforeprint()
{
originalWidth = document.getElementById('_tblResult').style.width;
document.getElementById('_tblResult').style.width = '625px';
document.getElementById('_btnPrint').style.display = 'none';
}
function window.onafterprint()
{
document.getElementById('_tblResult').style.width = originalWidth;
document.getElementById('_btnPrint').style.display = 'inline';
}
</script>
</HEAD>
"Tigger" <Tigger@.discussions.microsoft.com> wrote in message
news:C2D9F1F1-954D-448A-A201-BAAA332C866E@.microsoft.com...
> Dear Experts,
> I've got a trouble problem that I need your help. The scenario is the
> following:
> 1) I need to add a "Print" button to my web page;
> 2) by clicking this button, the web page should be able to print out a
> well-formatted web page (printer friendly ). That means, I need to adjust
> the
> printing margins (left, top, right, bottom) programmatically.
> I really have no idea on how to achieve this but I know this is a very
> typical scenario. Could you please give me some advices? Please help.
> Thanks a lot.
> Tigger
>
>
Use a media-specific print stylesheet.
For example, try slapping this in a file called print.css
@.page { 0.75in; }
And putting this line in your HTML
<link rel="stylesheet" type="text/css" href="http://links.10026.com/?link=print.css" media="print">
At this point, you should be able to print from your browser normally. If
you need to initiate printing from a button, you should be able to do
something like this:
<input type="button" value="Print me!" onclick="window.print()">
This article might give you some ideas on other things you can do with this
techinque: http://www.alistapart.com/articles/goingtoprint/
And there's always the CSS reference: http://www.w3.org/TR/CSS21/
"Tigger" wrote:

> Dear Experts,
> I've got a trouble problem that I need your help. The scenario is the
> following:
> 1) I need to add a "Print" button to my web page;
> 2) by clicking this button, the web page should be able to print out a
> well-formatted web page (printer friendly ). That means, I need to adjust
the
> printing margins (left, top, right, bottom) programmatically.
> I really have no idea on how to achieve this but I know this is a very
> typical scenario. Could you please give me some advices? Please help.
> Thanks a lot.
> Tigger
>
>

Saturday, March 24, 2012

Please Help - Where is the mistake in my code

Hi all

When I run this app, select the checkbox and press the calculate button i get the following error:

Server Error in '/' Application.

Object reference not set to an instance of an object.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.] nihe.SimpleRent.calculate(Object source, EventArgs e) +173 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +83 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain() +1292

My code is as follows, does anyone know what i have done wrong, any help/advice would be very much appreciated.

<%@dotnet.itags.org. Page Language="VB" Debug="true"Inherits="nihe.SimpleRent" ContentType="text/html" ResponseEncoding="iso-8859-1" %><html><body> <form runat="server"> Bathroom with W/C: <asp:CheckBox id="bath_wc" runat="server"></asp:CheckBox> <p> <asp:button id="calcbutton" onclick="calculate" runat="server" text="calculate"></asp:button> </p> </form></body></html>
' SimpleRent.vb'Imports SystemImports System.WebImports System.Web.UIImports System.Web.UI.WebControlsNamespace nihePublic Class SimpleRent : inherits page protected withevents bath_wcAs system.web.ui.webcontrols.checkbox protected withevents row_bwcAs system.web.ui.webcontrols.TableRowPublic sub calculate(source asObject, e as EventArgs) if bath_wc.checked then bath_wc.text ="+3" Context.Items.Add("bath_wc", bath_wc.text) row_bwc.Visible = bath_wc.checked end ifserver.transfer("SimpleResult.aspx")End SubEnd ClassEnd Namespace
<%@dotnet.itags.org. Page Language="vb" %><script runat="server">Sub Page_Load(Source asObject, E as EventArgs) cell_bwc.text ="Bathroom With WC" value_bwc.text = Context.Items("bath_wc")End Sub</script><html><body><form> <asp:Table runat="server"> <asp:TableRow id="row_bwc"> <asp:TableCell id="cell_bwc"></asp:TableCell> <asp:TableCell id ="value_bwc"></asp:TableCell> </asp:TableRow> </asp:Table></form></body></html>

Where did you get this code from?

<html>
<body>
<form>
<asp:Table runat="server">
<asp:TableRow id="row_bwc">
<asp:TableCell id="cell_bwc"></asp:TableCell>
<asp:TableCell id ="value_bwc"></asp:TableCell>
</asp:TableRow>
</asp:Table>
</form>
</body>
</html>

I see 2 html parts in the code you posted.

Thanks


Because your Calculate method is encapsulated in a page that does not exist. Therefore, "row_bwc" does not exist.

For some reason, it seems you have attempted to create an inheritable base page that is actually a "real" page?


Sorry should have been more specific.

The code show is actaully three seperate pages

page one, codebehind for page one and results page.

Hope this clarifies things

Sorry

Kevin


The last line of your Calculate method attempts to executerow_bwc.Visible = bath_wc.checked. No instance of row_bc has been created. Therefore,row_bc is a null reference.

Remember, there's no row_bc on page one. It's only on the results page.


Lee thanks for reply

So where do i need to reference row_bwc and how do it do it?

Thanks in advance

Kevin


It seems you mix 2 web pages.You have 2 webpages A and B,you can only access controls of A in codebehind of A.

"So where do i need to reference row_bwc and how do it do it?"

You have 2 choice .

1: Combine page one and result page to a single page.That means add:

 <asp:Table runat="server"> <asp:TableRow id="row_bwc"> <asp:TableCell id="cell_bwc"></asp:TableCell> <asp:TableCell id ="value_bwc"></asp:TableCell> </asp:TableRow> </asp:Table>

to page one and don't forget add code in pageload to page one. Then use YourControl.visible to display or hide controls.

2: pass parameter (like row_bwc.Visible,etc )to SimpleResult.aspx then do the action within SimpleResult.aspx.


Kipster:

Lee thanks for reply

So where do i need to reference row_bwc and how do it do it?

Thanks in advance

Kevin

You need to pass the value to set the visibility of row_bwc to the SimpleResult page. You could do this in one of the many ways that you would normally pass values between pages -- like in a QueryString, or drop the Server.Transfer and do a crosspost instead. Let me know if you need an example.

Please help about Javascript for Asp.net Button

I have to validate so many controls at a time.I dont know what to Write in ControltoValidateProperty property in this case.So I went for writing Javascript function.

I wrote a function in javascript called "validateform" which checks all controls and validates the form.

Now when User clicks Submit Button I want to use this function.
The Problem is When i included that code in Button.attributes.add(...),Its giving me errormessages but also executing the server side code for button.

please help me

thxHow are you calling the Javascript function, from an OnClick event in the submit button or from an onSubmit call from the form. In either case you need to return false from the javascript function if a field does not validated. This will prevent the form from posting back and executing the server side code. If you could provide a code example, it would be easier for me to determine what is going wrong.
this is sample code

javascript :


function va()
{
if(document.all.p_title1.value=="")
{
alert("Team Name required");
return false;
}
else
return true;
}

Page Load :

ContinueButton.Attributes.Add("onclick","va();");

Button Server Event :


private void ContinueButton_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
Response.Redirect("SelectMaterial.aspx");

}

thx
I noticed the other day that if you don't specify that you want a value returned in the onclick event as well as returning the value from the function that the form postsback to the server regardless of the Javascript function return value, with that said, all you need to do is change you attributes.add statement like so.


ContinueButton.Attributes.Add("onclick","return va();");

That should solve the postback problem.
thank you very much.
It worked

Wednesday, March 21, 2012

Please help me ..(:

Hi,

When user clicks on the PRINT button, i like the system automatically print a WEBFORM ASPX file (which is in Report format)..ie, OnClick it should call that ASPX file and print it...

Please advice me (:You have to make a "Printer Friendly Version" button that the user can click to go to that page (or load a pop up) and then call window.print(); (I think).
You can also create a style in your stylesheet that will resize the controls differently for "print" and "screen" situations. This will allow you to auto-resize all pages so they
are printer-friendly.
Hello -

I'm assuming you have something like an array (list) of documents that
you would like to choose from to print...

I had the same type of task...

I completed it with having a button for each entry on the form, and when
the user pressed a button, a child window (popup) would display the
form (or PDF)
The popup window had a header frame that allowed the user to print or
cancel the form...

the trick was, once the popup window ready to be displayed, i would create
a DIV tag around the entire contents, and the print button would print the
contents of the DIV tag...

I also added a little model window magic - to keep the child window
open until the user closes the popup.

Worked like a champ.

best of luck

take care
tony
Hi,

it's a much cleaner solution to use css for this one. Take a look at this article:CSS Design: Going to Print.

Grz, Kris.

please Help me find out a way!

I want a client to enter a 'key' in a textbox and click a button. then the entered value will be used to search a table in the MS-SQL database. The corresponding value found from that table will be used to search a second table. Data found from the second table will be bounded to the datagrid control at the page where the client entered the 'key'. What will be the way to achieve this? What will be the SQL command??

I'm not sure if I'm able to describe the problem. I'm a new user of ASP.NET. So please help.

Ishtiaque.

A stored procedure like this will work:

CREATE PROCEDUREdbo.Example
@.key1varchar(255)
AS
DECLARE@.key2varchar(255)
SELECT@.key2 = key2columnFROMTable1WHEREkey1column = @.key1
--The select below will return your results so you can bind to your grid:
SELECT*FROMTable2WHEREkey2column = @.key2


Thank you Sharbel_.

I made a stored procedure as you suggested and used it by a 'drag and drop' method in my webform. But as I mentioned I am a novice user of ASP.NET, could not utilize the sqlConnection or sqlCommand that resulted of doing so. Would you please let me know how to do so?

Thanks in advance.


Hi,

using System.Data.SqlClient; at the top in the .cs file

Create the connection and the command objects in the page_load or in the button click as

SqlConnection sqlcn =new SqlConnection(connectionString);

sqlcn.Open();

//creating and initialising a command object

SqlCommand sqlcm =new SqlCommand();

sqlcm.Connection = sqlcn;

sqlcm.CommandType = CommandType.StoredProcedure;

sqlcm.CommandText = StoredProcedure name;

sqlcm.ExecuteNonQuery();

HTH.

Please help me to create button search...

plss,...i am very new in asp.net..?can someone help me how to create button search in form including coding can be search in ms access....::((Hello, have a look at the following, they might give you an idea on how to process:
1-Populating a Search Engine with a C# Spider
2-Internal Site Search Engine
Regards

Friday, March 16, 2012

please help me to solve my provblem..its very urgent

i have a button in my webform. whenever i click that button it should display the crystal report designer window so that the end user can design his own report...
i don't know how to display crystal report designer window at runtime in asp.net.please help me...

please please help me...its very very urgent

Hello Niranjana,

A CrystalReportViewer needs a CrystalReportSource in order to function. So, in the scenario you outlined above, you'd need to dynamically add both to the page. In VB.NET, this would look something like the following:

 Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim crs As New CrystalDecisions.Web.CrystalReportSource crs.ID = "CrystalReportSource1" crs.Report.FileName = "CrystalReport1.rpt" form1.Controls.Add(crs) Dim crv As New CrystalDecisions.Web.CrystalReportViewer crv.Height = New Unit("200px") crv.Width = New Unit("200px") crv.AutoDataBind = True crv.ReportSourceID = "CrystalReportSource1" form1.Controls.Add(crv) End Sub

HTH,
Clay


sir,

thank you so much for ur information.

but my problem is different. I need to design the crystal report at runtime... ie one end user be able to design his crystal report.. ie adding fields ,formatting crystal reports all those things...

if u have any idea please help me sir

thanks & regards

nisha


Hi nish,

I dont whether its possible to enable the users to design his own reports... But try the below logic...

1. You need to list all of the fileds available in the reports...

2. Create the query which fetches the data from the table for the fields selected by the user and empty for unselected fileds. (initially you need to design the reports with all the fields)

3. suppress the fields in crystal reports if the field value is empty.

I hope the above will help you...


that i can do sir,i have already listed all the fields of a table in a listbox and use that to create crystal report...

my problem is really different...the end user should able to design his own crystal reports.

at runtime the designer should come. can we use any Report Designer Component(RDC) in asp.net...i am not getting an exact idea from net also. if u can please help me sir...


Hi nish,

Sorry I dont know whether its possible or not... I think its not available in Crystal reports... but may be in some other third party report tools...


anyway..thank you sir..

Please help setting target for frameset

I have a web application and a frameset. The fameset have left and righ
frame. What I want to archieve is that when I click on a button on th
left frame I want the link that is placed on the button to be displaye
on the right frame.
on the button i have this code:

Response.Redirect("http://localhost/ValutaKalVer2/Valutakurs.aspx").whe
I clicked on this button this page only show on the same frame. This i
where I am having problem, can somebody put me through setting th
target
Thanks in advanc

Justne
----------------------
Posted via http://www.mcse.m
----------------------
View this thread: http://www.mcse.ms/message400190.htmJustnew <Justnew.11rpqs@.mail.mcse.ms> wrote in
news:Justnew.11rpqs@.mail.mcse.ms:
> Response.Redirect("http://localhost/ValutaKalVer2/Valutakurs.aspx").when
> I clicked on this button this page only show on the same frame. This is
> where I am having problem, can somebody put me through setting the

You cannot set the target from the server side. You have to set the target in
the HTML on the first render.

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Thank you for the reply: You said I have to place the target on th
html. Ok this is my image button <asp:imagebutton id="ImageButton1
style="Z-INDEX: 101; LEFT: 184px; POSITION: absolute; TOP: 104px"> I a
not quite sure where to place the syntax for target. Based on th
information so far can you tell me how to do that
Thanks for the answer so far
Chad Z. Hower aka Kudzu wrote:
> *Justnew <Justnew.11rpqs@.mail.mcse.ms> wrote in
> news:Justnew.11rpqs@.mail.mcse.ms:
> Response.Redirect("http://localhost/ValutaKalVer2/Valutakurs.aspx").when
> > I clicked on this button this page only show on the same frame
> This is
> > where I am having problem, can somebody put me through setting the
> You cannot set the target from the server side. You have to set th
> target in
> the HTML on the first render.
>
> --
> Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
> "Programming is an art form that fights back"

Justne
----------------------
Posted via http://www.mcse.m
----------------------
View this thread: http://www.mcse.ms/message400190.htm
Justnew <Justnew.11s96u@.mail.mcse.ms> wrote in
news:Justnew.11s96u@.mail.mcse.ms:
> Thank you for the reply: You said I have to place the target on the
> html. Ok this is my image button <asp:imagebutton id="ImageButton1"
> style="Z-INDEX: 101; LEFT: 184px; POSITION: absolute; TOP: 104px"> I am
> not quite sure where to place the syntax for target. Based on the
> information so far can you tell me how to do that

Check the HTML ref, but IIRC its just target="name" for the frame. I know
this is for separate Windows - I cannot remember offhand if frames use Target
too or if there is a separate key word. Its been a long time since I needed
frames since I use partial updates instead because they are more flexible.

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"