Category Archives: IIS

[RESOLVED] Which table does contain information about web parts

Hi

 

Which table does contain information about web parts?

For example: if I minimize web part zone and I again connect to my web application (even after server restart) this web part zone still will be minimized.

In which table this information is stored?

 

Regards

it is saved in User profile table  ( aspnetdb)   -  dbo.aspnet_Profile table

I think I do not understand something.

I checked this table and this table is empty (I checked aspnetdb database) but information about webpart controls in not lost, after IIS restart I see previously saved settings.

 

How can I check in which exactly database these information are stored?

I my web.config file there are no connection strings so how WebPartManager knows in which database store these information? Can I use my own connection string to specify localization than default?

Hi,

kicaj

I checked this table and this table is empty (I checked aspnetdb database) but information about webpart controls in not lost, after IIS restart I see previously saved settings.

 

Do you use the default personalization, profile provider or a custom provider?

As far as I know, by default, all the ASP.NET 2.0 applciation services(include membership, rolemanager, profile, personalization ...)are using Sql provider and the connection string is pointing to a local sqlexpress database file(in App_Data folder) or MS SQL Server.

Such as:

 <profile enabled="true" defaultProvider="AspNetSqlProfileProvider">
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider"  type="System.Web.Profile.SqlProfileProvider" connectionStringName="NorthwindConnectionString" applicationName="/"/>
      </providers>
      <properties>
        <add name="LastName" allowAnonymous="true" type="System.String"/>
        <add name="Sex" allowAnonymous="true" type="System.String"/>
        <add name="Age"  allowAnonymous="true" type="System.Int16"/>
      </properties>
    </profile>

Here's some walkthrough for Personalization with Profiles and Web Parts:

http://www.informit.com/articles/article.aspx?p=703789

http://msdn.microsoft.com/en-us/library/aa479037.aspx

 

kicaj

I my web.config file there are no connection strings so how WebPartManager knows in which database store these information

And also I found some articles refer that Web Parts Manager personalization without SQLExpress, you can check it:

http://benharrell.wordpress.com/2006/07/26/web-parts-manager-personalization-without-sqlexpress/

http://www.kowitz.net/archive/2006/05/01/webparts-without-sqlexpress-or-sqlserver

Hope this can help you.

[RESOLVED] Redirect to default page - canonical problem

Hi,

When I tested web site on SEO Tools in IIS7 I get this SEO Error:

------------------------------------------

The page contains multiple canonical formats.

The page with URL "http://www.domain.com/" can also be accessed by using URL "http://www.domain.com/Default.aspx".
Search engines identify unique pages by using URLs.  When a single page can be accessed by using any one of multiple URLs, a search engine assumes that there are multiple unique pages. Use a single URL to reference a page to prevent dilution of page relevance. You can prevent dilution by following a standard URL format.

Recommended action:

Pick a canonical URL format for your site and then ensure that all the links in your site follow that format. (For example, always use lowercase letters.) If an external link that points to your site does not use the canonical URL format, use permanent HTTP redirection to redirect site visitors and search engines to a canonical equivalent of that URL.

-----------------------------------------------------

I tried to solve this by redirect page to a default.aspx. The problem is that HttpContext.Current.Request.Url.ToString(), always shows "http://www.domain.com/Default.aspx". So I can't detect if url typed in browser is only www.domain.com or www.domain.com/Default.aspx.

I know that that can be solved in IIS7, but I can't access it to do that in hosting server.

Is any solution in ASP.NET to redirect to default page any time when in browser is typed only domain name?

Thanks

 

Add the name of the page Default.aspx in the IIS Manager >> Your domain >> Default Document

Hi,


If your site is running on IIS 7, you can use the Url re-write module to fix that.  It even has a rule wizard for working with canonical formats, so you should be up pretty quickly.

Check out this post.


http://weblogs.asp.net/scottgu/archive/2010/04/20/tip-trick-fix-common-seo-problems-using-the-url-rewrite-extension.aspx


Regards


Si

Same Website1, <Skip Navigation Links>appears in another PC.

Im copying whole Website directory from DesktopPC to LaptopPC.
same code same configured Computer,
but <Skip Navigation Links>appears on aspMenu and not working in Laptop.

WebSite have only a page and a asp:menu.
working at DesktopPC but <Skip Navigation Links>appears on aspMenu.and seems totally not working.

Im sure WebSite have no any wrong line.both PC have IE8 & FireFox.couple of these Clients Shows same SkipNavigationLinks.

Im copying same directory to DesktopPC and website working very well.
both PC WinXPx64SP2 & VS.NET Express 2008.

what kind of a reason not allows working same WebSite example in another PC by showing Mystic Skip Navigation Links text instead of rendering a asp:menu?.
any idea ? thanks.

the link you posted above is not useful for an intermediate user.I read that page at May 2000.
But Anyway, thanks.

pointing that,This Weird problem seems at Framework side.or VS.NET IDE side.and I believe will be stay its status unresolved.

How a simple webpage with aspmenu working in one PC and another shows *SLT
without 1 byte changed?

same website directory:totally same bytes...
one PC Renders wrong (*SLT text appears) .Other PC renders very well.

(Note: *SLT = <skip links text>)

Hi,

As far as I know the SkipLinkText property provides a way for the entire control to be skipped by screen readers. If the SkipLinkText property is set, an invisible image with alternate text is rendered, giving the user the option to jump to the end of the control. Screen readers read the alternate text aloud, and the image occupies only one pixel. You can set the SkipLinkText property to an empty string ("") to provide your own mechanism to skip the menu. The SkipLinkText property is set to empty string by default.

I would like to suggest you that please check the links below for the similar threads,hope it can help you.

http://forums.asp.net/p/928390/1084565.aspx

http://forums.asp.net/p/976796/3212427.aspx

 

 

I believe a global setting or IDe side problem.

because

I am copying whole WebSite Directory from PC1 to PC2.asp: menu doesnt working (shows only SLT).

same directory working in another PC.and no any %skip% word found in website directory. So nothing has been set.

how a same website1 directory works in PC1 and gives SLT (skip link text appears and not renders aspmenu)problem in PC2?

same byte directory clone at PC1 & PC2. at PC1 website1 menu is not working.at PC2 everything is okay.

how a IDE setting can be the source of this problem ?

Is it possible that you are not able to get to the generated WebResource.axd file?  Can you check the IIS logs and make sure that these requests are returning 200? 

No using IIS,it is pure VS.NET Integrated server (webdev.server)


Can you use Fiddler to check this? 

[RESOLVED] URL Manipulation

I have an c# web application with URL being;

http://dmhtest/UI/index.aspx

How do I go about making the URL just being the following;

http://dmhtest/UI

?? 

In your IIS console, add default document (index.aspx) for your site. 

Also, you can add 301 redirect in your Global.asax file (BeginRequest event, there you'd check if request is for

index.aspx and do 301 redirect to http://dmhtest/UI)

 

Hope this helps.

This is done using ASP.net MVC framework. If you use .aspx extensions, you are basically pointing to a file in your folder structure. 

Using MVC framework, you are pointing to a controller action which then routes it to the appropriate page.

See this for detailed information.

http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

[RESOLVED] Can't see TreeView from code-behind code page

I have an aspx page with a TreeView control named TreeView1.  in the Page_Load method I am trying to collapse all nodes except for the current node.  I used this code in the Page_Load method:

TreeView1.CollapseAllNodes();
TreeView1.SelectedNode.Expand();

When I try to run this I get the following error:

CS0103: The name 'TreeView1' does not exist in the current context

I am using a .NET 2.0 website and can't seem to reference controls in my .aspx page from within my code-behind page. I tried adding an instance of the TreeView before my Page_Load method call in the code behind, but, it still doesn't create a reference.  What am I missing?

Assuming you haven't misspelled "TreeView1", it looks to me like your .aspx isn't connected to your code-behind.

I'd try:

  • rebuilding the entire solution
  • closing Visual Studio, rebooting computer [please, don't say it, I know, but sometimes...]
  • excluding the page in question from your solution, and then adding it in as a new item, copying markup and code from old to new

If all that fails, could you please post all your markup and code - the entirel page?  With that, I'll have a better chance at spotting something. 

(It makes things a lot more readable if you use the Insert Code tool. If you need instructions, see my How to use the Forums' "Insert Code" tool. post.) 

I have tried your suggestions and didn't get much further.  I think I am missing something a little less complex than that.  This is a .NET 2.0 site.  When I tried to reference the controls in the code-behind page I used this approach:

TreeView TreeView1 = (TreeView)Page.FindControl("TreeView1");


However, when I tried to use tab completion after typing (TreeView)Page. it would not provide the FindControl method.  Is there something about the project config I need to look at?  I have never had this much difficulty referencing code from the code-behind.

FindControl executes at run-time, and should only be used for dynamically created controls, like those inside ItemTemplates, etc.

Assuming that you've created TreeView1 using basic markup, you should be able to replace the above line with this "TreeView TreeView1 = this.TreeView1;".   Better yet, you should be able to refer directly to this.TreeView1 wherever you need to.

If this doesn't help, would you mind posting all your relevant markup and code?

The following page doesn't specifically look for TreeView1, but, it's the same problem.  I cannot see controls from the code-behind.  Here is the .aspx code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="locked_batches.aspx.cs" Inherits="Environments_Model_locked_batches" Src="~/Environments/Model/locked_batches.aspx.cs" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link href="../../Stylesheets/default.css" rel="Stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div id="top"><span class="fiserv">eFichency</span> Reference</div>
        <div id="preferences">
            <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
                onselectedindexchanged="DropDownList1_SelectedIndexChanged"></asp:DropDownList>
        </div>
        <div id="content">
            <table>
                <tr>
                    <td>
                        <asp:SiteMapDataSource ID="SiteMapDataSource" runat="server" />
                        <asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource"
                            ImageSet="Msdn" NodeIndent="10">
                            <HoverNodeStyle BackColor="#CCCCCC" BorderColor="#888888" BorderStyle="Solid"
                                Font-Underline="True" />
                            <NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black"
                                HorizontalPadding="5px" NodeSpacing="1px" VerticalPadding="2px" />
                            <ParentNodeStyle Font-Bold="False" />
                            <SelectedNodeStyle BackColor="White" BorderColor="#888888" BorderStyle="Solid"
                                BorderWidth="1px" Font-Underline="False" HorizontalPadding="3px"
                                VerticalPadding="1px" />
                        </asp:TreeView>
                    </td>
                    <td>
			            Find below information on locked batches.<br/><br/>
                        <asp:Label ID="LabelCount" runat="server" Text="The record count is: "></asp:Label><br /><br />
                        <asp:SqlDataSource ID="sqlDataSource" runat="server"
                            SelectCommand="SELECT [AppID], [BatchID], [UserBatchName], [LastEventDate], [Message], [LockedUserID] FROM [Batch] WHERE (([CurrentEventTypeID] = @CurrentEventTypeID) AND ([Received] = @Received))"
                            connectionString="<%$ ConnectionStrings:ModelFOTNIndexConnectionString %>"
                            onselected="SqlDataSource_Selected">
                            <SelectParameters>
                                <asp:Parameter DefaultValue="10" Name="CurrentEventTypeID" Type="Int32" />
                                <asp:Parameter DefaultValue="2" Name="Received" Type="Int32" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                        <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
                            AllowSorting="True" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None"
                            BorderWidth="1px" CellPadding="4" DataSourceID="SqlDataSource"
                            ForeColor="Black" GridLines="Vertical" PageSize="15" Visible="True"
                            onpageindexchanged="GridView1_PageIndexChanged" onsorted="GridView1_Sorted" >
                            <RowStyle BackColor="#F7F7DE" />
                            <EmptyDataTemplate>
                                No records were found.
                            </EmptyDataTemplate>
                            <FooterStyle BackColor="#CCCC99" />
                            <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                            <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                            <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
                            <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    </form>
</body>
</html>


And, here is the code-behind:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;

public partial class Environments_Model_locked_batches : System.Web.UI.Page
{
		protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DropDownList1.DataSource = IndexDataSource(sqlDataSource);
            DropDownList1.DataBind();
            DropDownList1.Items.Insert(0, "Choose a filter string");
        }
    }

    protected ArrayList IndexDataSource(SqlDataSource sqlDataSource)
    {
        ArrayList indexArrayList = new ArrayList();
        DataTable indexDataTable = new DataTable();
        DataView indexDataView = new DataView();

        indexDataView = (DataView)sqlDataSource.Select(DataSourceSelectArguments.Empty);
        indexDataTable = indexDataView.ToTable();

        foreach (DataRow dataRow in indexDataTable.Rows)
        {
            string[] rowIndex = (dataRow["UserBatchName"].ToString()).Split(' ');
            foreach (string word in rowIndex)
            {
                if (!indexArrayList.Contains(word))
                {
                    indexArrayList.Add(word);
                }
            }
        }

        indexArrayList.Sort();

        return indexArrayList;
    }

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DropDownList1.SelectedValue == "Choose a filter string")
        {
            GridView1.Visible = true;
            GridView1.DataBind();
        }
        else
        {
            sqlDataSource.SelectParameters.Clear();
            sqlDataSource.SelectParameters.Add("UserBatchName", DropDownList1.SelectedValue);
            sqlDataSource.SelectCommand = "SELECT [AppID], [BatchID], [UserBatchName], [LastEventDate], [Message], [LockedUserID] FROM [Batch] WHERE (([CurrentEventTypeID] = @CurrentEventTypeID) AND ([Received] = @Received) OR (UserBatchName LIKE '% ' + @UserBatchName) OR (UserBatchName LIKE @UserBatchName + ' %') OR (UserBatchName LIKE '% ' + @UserBatchName + ' %') OR (UserBatchName = @UserBatchName))";
            GridView1.DataBind();
        }
    }

    protected void GridView1_PageIndexChanged(object sender, EventArgs e)
    {
        if (DropDownList1.SelectedValue == "Choose a filter string")
        {
            GridView1.Visible = true;
            GridView1.DataBind();
        }
        else
        {
            sqlDataSource.SelectParameters.Clear();
            sqlDataSource.SelectParameters.Add("UserBatchName", DropDownList1.SelectedValue);
            sqlDataSource.SelectCommand = "SELECT [AppID], [BatchID], [UserBatchName], [LastEventDate], [Message], [LockedUserID] FROM [Batch] WHERE (([CurrentEventTypeID] = @CurrentEventTypeID) AND ([Received] = @Received) OR (UserBatchName LIKE '% ' + @UserBatchName) OR (UserBatchName LIKE @UserBatchName + ' %') OR (UserBatchName LIKE '% ' + @UserBatchName + ' %') OR (UserBatchName = @UserBatchName))";
            GridView1.DataBind();
        }
    }

    protected void GridView1_Sorted(object sender, EventArgs e)
    {
        if (DropDownList1.SelectedValue == "Choose a filter string")
        {
            GridView1.Visible = true;
            GridView1.DataBind();
        }
        else
        {
            sqlDataSource.SelectParameters.Clear();
            sqlDataSource.SelectParameters.Add("UserBatchName", DropDownList1.SelectedValue);
            sqlDataSource.SelectCommand = "SELECT [AppID], [BatchID], [UserBatchName], [LastEventDate], [Message], [LockedUserID] FROM [Batch] WHERE (([CurrentEventTypeID] = @CurrentEventTypeID) AND ([Received] = @Received) OR (UserBatchName LIKE '% ' + @UserBatchName) OR (UserBatchName LIKE @UserBatchName + ' %') OR (UserBatchName LIKE '% ' + @UserBatchName + ' %') OR (UserBatchName = @UserBatchName))";
            GridView1.DataBind();
        }
    }
    protected void SqlDataSource_Selected(object sender, SqlDataSourceStatusEventArgs e)
    {
        if (DropDownList1.SelectedValue == "Choose a filter string")
        {
            LabelCount.Text = "The record count for all records is: " + e.AffectedRows.ToString();
        }
        else
        {
            LabelCount.Text = "The record count for " + DropDownList1.SelectedValue + " is: " + e.AffectedRows.ToString();
        }

        if (e.Exception != null)
        {
            LabelCount.Visible = false;
            GridView1.EmptyDataText = e.Exception.Message;
        }
    }
}


When I try to run the page, I get this:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error 
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS0103: The name 'DropDownList1' does not exist in the current context

Source Error:

 

Line 15:         if (!IsPostBack)
Line 16:         {
Line 17:             DropDownList1.DataSource = IndexDataSource(sqlDataSource);
Line 18:             DropDownList1.DataBind();
Line 19:             DropDownList1.Items.Insert(0, "Choose a filter string");
 

Source File: c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs    Line: 17 



Show Detailed Compiler Output:


c:\windows\system32\inetsrv> "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe" /t:library /utf8output /R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /out:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\f3c5e0e5\97ac95d6\App_Web_locked_batches.aspx.cs.d4225d1c.bewrivva.dll" /debug- /optimize+ /w:4 /nowarn:1659;1699;1701  "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\f3c5e0e5\97ac95d6\App_Web_locked_batches.aspx.cs.d4225d1c.bewrivva.0.cs" "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\f3c5e0e5\97ac95d6\App_Web_locked_batches.aspx.cs.d4225d1c.bewrivva.1.cs"


Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.3053
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.

c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(17,13): error CS0103: The name 'DropDownList1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(17,56): error CS0103: The name 'sqlDataSource' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(18,13): error CS0103: The name 'DropDownList1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(19,13): error CS0103: The name 'DropDownList1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(51,13): error CS0103: The name 'DropDownList1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(53,13): error CS0103: The name 'GridView1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(54,13): error CS0103: The name 'GridView1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(58,13): error CS0103: The name 'sqlDataSource' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(59,13): error CS0103: The name 'sqlDataSource' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(59,65): error CS0103: The name 'DropDownList1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(60,13): error CS0103: The name 'sqlDataSource' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(61,13): error CS0103: The name 'GridView1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(67,13): error CS0103: The name 'DropDownList1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(69,13): error CS0103: The name 'GridView1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(70,13): error CS0103: The name 'GridView1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(74,13): error CS0103: The name 'sqlDataSource' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(75,13): error CS0103: The name 'sqlDataSource' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(75,65): error CS0103: The name 'DropDownList1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(76,13): error CS0103: The name 'sqlDataSource' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(77,13): error CS0103: The name 'GridView1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(83,13): error CS0103: The name 'DropDownList1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(85,13): error CS0103: The name 'GridView1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(86,13): error CS0103: The name 'GridView1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(90,13): error CS0103: The name 'sqlDataSource' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(91,13): error CS0103: The name 'sqlDataSource' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(91,65): error CS0103: The name 'DropDownList1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(92,13): error CS0103: The name 'sqlDataSource' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(93,13): error CS0103: The name 'GridView1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(98,13): error CS0103: The name 'DropDownList1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(100,13): error CS0103: The name 'LabelCount' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(104,13): error CS0103: The name 'LabelCount' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(104,57): error CS0103: The name 'DropDownList1' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(109,13): error CS0103: The name 'LabelCount' does not exist in the current context
c:\Inetpub\wwwroot\reference\Environments\Model\locked_batches.aspx.cs(110,13): error CS0103: The name 'GridView1' does not exist in the current context

 



Show Complete Compilation Source:


Line 1:    using System;
Line 2:    using System.Collections;
Line 3:    using System.Collections.Generic;
Line 4:    using System.Data;
Line 5:    using System.Data.SqlClient;
Line 6:    using System.Web;
Line 7:    using System.Web.UI;
Line 8:    using System.Web.UI.HtmlControls;
Line 9:    using System.Web.UI.WebControls;
Line 10:   
Line 11:   public partial class Environments_Model_locked_batches : System.Web.UI.Page
Line 12:   {
Line 13:   		protected void Page_Load(object sender, EventArgs e)
Line 14:       {
Line 15:           if (!IsPostBack)
Line 16:           {
Line 17:               DropDownList1.DataSource = IndexDataSource(sqlDataSource);
Line 18:               DropDownList1.DataBind();
Line 19:               DropDownList1.Items.Insert(0, "Choose a filter string");
Line 20:           }
Line 21:       }
Line 22:   
Line 23:       protected ArrayList IndexDataSource(SqlDataSource sqlDataSource)
Line 24:       {
Line 25:           ArrayList indexArrayList = new ArrayList();
Line 26:           DataTable indexDataTable = new DataTable();
Line 27:           DataView indexDataView = new DataView();
Line 28:   
Line 29:           indexDataView = (DataView)sqlDataSource.Select(DataSourceSelectArguments.Empty);
Line 30:           indexDataTable = indexDataView.ToTable();
Line 31:   
Line 32:           foreach (DataRow dataRow in indexDataTable.Rows)
Line 33:           {
Line 34:               string[] rowIndex = (dataRow["UserBatchName"].ToString()).Split(' ');
Line 35:               foreach (string word in rowIndex)
Line 36:               {
Line 37:                   if (!indexArrayList.Contains(word))
Line 38:                   {
Line 39:                       indexArrayList.Add(word);
Line 40:                   }
Line 41:               }
Line 42:           }
Line 43:   
Line 44:           indexArrayList.Sort();
Line 45:   
Line 46:           return indexArrayList;
Line 47:       }
Line 48:   
Line 49:       protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
Line 50:       {
Line 51:           if (DropDownList1.SelectedValue == "Choose a filter string")
Line 52:           {
Line 53:               GridView1.Visible = true;
Line 54:               GridView1.DataBind();
Line 55:           }
Line 56:           else
Line 57:           {
Line 58:               sqlDataSource.SelectParameters.Clear();
Line 59:               sqlDataSource.SelectParameters.Add("UserBatchName", DropDownList1.SelectedValue);
Line 60:               sqlDataSource.SelectCommand = "SELECT [AppID], [BatchID], [UserBatchName], [LastEventDate], [Message], [LockedUserID] FROM [Batch] WHERE (([CurrentEventTypeID] = @CurrentEventTypeID) AND ([Received] = @Received) OR (UserBatchName LIKE '% ' + @UserBatchName) OR (UserBatchName LIKE @UserBatchName + ' %') OR (UserBatchName LIKE '% ' + @UserBatchName + ' %') OR (UserBatchName = @UserBatchName))";
Line 61:               GridView1.DataBind();
Line 62:           }
Line 63:       }
Line 64:   
Line 65:       protected void GridView1_PageIndexChanged(object sender, EventArgs e)
Line 66:       {
Line 67:           if (DropDownList1.SelectedValue == "Choose a filter string")
Line 68:           {
Line 69:               GridView1.Visible = true;
Line 70:               GridView1.DataBind();
Line 71:           }
Line 72:           else
Line 73:           {
Line 74:               sqlDataSource.SelectParameters.Clear();
Line 75:               sqlDataSource.SelectParameters.Add("UserBatchName", DropDownList1.SelectedValue);
Line 76:               sqlDataSource.SelectCommand = "SELECT [AppID], [BatchID], [UserBatchName], [LastEventDate], [Message], [LockedUserID] FROM [Batch] WHERE (([CurrentEventTypeID] = @CurrentEventTypeID) AND ([Received] = @Received) OR (UserBatchName LIKE '% ' + @UserBatchName) OR (UserBatchName LIKE @UserBatchName + ' %') OR (UserBatchName LIKE '% ' + @UserBatchName + ' %') OR (UserBatchName = @UserBatchName))";
Line 77:               GridView1.DataBind();
Line 78:           }
Line 79:       }
Line 80:   
Line 81:       protected void GridView1_Sorted(object sender, EventArgs e)
Line 82:       {
Line 83:           if (DropDownList1.SelectedValue == "Choose a filter string")
Line 84:           {
Line 85:               GridView1.Visible = true;
Line 86:               GridView1.DataBind();
Line 87:           }
Line 88:           else
Line 89:           {
Line 90:               sqlDataSource.SelectParameters.Clear();
Line 91:               sqlDataSource.SelectParameters.Add("UserBatchName", DropDownList1.SelectedValue);
Line 92:               sqlDataSource.SelectCommand = "SELECT [AppID], [BatchID], [UserBatchName], [LastEventDate], [Message], [LockedUserID] FROM [Batch] WHERE (([CurrentEventTypeID] = @CurrentEventTypeID) AND ([Received] = @Received) OR (UserBatchName LIKE '% ' + @UserBatchName) OR (UserBatchName LIKE @UserBatchName + ' %') OR (UserBatchName LIKE '% ' + @UserBatchName + ' %') OR (UserBatchName = @UserBatchName))";
Line 93:               GridView1.DataBind();
Line 94:           }
Line 95:       }
Line 96:       protected void SqlDataSource_Selected(object sender, SqlDataSourceStatusEventArgs e)
Line 97:       {
Line 98:           if (DropDownList1.SelectedValue == "Choose a filter string")
Line 99:           {
Line 100:              LabelCount.Text = "The record count for all records is: " + e.AffectedRows.ToString();
Line 101:          }
Line 102:          else
Line 103:          {
Line 104:              LabelCount.Text = "The record count for " + DropDownList1.SelectedValue + " is: " + e.AffectedRows.ToString();
Line 105:          }
Line 106:  
Line 107:          if (e.Exception != null)
Line 108:          {
Line 109:              LabelCount.Visible = false;
Line 110:              GridView1.EmptyDataText = e.Exception.Message;
Line 111:          }
Line 112:      }
Line 113:  }
 




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618 


Anywhere I have a control from the .aspx page, it shows the same error.  This is just the first control reference it encounters.

Will,

I must admit I'm pretty stumped.  Somehow, the .aspx and the code-behind aren't finding each other.

There's one thing I notice about your page that's different from mine.  In the <@Page> directive, you have a "Src=" attribute that my pages never have.  According to this MSDN article:

"You can use the Src attribute to link build providers to the page. For more information, see the BuildProvider class. Also, in versions of ASP.NET prior to 2.0, the Src attribute was used as an alternative way to link a code-behind file to a page. In ASP.NET 2.0, the preferred approach to linking a code-behind source file to a page is to use the Inherits attribute to specify a class, along with the CodeFile attribute to specify the path to the source file for the class."

That's something I've never needed, and I suggest that you try removing it.

I am beginning to this machine has some gremlins.  I use the Src attribute as a workaround to compiler issue.  It was saying it couldn't find the .cs file.  When I added the Src attribute, which I had never used either, it worked fine.  I am positive I have the site set to ASP.NET 2.0 in IIS, so, I don't think it's a version issue.  If I can't get it figured out soon, I might request a different box.  There are all sorts of weird things on this machine that make no sense.  I just wanted to be sure I wasn't overlooking something obvious.

Will,

Did you try taking the Src back out?

Your CodeFile attribute is where you should resolve the "couldn't find the .cs file" issue.  Based on what's in your <@Page> directive, your code must be in a file named "locked_batches.aspx.cs" which must be in the same directory as the .aspx.

Let me know.

 

AHA! I found another possible fix.

The same MSDN page says:

"[CodeFile] is used for Web site projects. The CodeBehind attribute is used for Web application projects."

In other words, if you are creating a Web Application (as opposed to a Web Site) you should change "CodeFile" to "CodeBehind" in your <@Page>.