I have a simple .aspx page. I wish I could attach the picture here.
I want to show the data either in Chart control or Gridview control. When the user selects an option to see the data either in chart control or grid view control, that specific control has to show up and other control has to become invisible.
So far, I am able to populate data succcessfully in the chart control. If the user chooses "Grid view" option, how can I show the data in grid view control in the same location. I don't want the gridview control to be shown in a pop up window or any other window.
I have a list box with multiple values. I need a functionality to move items up/down using Ctrl+uparrow/Ctrl+downarrow. I am here by stuck with a issue when the selected item in the listbox is out of focus the scrollbars do not move correspondingly and the selected item is out of visibility.Any help is greatly appreciated.Thanks in advance.
This is a well-known issue with WebParts. It was fixed in the "ASP.NET Futures CTP (July 2007 release)", but for some reason the fix was never added to the framework. The CTP is no longer available, and you wouldn't want to use it in a .NET 4 project anyway.
The problem was reported to Microsoft[^], but they closed it as "won't fix" because it was too complicated to implement.
Application_Error exists in Global.asax.
Most of the unhandled exception are caught here.
While testing, I changed the name of a stored procedure to something that doesn't exist in the database.
Now the control does not come to Application_Error.
When I debug the app, the debugger shows exception when ExecuteReader is called.
I do not have any try...catch
I believe all exceptions must be caught by Application_Error.
But it does not behave so.
«_Superman_» I love work. It gives me something to do between weekends.
Can you share few information?
1. What code is present in your Application_Error? If you remove everything in it and place debugger, does it hit the method?
2. IIS7? CustomError mode in Web.config?
3. Are other methods of Global.asax getting triggered, like Session_start?
4. Is there any other .config file in your application?
My Application_Error contains 3 lines - Server.GetLastError, Server.Transfer and Server.ClearError.
I tried removing all these lines and simply put a return statement on a breakpoint, but it did not hit.
My development environment is IIS 5.1, Windows XP, Visual Studio 2010.
I tried both with customError mode="Off" and customError mode="On" with the same results.
Session_Start is being called in Global.asax and I checked it by placing a breakpoint.
I'm definitely missing something.
It still gave me the same behavior.
So to make sure, I used Windows 8 and Visual Studio 2012.
I created a new application and it still gave me the same behavior.
It hit Session_Start, but did not hit Application_Error.
While debugging the error is shown in Default.aspx.cs and it says SqlException was unhandled by user code and Could not find stored procedure 'StoredProcedure2'.
If I use a try...catch and re-throw the exception from the catch handler, it hits Application_Error.
Anyway, thanks for your time.
«_Superman_» I love work. It gives me something to do between weekends.
I suspected some configuration issue here because the machines were used a lot before and so installed a fresh copy of Windows 8 and Visual Studio 2012.
Now I'm able to get it to work.
Thanks for your time.
Now, since you share further steps, try to disable all code exceptions in VS:
Do Cntrl+Alt+E in Visual Studio and then uncheck all - Application_Error should get hit. I guess it does not work otherwise.
I have one query,If i use a multi-user system in that on main page there is a dashboard consider it as a grid in that grid value of xyz table is displayed.
As it is a multiuser system in that data can be inserted in that xyz table, if any user inserts data in the xyz table as soon as the user inserts the data the changes gets automatically reflected in main page dashboard.
Just like mail systems of gmail and all.
In this tutorial i will let you know how to auto refresh or update GridView using AJAX Timer and UpdatePanel in asp.net. In this it is described that how a GridView is update after a specific time set in timer control.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"%><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title></title></head><body><formid="form1"runat="server"><asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager><asp:UpdatePanelID="UpdatePanel1"runat="server"><ContentTemplate><asp:TimerID="Timer1"Interval="10000"runat="server"ontick="Timer1_Tick"></asp:Timer><div><asp:GridViewID="GridView1"runat="server"></asp:GridView></div><asp:LabelID="update"runat="server"Text="Label"></asp:Label></ContentTemplate></asp:UpdatePanel></form></body></html>
public partial class _Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
protected void Timer1_Tick(object sender, EventArgs e)
update.Text = " Gridview Was Last Updated at " + DateTime.Now;
public void databind()
string strcon = ConfigurationManager.ConnectionStrings["con"].ConnectionString;
SqlConnection conn = new SqlConnection(strcon);
string str = "select * from dept";
SqlCommand cmd = new SqlCommand(str, conn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
GridView1.DataSource = dt;
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore, Dream. Discover.
I am getting the below error in my ASP.NET 4.0 web application:
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
I started getting this error when I added the below tag in web.config to encrypt the viewstate:
I looked for lot of solutions on aspnet forums and Internet but nothing worked. If I change the viewStateEncryptionMode to "Auto" or "Never", then the page loads fine. But that would make my application insecure and security is my prime objective.
FYI:My application is deployed on a Windows 2008 R2 server and not on a webfarm.
Any solution to solve this issue?
First, just to check the simplest solution, you aren't posting back "old" pages are you? By this I mean getting the page when the viewstateEncryptionMode is off/auto, switching the mode to on then posting back. This wide cause the error, but is unlikely Tokyo are doing this.
This problem is ringing a bell, but I can't place my finger on it. You might be suffering from this http://blogs.msdn.com/b/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx (On my mobile so can't make clickety),though this was fixed IIRC.
I am trying to create a column that will always have remaining width. However I want it consist of 3 divs as the middle div will always fill the width available where as the left and right divs will be a fixed width. The problem I have is that the middle div which has remaining width knocks the other divs onto a new line. How can I prevent this?
Appear on Left, this would be fixed width
Always be remainging width
Appear Right, this would be fixed width
something the left div will have no controls in it.
many thanks in adavance
I'm working on my mobile, so apologies in advance for the lack of formatting / example code.
In principle it's pretty simple, once you know how:
1. Create a div as a container.
2. Into the above place three divs left,right and middle in that order
3. Using CSS float the left div left and the right div. ALSO set the widths
4. Using CSS set the left margin and right margin of the middle div so
it doesn't run round the divs on the edge.
You might also need to Google cleafix if you want to support other browsers.
A round up of the above can be seen here:
Left column content.
Right column content.
Main column content.
/* If the main column is preceded by a left column, add a left margin: */
.left-column ~ .main-column
/* If the main column is preceded by a right column, add a right margin: */
.right-column ~ .main-column
/* Clear the column floats: */
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer