I have developed a website in asp.net 2.0 with backend MS SQL server 2005. After each 2-3 days when i try to login to my admin panel i get a /server application error "datatable must be set prior to using dataview ".When I made a research on this i found the error is in the caching part of the code where i am using a dataset to fill my dropdown lists. But I am using the same code everywhere and on other place i didn't get any error but on a specific page. i usually get error when i try to login to admin. After successful login i redirect the admin to a page adminBazaar.aspx. and the error is always thrown by dis page only.other pages with the same code are working fine and there are no issues.I am using SqlCachingDependency. but can't figure out how to solve the problem.Right now to solve this I have to go to the server stop the website,then stop the application pool and the restart both. We have created a separate application pool for the website.
How to select top n rows from a datatable/dataview in asp.net.currently I am using the following code by passing the table and number of rows to get the records but is there a better way.
public DataTable SelectTopDataRow(DataTable dt, int count)
{ DataTable dtn = dt.Clone(); for (int i = 0; i < count; i++) { dtn.ImportRow(dt.Rows[i]); } return dtn; }
HOW TO specify which columns are in a DataView from a DataTable. I want to create a DataView, that only has the columns from a DataTable that I choose, and in the order I want.
Example: // DataTable_MyTable ~~ Column #0 is for ID. I do not want my view to get this column. // DataTable_MyTable ~~ Column #1 is for TYPE. I want this column to come in 2nd place in my view. // DataTable_MyTable ~~ Column #2 is for NAME. I want this column to com in 1st place in my view.
DataView DataView_MyView = new DataView(DataTable_MyTable ~~ some how only get the columns I want, and in the order I want ~~);
// DataView_MyView now has only 2 columns. // DataView_MyView ~~ Column #0 is NAME. // DataView_MyView ~~ Column #1 is TYPE.
I am doing GridView Sorting without ObjectDataSource. For this requirement I need to convert DataTable to DataView, I know I can do that in VS 2008 but How can I do this in VS 2005.
I have a page which lists all the files in a particular folder (all PDFs), using a data-table and gridview.
I'm currently sorting this table by the filename (by using a dataview), which isn't that helpful, and I want the gridview of files sorted by the file created or file modified date (as recorded in Windows).
If that's not possible, a second option would be to extract the date from the file name string (no problem doing that), and sort the dataview/datatable or gridview based on that. Example Filename: DailySalesReport-1-15-2010. My only hangup with this is how do I sort on date, when it's a string value? Convert to date? How would I sort the whole dataset based on this converted value?
I have a submit button that when I click it, I need it to run a script first prior to loading he ConfirmButtonExtender. Can I change the TargetControlID to a sub or a function and after that function is executed, then call ConfirmButtonExtender, or attach it so when the second function is called, it will pop the dialog box up first and then run if OK is clicked.
I have developed a quick module that adds some text to the bottom of every page. This text will basically inform the user they are using my application in a test environment and save me editing the Master/Content pages for all my files.Sadly, my code adds the string AFTER the </html> tag, which isn't very good. Can anyone advise how to make this module add the stringprevious to the </body> tag, so that it gets rendered correctly according the HTML standards?
I have a DropDownList within the ContentTemplate and wonder if there are any special considerations I should be aware of filling the list with data prior to displaying the TabPanel?
I have a web service that was running on Server 2003, IIS6. The service required an SSL connection. The service expects 4 parameters; a User ID, Password, Record ID and the "type" of data requested (one of 5 options). The service validates the user then simply performs a select of the record ID from a table determined by the type specified. This service was up and running for a couple of years. I installed a couple of new servers a couple of months ago. The users that makes use of this service just tried it and couldn't get a response. I checked the server and I hadn't copied the service over. The service is located in a virtual directory under the primary web site.
For example, the site is: [URL] Service virtual directory is "GetITSData" The call to the service has been: [URL] param1, param2, param3, param4 and the service would return the appropriate data. I "assumed" that when I copied the actual contents of the directory over, that the service would then begin functioning again (since it was empty). All IIS snap-in manager items for the virtual directory match the previous settings on the old server (I still have that server available in my office). The main site requires SSL and uses forms authentication. When I create a dummy site in VS2008 and try to add a service reference, I get the following: There was an error downloading [URL]. The request failed with HTTP status 403: Forbidden. Metadata contains a reference that cannot be resolved: [URL]. The remote server returned an unexpected response: (405) Method Not Allowed. The remote server returned an error: (405) Method Not Allowed. If the service is defined in the current solution, try building the solution and adding the service reference again.
I'm using ASP.NET 3.5 (c#) with SQL Server 2008 server. Recently, I started getting error "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.".
After looking at forums for solutions, I added the below common code to my application.
[Code]....
However, intermittently, I'm still getting the timeout error. I added the logging to see where error is occuring. And found that before executing one of the query, it is giving this error. Now, my assumption is that I should have received this error after runnign query for 600 seconds (10 minutes) since I set it in the above function. But the timeout error is occuring instantaneously within 1 second itself. In the log, I printed one line above & after the query to identify how much time it would take. Surprisingly, the log says that 9:00 AM "Before query execution" & at 9:01 AM "timeout expired...."
I have a datagrid with columns programatically populated. I need access to the columns to modify the sort expression prior to render, but the column count is 0 at every stage I try to access them. Break points are hit, but each check of the count = 0.Have tried the following, accessing in various stages of the page / control life cycle, but in all instances, the column count is 0.
protected void Page_PreRenderComplete( object sender, EventArgs e ) { if (dgPriceInfo != null)
I have a gridview control with a Delete command button bound to an Access DataSource. When a Delete button is clicked the corresponding SQL executes, deleting the data row from the database. Is there a way to cause a window to pop up allowing user to confirm the delete? Essentially, I'd like to have something like an "OnClientClick" action for each Delete button in the displayed gridview.
I have a DataGrid that has event handlers bound to SortCommand and PageIndexChanged. How can I determine if those event handlers are about to be called, say on page_load? These events will fire just fine after page_load, but I'd like to know at page_load if they are to be fired.
I have a website that uses basic ASP.Net forms authentication. In the web.config file we specify specific access rules for individual pages and directories. Everything works great.
However, now I have some new requirements. My domain contains many different sites setup among different subdomains. I have two DNS subdomains that map to this application. One is aaa.mysite.com and the other is www.mysite.com. If a particular web request is received from subdomain aaa.mysite.com for a page protected by FormsAuthentication, before the FormsAuthentication logic is handled (the user would be re-directed to the login page), I want to execute some code first. This code would essentially try to read a cookie from a third subdomain, say zzz.mysite.com, and if does not exist, Response.Redirect to a login page in the zzz.mysite.com application.
I tried handling this via a base class that any of my Forms Authentication protected pages could inherit from, and then calling the special code in the Page_PreInit function. However, FormsAuthentication handles the redirect to the Login page even before the PreInit function is called.
Does anyone know a good way to handle this case? If Page_PreInit won't work, where can I put code so that it executes prior to the FormsAuthentication redirect does, but where I also have access to which page it is (and what class it inherits from, so I can see if it inherits from System.Web.UI.Page or if it inherits from my special BasePage).
I think I could use the Globals Application_BeginRequest, but then this would be called for every single request, which doesn't seem like a very good idea.
I can't be the first person who has needed a way to handle an event prior to the FormsAuthentication
I have the problem of Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.