.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Button on application page not redirecting correctly

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :C#


I have a customized SharePoint application page which has a Button control like:


<wssuc:ButtonSection runat="server">
		    <asp:Button ID="BtnOK" runat="server"
Code behind:
protected void BtnOk_Click(object sender, EventArgs e)
      // do stuff


When I click on the OK, it redirects correctly to the previous page. But the Cancel button on click redirects to site collection root.

So my question is, how do I control the redirect of the Cancel button? Also, I don't see any other button on the aspx page for the Cancel?



View Complete Post

More Related Resource Links

Redirecting to custom page while clicking on the user/group browse button

Hi, i have created a custom visual web part in visual studio 2010 and i deployed it into sharepoint site by creating a new page in my site. The custom page gets the data of users/groups from database and pass the users to the people picker in sharepoint.Here my question i have a document library where we upload document and get the users page popup that consists of people picker and a user/group browse button.when i click on the (book image button)browse button it will redirect to the user and group search page but here i need to replace my custom  user/group search page with the default one so please help me how to redirect to the custom page by clicking on the user/group browse button,and i need to pass the selected users to the people picker text box........please give me some solution whether this can be done or not if possibe please send me the link or some sample code how to do this   thank you.

Need help redirecting users to personalized page


 Hi, first timer here so be gentle.


I've been able to create a cool little website, it's up and running with users logging in and out, I created roles so my administrative team can see sensitive data that's not available to regular and anonymous users.

Now they would like me to create a page specific to each user.  For instance when user A logs in they are redirected to a page that has information that pertains to user A only (like a list of their benefits/ their remaining vacation time). This page needs to be accessible only to user A. 

I've watched a ton of the videos but have yet to see one that covers this topic, any help would be great!!!





replacing ok and cancel button of an alert message with YES an NO button in asp.net web application.


i want to replace ok and cancel button of an alert message with YES an NO button in asp.net web application.When a user will click yes the data will be saved in the database and if user clicks that will act as a reset button and do not save the data in database and the control will move with as usual to the redirect page.Any pointers will be highly appreciated.I am usin g C# language.

Reporting services in 2008 r2 how to get a report in a print button click event in my c#.net page


how to  get a report in my c#.net page button lick event also steps to call a report from asp.net to reporting services


Thanks in advance

Integrating aspx page in classic asp web application



I have a classic asp web  application. I am trying to add an aspx(C#) page to the existing asp application.

The existing asp pages have include pages for header and footer. How to add the classic asp include files in aspx page.

Also, How to deploy the aspx page in the existing classic asp web application.

Thank you

Button click in master page use in other pages I have to click twice. Why?


In my masterpage I have a menu with buttons. I want the buttons to do something after click. It works but I have to click twice on the button, why? What do I have to do to just to click once?

Catch button click event in different .aspx page.


I have a button which starts processing.
I want that when ever a button is click from page1.aspx .. a count down timer should start and displayed on page2.aspx.
I am thinking of using iframe to join 2 pages.

Please let me know your suggestions.


Logout not redirecting correctly


I have the following control on my master page


asp:LoginStatus ID="LoginStatus1" runat

I want 404 instead of redirecting to login page

I have implemented the standard Login control and everything works fine.However when i enter an invalid URL it gets redirected to the Login page.e.g. http://www.mywebsite.com/xxx gives a 404but http://www.mywebsite.com/xxx.aspx causes a redirect to the login pageI am using ASP.NET 3.5 on Windows Server 2008.I have set up the web.config with the following<customErrors mode="RemoteOnly" defaultRedirect="/Unauthenticated/GenericErrorPage.htm"> <error statusCode="403" redirect="/Unauthenticated/NoAccess.htm" /> <error statusCode="404" redirect="/Unauthenticated/FileNotFound.htm" /> <error statusCode="500" redirect="/Unauthenticated/FileNotFound.htm" /></customErrors>and also<httpErrors existingResponse="Replace"> <remove statusCode="403" /> <remove statusCode="404" /> <remove statusCode="500" /> <error statusCode="403" path="/Unauthenticated/NoAccess.htm" responseMode="Redirect" /> <error statusCode="404" path="/Unauthenticated/FileNotFound.htm" responseMode="Redirect" /> <error statusCode="500" path="/Unauthenticated/FileNotFound.htm" responseMode="Redirect"

Masterpage didnt get applied to a particular _Layouts files(application page) for EditUserPref.asp

Master page did nt  get applied to a application page  (_layout file),   but other layout pages have the master page applied. EditUserPref.aspx  ->  Im accessing from search preference - http://i34.tinypic.com/34xi9t5.jpg  

Page cannot be found error on clearing cookies while running application

Hello all,            I've a web application which is running on sql state session .. And is running well under normal conditions. But when my application is in home page or landing page after loging to the application, if user clears all his history and cookies and click on any menu in the application . It is giving  Internet Explorer cannot display the webpage error.. I'm not able to debug the error.. am getting the same problem even under deploying conditions. How to handle this issue?   Thanks in advance, Hari.

ReportViewer Print Button not working correctly with windows 7 clients

I need some help being pointed in the right direction to fix the following issue: - After building several reports using reportviewer and testing with windows XP clients everything seemed to be fine.  I noticed that the first time the client loaded the asp.net website and clicked the print button it asked permission to install a small file (I assume this is to allow the reportviewer to access the clients printers).   - The problem I have is on Windows 7 Clients.  They can view/export the reports with no problem, but when they click the print button it ask permission to install the small file, but a error is given during the install process and the file is not installed.   If anyone has a solution or can point me in the right direction it would be helpfull.  I am using Visual Studios 2008 on Windows XP PRO and the site is hosted on Windows Server 2003 R3   Thanks 

How to manage postback on crystal Report viewer next page click button clickj

 Hi,       I am using Crystal Report on my ASP.NET Fw. 3.5 project. My report contains 100+ pages. When I click on next page button on crystal report viewer control my whole page gets postback to server and then second page appears. This take same time when first time report gets loaded.     Any suggestion how to imporve user experience in thiss case?   Nilkanth Desai   

what should i add, or change to maintain the addition on the page at button click, yes i know why, b

 - select day using the drop down list  - select the start date using calender (causes an event), a table is made having the dates of the day selected from the start date and shown to the user.  - the table also contains checkbox for each row in a cell  - the user selects the check boxes he wants  - and clicks the button  - the button calls the method in the .cs file which SHOULD TRAVERSE THE TABLE ROWS TO FIND THE ticked checked boxes and the rest is self explanatory the problem ----------- on calender selection change event nothing is lost, but on button click event all things in table created by code is lost. (as the debugger shows that the row count is zero). i understand that in the page cycle the rows etc added the form by the date change event of the calender are not preserved. fine. but whats the solution. please help i have been searching for a solution desperately. the source --------      <asp:Calendar ID="Calendar1" runat="server"          >         <SelectedDayStyle BorderStyle="Dotted" BorderWidth="4px" />         <TodayDayStyle BorderStyle="Solid" BorderWidth="4px" HorizontalAlign="Center"              

How To Use a Specific Sites' Master Page for my custom asp.net application

I have a custom application that I migrated to sharepoint (compiling into single DLL and creating a fodler for it in the layouts folder in 12 hive) Currently, I am using ~/_layouts/application.master as my masterpage for the custom application. However, i would like to use a certain site's master page for my application versus the default one. For instance, I would like to use the master page from this sub site www.maindomain/sites/subsite/ Thanks for your help.

I cannot open application page which i created with Intranet and Internet.

for example, if i create an application portal : test:1000, then it is okay. but when i try to create an application portal: www.e.gov.au with ip address  i have added  www.e.gov.au into host files, but cannot open that page, system just said page not found. i just failed and failed. but when i checked in central admin, it is just fine....   can anybody tell me how to resolve it?   regards

how call silverlight application page in asp.net application

Hello, I want to show silverlight page in asp.net application .That is I want to show some design using silverlight in asp.net application   Thank you.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend