Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Thursday, March 29, 2012

newbie: Instance failure!

Hey

asp.net 2.0

When I run the code below I get the runtime error "Instance Failure"

public static ICollection getInbox()
{
ArrayList al = new ArrayList();
ConnectionStringSettings css =
ConfigurationManager.ConnectionStrings["aspnet_DB"];
SqlDataSource sds = new SqlDataSource(css.ConnectionString, "SELECT
UserName from aspnet_Users");
try
{
IEnumerable INames = sds.Select(DataSourceSelectArguments.Empty);
foreach (DataRowView row in INames)
{
al.Add(row["UserName"]);
}
}
catch (SqlException sqlException)
{
Debug.WriteLine(sqlException.Message.ToString());
}
sds.Dispose();
return al;
}

The error occur at this line:
"IEnumerable INames = sds.Select(DataSourceSelectArguments.Empty);"

Just in case, here is a copy of my web.config file:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
</appSettings>
<connectionStrings>
<add name="aspnet_DB" connectionString="Data
Source=.\\SQLEXPRESS;Integrated
Security=True;AttachDBFilename=|DataDirectory|aspn etdb.mdf;User
Instance=true" />
</connectionStrings>
<system.web>
<roleManager enabled="true"/>
<authentication mode="Forms"/>
<compilation debug="true"/>
<profile enabled="true">
<properties>
<add name="Picture" type="System.Byte[]" />
<add name="PictureType" type="string" />
</properties>
</profile>
</system.web>
</configuration>

My gut feeling tells me it might be caused by the db connectionsting, but
I'm not sure... I'm trying to connect to the express database within the
project!

Any suggestions to what I should do to fix this?

Jeff"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:ueLDl0PnGHA.1444@.TK2MSFTNGP02.phx.gbl...
> Hey
>
> asp.net 2.0
>
> When I run the code below I get the runtime error "Instance Failure"
>
> public static ICollection getInbox()
> {
> ArrayList al = new ArrayList();
> ConnectionStringSettings css =
> ConfigurationManager.ConnectionStrings["aspnet_DB"];
> SqlDataSource sds = new SqlDataSource(css.ConnectionString, "SELECT
> UserName from aspnet_Users");
> try
> {
> IEnumerable INames = sds.Select(DataSourceSelectArguments.Empty);
> foreach (DataRowView row in INames)
> {
> al.Add(row["UserName"]);
> }
> }
> catch (SqlException sqlException)
> {
> Debug.WriteLine(sqlException.Message.ToString());
> }
> sds.Dispose();
> return al;
> }
>
> The error occur at this line:
> "IEnumerable INames = sds.Select(DataSourceSelectArguments.Empty);"
>
> Just in case, here is a copy of my web.config file:
> <?xml version="1.0"?>
> <configuration
> xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
> <appSettings>
> </appSettings>
> <connectionStrings>
> <add name="aspnet_DB" connectionString="Data
> Source=.\\SQLEXPRESS;Integrated
> Security=True;AttachDBFilename=|DataDirectory|aspn etdb.mdf;User
> Instance=true" />
> </connectionStrings>
> <system.web>
> <roleManager enabled="true"/>
> <authentication mode="Forms"/>
> <compilation debug="true"/>
> <profile enabled="true">
> <properties>
> <add name="Picture" type="System.Byte[]" />
> <add name="PictureType" type="string" />
> </properties>
> </profile>
> </system.web>
> </configuration>
>
> My gut feeling tells me it might be caused by the db connectionsting, but
> I'm not sure... I'm trying to connect to the express database within the
> project!
>
> Any suggestions to what I should do to fix this?
>
> Jeff
>

Monday, March 26, 2012

NEWBIE: passing error to javascript alert

Hello,
is there a way call a javascript function directly from within asp
page?
Example, here is page load event in C#

protected void Page_Load(object sender, EventArgs e){

// create error
int Var0 = 0;
try {
int iVar1 = 8/Var0;
}

catch (Exception ex){

string sExMsg = ex.Message;

//javascript works fine with string constant
Response.Write("<script type='text/javascript'>alert('In Catch');</
script>");

//can write error to page no problem
Response.Write(sExMsg);

// would like a popup with error
Response.Write("<script language='javascript'>doAlert(" + sExMsg +
");</script>");
Response.Write("<script language='javascript'>function doAlert(sExMsg)
{alert(sExMsg);}</script>");

//write error to log since I can't pop-it-up
//StreamWriter sw = File.AppendText(Server.MapPath("~/error.log"));
//sw.WriteLine(sExMsg);
//sw.Close();

}

}

Any help for a newbie is appreciated

Gi<gijeet@.yahoo.comwrote in message
news:1193076186.658316.66870@.e9g2000prf.googlegrou ps.com...

Quote:

Originally Posted by

Any help for a newbie is appreciated


ClientScript.RegisterStartupScript(GetType(), "error", "alert('In Catch');",
true);

--
Mark Rae
ASP.NET MVP
http://www.markrae.net
ClientScript.RegisterStartupScript(GetType(), "error", "alert('In Catch');",

Quote:

Originally Posted by

true);


Thanks but not sure how to use this. Where do I put this? class
level before page load event? within page load? do I need a
RegisterStartupScript for each alert I wish to use?

Gi
<gijeet@.yahoo.comwrote in message
news:1193079485.948563.150590@.i38g2000prf.googlegr oups.com...

Quote:

Originally Posted by

Quote:

Originally Posted by

>ClientScript.RegisterStartupScript(GetType(), "error", "alert('In
>Catch');",
>true);


>
Thanks but not sure how to use this. Where do I put this?


Wherever you like, so long as you don't Redirect from the page...

Basically, it will send down the JavaScript to run after the page had
loaded...

Quote:

Originally Posted by

do I need a RegisterStartupScript for each alert I wish to use?


Yes.

Incidentally, why are you actually doing this...?

--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Incidentally, why are you actually doing this...?
basically for debugging. I don't like response.writes and I'm trying
to learn javascript. but if you know of a better way to popup alerts,
let me know.
use the debugger to debug. alert debugging is asp classic style :)

"gijeet@.yahoo.com" wrote:

Quote:

Originally Posted by

Quote:

Originally Posted by

Incidentally, why are you actually doing this...?


basically for debugging. I don't like response.writes and I'm trying
to learn javascript. but if you know of a better way to popup alerts,
let me know.
>
>
>
>
>
>


This can help you:
How to Pass Messages and Actions between Server and Client
http://usableasp.net/DeveloperPage...erAndClient.htm
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
<gijeet@.yahoo.comwrote in message
news:1193076186.658316.66870@.e9g2000prf.googlegrou ps.com...

Quote:

Originally Posted by

Hello,
is there a way call a javascript function directly from within asp
page?
Example, here is page load event in C#
>
protected void Page_Load(object sender, EventArgs e){
>
// create error
int Var0 = 0;
try {
int iVar1 = 8/Var0;
}
>
catch (Exception ex){
>
string sExMsg = ex.Message;
>
>
//javascript works fine with string constant
Response.Write("<script type='text/javascript'>alert('In Catch');</
script>");
>
//can write error to page no problem
Response.Write(sExMsg);
>
// would like a popup with error
Response.Write("<script language='javascript'>doAlert(" + sExMsg +
");</script>");
Response.Write("<script language='javascript'>function doAlert(sExMsg)
{alert(sExMsg);}</script>");
>
//write error to log since I can't pop-it-up
//StreamWriter sw = File.AppendText(Server.MapPath("~/error.log"));
//sw.WriteLine(sExMsg);
//sw.Close();
>
}
>
}
>
Any help for a newbie is appreciated
>
Gi
>


"Eliyahu Goldin" <REMOVEALLCAPITALSeEgGoldDinN@.mMvVpPsS.orgwrote in
message news:%23DynzGXFIHA.4880@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

This can help you:
How to Pass Messages and Actions between Server and Client
http://usableasp.net/DeveloperPage...erAndClient.htm


Not much use in this particular case, though, as the OP's requirements for
this were for debugging a la ASP Classic...

--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Newbie: parser error when using a Literal tag

Here goes.. I'm starting with a working application and am trying to make some modifications and things aren't going well.

I wanted to add a Literal tag to a page like in this article:
http://www.odetocode.com/Code/82.aspx

But I keep getting a parser error on my page:
Parser Error Message: The base class includes the field 'stylesheet', but its type (System.Web.UI.WebControls.Literal) is not compatible with the type of control (System.Web.UI.HtmlControls.HtmlGenericControl).

Here's my code:
-- from .aspx:


<LINK href="http://links.10026.com/?link=<asp:Literal id="stylesheet" runat="Server" />" type="text/css" rel="stylesheet">

-- from .aspx.vb:


Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data.SqlClient
Imports System.Text
Imports System.Web.Security
Imports blueinc.BusinessLogicLayer
Imports blueinc.DataAccessLayer

Namespace myCompany.Web

Public Class _default
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub
Protected WithEvents dlEvents As System.Web.UI.WebControls.DataList
Protected WithEvents PlaceHolder As System.Web.UI.WebControls.PlaceHolder
Protected WithEvents lnkRegister As System.Web.UI.WebControls.LinkButton
Protected WithEvents lblUserLoggedOn As System.Web.UI.WebControls.Label
Protected WithEvents Separator As System.Web.UI.WebControls.Label
Protected WithEvents lnkLogOff As System.Web.UI.WebControls.LinkButton
Protected WithEvents dgClinics As System.Web.UI.WebControls.DataGrid

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Dim EventsTable As BusinessLogicLayer.Events = New BusinessLogicLayer.Events
Public ClinicsTable As BusinessLogicLayer.Clinics = New BusinessLogicLayer.Clinics
Protected stylesheet As System.Web.UI.WebControls.Literal

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim uc As Control = Page.LoadControl("UserControls/Login.ascx")

If Not Request.IsAuthenticated Then
PlaceHolder.Controls.Add(uc)
lblUserLoggedOn.Visible = False
lnkLogOff.Visible = False
Else
Dim UserDetails As myCompany.BusinessLogicLayer.UserDetails
UserDetails = Session("UserDetails")

PlaceHolder.Controls.Remove(uc)
If Not IsNothing(UserDetails.UserName) Then
lblUserLoggedOn.Text = "Currently logged on as " & UserDetails.UserName
Else
lblUserLoggedOn.Text = "Authenticated but logged on as NO-ONE!"
End If
lblUserLoggedOn.Visible = True
lnkLogOff.Visible = True

End If

If Not IsPostBack Then
dlEvents.DataSource = EventsTable.GetList
dlEvents.DataBind()

dgClinics.DataSource = ClinicsTable.GetList
dgClinics.DataBind()

Dim OrgName As String

OrgName = Session("org")
If OrgName = "" Then
OrgName = Request("org")
End If
If OrgName = "" Then
OrgName = "foo"
End If

stylesheet.Text = OrgName & "/styles.css"
End If

End Sub

I would have snipped the code-behind, but I figured I'd end up snipping the offending line... I'd be happy to provide more info if required.

J<LINK href="http://links.10026.com/?link=" type="text/css" rel="stylesheet" id="stylesheet" runat="server" />

Protected WithEvents stylesheet As System.Web.UI.HtmlControls.HtmlGenericControl

' code:
stylesheet.Attributes.Add("href", "whatever value")


I think you're confusing the parser with nested tags. Try to make stylesheet a string instead of a literal and inject its value using <%= %>.
Even better, make the LINK tag runat=server (and declare it as a HtmlGenericControl in the code-behind) and set its properties using the Attributes collection.
Thank you both, its working now. I am making the link runat=server.

And when I took the literal out of the <link/> it also worked, so at least I know what the problem was!

Cheers,
J

Saturday, March 24, 2012

newbie: runtime error

Hey
asp.net 2.0
When I run the code below I get a runtime error ("Object reference not set
to an instance of an object. "):
Here is the code:
public static ICollection getInbox()
{
ArrayList al = new ArrayList();
ConnectionStringSettings css =
ConfigurationManager.ConnectionStrings["aspnet_DB"];
SqlDataSource sds = new SqlDataSource(css.ConnectionString, "SELECT
UserName from aspnet_Users");
try
{
IEnumerable INames = sds.Select(DataSourceSelectArguments.Empty);
foreach (DataRowView row in INames)
{
al.Add(row["UserName"]);
}
}
catch (SqlException sqlException)
{
Debug.WriteLine(sqlException.Message.ToString());
}
sds.Dispose();
return al;
}
The error occur at this line in the code:
SqlDataSource sds = new SqlDataSource(css.ConnectionString, "SELECT
UserName from aspnet_Users");
Just in case here is my web.config file:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="aspnet_DB" value="Data Source=.\\SQLEXPRESS;Integrated
Security=True;AttachDBFilename=|DataDire
ctory|aspnetdb.mdf;User
Instance=true" />
</appSettings>
<system.web>
<roleManager enabled="true"/>
<authentication mode="Forms"/>
<compilation debug="true"/>
<profile enabled="true">
<properties>
<add name="Picture" type="System.Byte[]" />
<add name="PictureType" type="string" />
</properties>
</profile>
</system.web>
</configuration>
Any ideas what I'm doing wrong here?
JeffJeff wrote:
> Hey
> asp.net 2.0
>
> When I run the code below I get a runtime error ("Object reference not set
> to an instance of an object. "):
> Here is the code:
> public static ICollection getInbox()
> {
> ArrayList al = new ArrayList();
> ConnectionStringSettings css =
> ConfigurationManager.ConnectionStrings["aspnet_DB"];
> SqlDataSource sds = new SqlDataSource(css.ConnectionString, "SELECT
> UserName from aspnet_Users");
> try
> {
> IEnumerable INames = sds.Select(DataSourceSelectArguments.Empty);
> foreach (DataRowView row in INames)
> {
> al.Add(row["UserName"]);
> }
> }
> catch (SqlException sqlException)
> {
> Debug.WriteLine(sqlException.Message.ToString());
> }
> sds.Dispose();
> return al;
> }
> The error occur at this line in the code:
> SqlDataSource sds = new SqlDataSource(css.ConnectionString, "SELECT
> UserName from aspnet_Users");
> Just in case here is my web.config file:
> <?xml version="1.0"?>
> <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"
> <appSettings>
> <add key="aspnet_DB" value="Data Source=.\\SQLEXPRESS;Integrated
> Security=True;AttachDBFilename=|DataDire
ctory|aspnetdb.mdf;User
> Instance=true" />
> </appSettings>
> <system.web>
> <roleManager enabled="true"/>
> <authentication mode="Forms"/>
> <compilation debug="true"/>
> <profile enabled="true">
> <properties>
> <add name="Picture" type="System.Byte[]" />
> <add name="PictureType" type="string" />
> </properties>
> </profile>
> </system.web>
> </configuration>
> Any ideas what I'm doing wrong here?
> Jeff
Hi Jeff,
If looks like css is null. I'm guessing this is because there is no
<connectionStrings> in the web.config.
See http://www.devx.com/dotnet/Article/27562
David Hogue

newbie: runtime error

Hey

asp.net 2.0

When I run the code below I get a runtime error ("Object reference not set
to an instance of an object. "):

Here is the code:

public static ICollection getInbox()
{
ArrayList al = new ArrayList();
ConnectionStringSettings css =
ConfigurationManager.ConnectionStrings["aspnet_DB"];
SqlDataSource sds = new SqlDataSource(css.ConnectionString, "SELECT
UserName from aspnet_Users");
try
{
IEnumerable INames = sds.Select(DataSourceSelectArguments.Empty);
foreach (DataRowView row in INames)
{
al.Add(row["UserName"]);
}
}
catch (SqlException sqlException)
{
Debug.WriteLine(sqlException.Message.ToString());
}
sds.Dispose();
return al;
}

The error occur at this line in the code:
SqlDataSource sds = new SqlDataSource(css.ConnectionString, "SELECT
UserName from aspnet_Users");

Just in case here is my web.config file:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="aspnet_DB" value="Data Source=.\\SQLEXPRESS;Integrated
Security=True;AttachDBFilename=|DataDirectory|aspn etdb.mdf;User
Instance=true" />
</appSettings>
<system.web>
<roleManager enabled="true"/>
<authentication mode="Forms"/>
<compilation debug="true"/>
<profile enabled="true">
<properties>
<add name="Picture" type="System.Byte[]" />
<add name="PictureType" type="string" />
</properties>
</profile>
</system.web>
</configuration>

Any ideas what I'm doing wrong here?

JeffJeff wrote:
> Hey
>
> asp.net 2.0
>
>
> When I run the code below I get a runtime error ("Object reference not set
> to an instance of an object. "):
>
> Here is the code:
>
> public static ICollection getInbox()
> {
> ArrayList al = new ArrayList();
> ConnectionStringSettings css =
> ConfigurationManager.ConnectionStrings["aspnet_DB"];
> SqlDataSource sds = new SqlDataSource(css.ConnectionString, "SELECT
> UserName from aspnet_Users");
> try
> {
> IEnumerable INames = sds.Select(DataSourceSelectArguments.Empty);
> foreach (DataRowView row in INames)
> {
> al.Add(row["UserName"]);
> }
> }
> catch (SqlException sqlException)
> {
> Debug.WriteLine(sqlException.Message.ToString());
> }
> sds.Dispose();
> return al;
> }
>
> The error occur at this line in the code:
> SqlDataSource sds = new SqlDataSource(css.ConnectionString, "SELECT
> UserName from aspnet_Users");
>
> Just in case here is my web.config file:
> <?xml version="1.0"?>
> <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
> <appSettings>
> <add key="aspnet_DB" value="Data Source=.\\SQLEXPRESS;Integrated
> Security=True;AttachDBFilename=|DataDirectory|aspn etdb.mdf;User
> Instance=true" />
> </appSettings>
> <system.web>
> <roleManager enabled="true"/>
> <authentication mode="Forms"/>
> <compilation debug="true"/>
> <profile enabled="true">
> <properties>
> <add name="Picture" type="System.Byte[]" />
> <add name="PictureType" type="string" />
> </properties>
> </profile>
> </system.web>
> </configuration>
>
> Any ideas what I'm doing wrong here?
>
> Jeff

Hi Jeff,

If looks like css is null. I'm guessing this is because there is no
<connectionStrings> in the web.config.

See http://www.devx.com/dotnet/Article/27562
--
David Hogue

Thursday, March 22, 2012

Newbie:Simple 'textbox' causing this error ?

In VS 2005, I attempt to build my VB (.aspx) application:
I simply drag and drop a Label text and a "textbox".
When I hit F5, I get the error below. Obviously it is being caused by
something missing the in the 'textbox' property. What's wrong ?
Server Error in '/P2' Application.
----
--
Control 'TextBox1' of type 'TextBox' must be placed inside a form tag with
runat=server.
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.Web.HttpException: Control 'TextBox1' of type
'TextBox' must be placed inside a form tag with runat=server.
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:
[HttpException (0x80004005): Control 'TextBox1' of type 'TextBox' must be
placed inside a form tag with runat=server.]
System.Web.UI.Page.VerifyRenderingInServerForm(Control control) +160
System.Web.UI.WebControls.TextBox.AddAttributesToRender(HtmlTextWriter
writer) +45
System.Web.UI.WebControls.WebControl.RenderBeginTag(HtmlTextWriter
writer) +22
System.Web.UI.WebControls.TextBox.Render(HtmlTextWriter writer) +22
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +61
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
adapter) +302
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +31
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +167
System.Web.UI.Page.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +61
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
adapter) +302
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +31
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6607
----
--
Version Information: Microsoft .NET Framework Version:2.0.40607.16; ASP.NET
Version:2.0.40607.16
Here is the source code:
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs)
End Sub
Sub TextBox1_TextChanged1(ByVal sender As Object, ByVal e As
System.EventArgs)
End Sub
</script>
<script language="javascript" type="text/javascript" for="document"
event="ondatasetcomplete">
<!--
return document_ondatasetcomplete()
// -->
</script>
<script language="javascript" type="text/javascript">
<!--
function document_ondatasetcomplete() {
}
// -->
</script>
<span style="font-family: Tahoma; background-color: #ffffff"></span>
<br />
<table enableviewstate="true">
<tr>
<td style="width: 325px">
<asp:label id="Label1" runat="server" text="1. What's your
favorite pet's name ?" width="311px" height="19px"></asp:label>
</td>
<td style="width: 455px">
</td>
</tr>
<tr>
<td style="width: 325px; height: 21px">
<asp:label id="Label2" runat="server" text="2. What's your
mother's birthday ?" width="311px" height="19px"></asp:label>
</td>
<td style="width: 455px; height: 21px">
</td>
</tr>
<tr>
<td style="width: 325px">
<asp:label id="Label3" runat="server" text="3. What's your
father's first name ?" width="311px" height="19px"></asp:label>
</td>
<td style="width: 455px">
</td>
</tr>
</table>
<br />
<asp:textbox id="TextBox1" runat="server"></asp:textbox>Go at design mode of your form, click html view and ensure that
<asp:textbox id="TextBox1" runat="server"></asp:textbox>
control is within <form> tag
you cannot place an asp control outside the <form> tag
"Mr. Magoo" <maggo@.nospasm.com> wrote in message news:<e3bTJqFJFHA.904@.tk2msftngp13.phx.gbl
>...
> In VS 2005, I attempt to build my VB (.aspx) application:
> I simply drag and drop a Label text and a "textbox".
> When I hit F5, I get the error below. Obviously it is being caused by
> something missing the in the 'textbox' property. What's wrong ?
> Server Error in '/P2' Application.
> ----
--
> Control 'TextBox1' of type 'TextBox' must be placed inside a form tag with
> runat=server.
> 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.Web.HttpException: Control 'TextBox1' of type
> 'TextBox' must be placed inside a form tag with runat=server.
> Source Error:
> An unhandled exception was generated during the execution of the current w
eb
> request. Information regarding the origin and location of the exception ca
n
> be identified using the exception stack trace below.
> Stack Trace:
>
> [HttpException (0x80004005): Control 'TextBox1' of type 'TextBox' must be
> placed inside a form tag with runat=server.]
> System.Web.UI.Page.VerifyRenderingInServerForm(Control control) +160
> System.Web.UI.WebControls.TextBox.AddAttributesToRender(HtmlTextWriter
> writer) +45
> System.Web.UI.WebControls.WebControl.RenderBeginTag(HtmlTextWriter
> writer) +22
> System.Web.UI.WebControls.TextBox.Render(HtmlTextWriter writer) +22
> System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
> ControlAdapter adapter) +61
> System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapt
er
> adapter) +302
> System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +31
> System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +167
> System.Web.UI.Page.Render(HtmlTextWriter writer) +32
> System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
> ControlAdapter adapter) +61
> System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapt
er
> adapter) +302
> System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +31
> System.Web.UI.Page.ProcessRequestMain(Boolean
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6607
>
>
> ----
--
> Version Information: Microsoft .NET Framework Version:2.0.40607.16; ASP.NE
T
> Version:2.0.40607.16
> Here is the source code:
> <script runat="server">
> Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
> End Sub
> Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As
> System.EventArgs)
> End Sub
> Sub TextBox1_TextChanged1(ByVal sender As Object, ByVal e As
> System.EventArgs)
> End Sub
> </script>
> <script language="javascript" type="text/javascript" for="document"
> event="ondatasetcomplete">
> <!--
> return document_ondatasetcomplete()
> // -->
> </script>
> <script language="javascript" type="text/javascript">
> <!--
> function document_ondatasetcomplete() {
> }
> // -->
> </script>
> <span style="font-family: Tahoma; background-color: #ffffff"></span>
> <br />
> <table enableviewstate="true">
> <tr>
> <td style="width: 325px">
> <asp:label id="Label1" runat="server" text="1. What's your
> favorite pet's name ?" width="311px" height="19px"></asp:label>
> </td>
> <td style="width: 455px">
>
> </td>
> </tr>
> <tr>
> <td style="width: 325px; height: 21px">
> <asp:label id="Label2" runat="server" text="2. What's your
> mother's birthday ?" width="311px" height="19px"></asp:label>
> </td>
> <td style="width: 455px; height: 21px">
> </td>
> </tr>
> <tr>
> <td style="width: 325px">
> <asp:label id="Label3" runat="server" text="3. What's your
> father's first name ?" width="311px" height="19px"></asp:label>
> </td>
> <td style="width: 455px">
> </td>
> </tr>
> </table>
> <br />
> <asp:textbox id="TextBox1" runat="server"></asp:textbox>
Hi
Put your TextBox Control inside the Form tag with the property runat =
server like this :
<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1"
runat="server"></asp:TextBox>
</form>
Posted Via mcse.ms Premium Usenet Newsgroup Services
----
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----
http://www.mcse.ms
i have this problem too...
sometimes the code is deleted or isnt added correctly!
is that a bug of VS2005?
Posted Via mcse.ms Premium Usenet Newsgroup Services
----
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----
http://www.mcse.ms

Newbie:Simple textbox causing this error ?

In VS 2005, I attempt to build my VB (.aspx) application:
I simply drag and drop a Label text and a "textbox".

When I hit F5, I get the error below. Obviously it is being caused by
something missing the in the 'textbox' property. What's wrong ?
Server Error in '/P2' Application.
------------------------

Control 'TextBox1' of type 'TextBox' must be placed inside a form tag with
runat=server.
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.Web.HttpException: Control 'TextBox1' of type
'TextBox' must be placed inside a form tag with runat=server.

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:

[HttpException (0x80004005): Control 'TextBox1' of type 'TextBox' must be
placed inside a form tag with runat=server.]
System.Web.UI.Page.VerifyRenderingInServerForm(Con trol control) +160
System.Web.UI.WebControls.TextBox.AddAttributesToR ender(HtmlTextWriter
writer) +45
System.Web.UI.WebControls.WebControl.RenderBeginTa g(HtmlTextWriter
writer) +22
System.Web.UI.WebControls.TextBox.Render(HtmlTextW riter writer) +22
System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
ControlAdapter adapter) +61
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
adapter) +302
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +31
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +167
System.Web.UI.Page.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
ControlAdapter adapter) +61
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
adapter) +302
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +31
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6607

------------------------
Version Information: Microsoft .NET Framework Version:2.0.40607.16; ASP.NET
Version:2.0.40607.16

Here is the source code:
<script runat="server"
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

End Sub

Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs)

End Sub

Sub TextBox1_TextChanged1(ByVal sender As Object, ByVal e As
System.EventArgs)

End Sub
</script>
<script language="javascript" type="text/javascript" for="document"
event="ondatasetcomplete">
<!--
return document_ondatasetcomplete()
// -->
</script
<script language="javascript" type="text/javascript">
<!--

function document_ondatasetcomplete() {

}

// -->
</script>
<span style="font-family: Tahoma; background-color: #ffffff"></span>
<br />
<table enableviewstate="true">
<tr>
<td style="width: 325px">
<asp:label id="Label1" runat="server" text="1. What's your
favorite pet's name ?" width="311px" height="19px"></asp:label>
</td>
<td style="width: 455px">

</td>
</tr>
<tr>
<td style="width: 325px; height: 21px">
<asp:label id="Label2" runat="server" text="2. What's your
mother's birthday ?" width="311px" height="19px"></asp:label>
</td>
<td style="width: 455px; height: 21px">
</td>
</tr>
<tr>
<td style="width: 325px">
<asp:label id="Label3" runat="server" text="3. What's your
father's first name ?" width="311px" height="19px"></asp:label>
</td>
<td style="width: 455px">
</td>
</tr>
</table>
<br />
<asp:textbox id="TextBox1" runat="server"></asp:textboxGo at design mode of your form, click html view and ensure that
<asp:textbox id="TextBox1" runat="server"></asp:textbox>
control is within <form> tag
you cannot place an asp control outside the <form> tag

"Mr. Magoo" <maggo@.nospasm.com> wrote in message news:<e3bTJqFJFHA.904@.tk2msftngp13.phx.gbl>...
> In VS 2005, I attempt to build my VB (.aspx) application:
> I simply drag and drop a Label text and a "textbox".
> When I hit F5, I get the error below. Obviously it is being caused by
> something missing the in the 'textbox' property. What's wrong ?
> Server Error in '/P2' Application.
> ------------------------
> Control 'TextBox1' of type 'TextBox' must be placed inside a form tag with
> runat=server.
> 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.Web.HttpException: Control 'TextBox1' of type
> 'TextBox' must be placed inside a form tag with runat=server.
> 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:
>
> [HttpException (0x80004005): Control 'TextBox1' of type 'TextBox' must be
> placed inside a form tag with runat=server.]
> System.Web.UI.Page.VerifyRenderingInServerForm(Con trol control) +160
> System.Web.UI.WebControls.TextBox.AddAttributesToR ender(HtmlTextWriter
> writer) +45
> System.Web.UI.WebControls.WebControl.RenderBeginTa g(HtmlTextWriter
> writer) +22
> System.Web.UI.WebControls.TextBox.Render(HtmlTextW riter writer) +22
> System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
> ControlAdapter adapter) +61
> System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
> adapter) +302
> System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +31
> System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +167
> System.Web.UI.Page.Render(HtmlTextWriter writer) +32
> System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
> ControlAdapter adapter) +61
> System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
> adapter) +302
> System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +31
> System.Web.UI.Page.ProcessRequestMain(Boolean
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6607
>
>
> ------------------------
> Version Information: Microsoft .NET Framework Version:2.0.40607.16; ASP.NET
> Version:2.0.40607.16
> Here is the source code:
> <script runat="server">
> Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
> End Sub
> Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As
> System.EventArgs)
> End Sub
> Sub TextBox1_TextChanged1(ByVal sender As Object, ByVal e As
> System.EventArgs)
> End Sub
> </script>
> <script language="javascript" type="text/javascript" for="document"
> event="ondatasetcomplete">
> <!--
> return document_ondatasetcomplete()
> // -->
> </script>
> <script language="javascript" type="text/javascript">
> <!--
> function document_ondatasetcomplete() {
> }
> // -->
> </script>
> <span style="font-family: Tahoma; background-color: #ffffff"></span>
> <br />
> <table enableviewstate="true">
> <tr>
> <td style="width: 325px">
> <asp:label id="Label1" runat="server" text="1. What's your
> favorite pet's name ?" width="311px" height="19px"></asp:label>
> </td>
> <td style="width: 455px">
>
> </td>
> </tr>
> <tr>
> <td style="width: 325px; height: 21px">
> <asp:label id="Label2" runat="server" text="2. What's your
> mother's birthday ?" width="311px" height="19px"></asp:label>
> </td>
> <td style="width: 455px; height: 21px">
> </td>
> </tr>
> <tr>
> <td style="width: 325px">
> <asp:label id="Label3" runat="server" text="3. What's your
> father's first name ?" width="311px" height="19px"></asp:label>
> </td>
> <td style="width: 455px">
> </td>
> </tr>
> </table>
> <br />
> <asp:textbox id="TextBox1" runat="server"></asp:textbox>
Hi
Put your TextBox Control inside the Form tag with the property runat =
server like this :

<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1"
runat="server"></asp:TextBox>
</form
Posted Via Usenet.com Premium Usenet Newsgroup Services
------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
------------------
http://www.usenet.com
i have this problem too...
sometimes the code is deleted or isnt added correctly!
is that a bug of VS2005?

Posted Via Usenet.com Premium Usenet Newsgroup Services
------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
------------------
http://www.usenet.com

Newbie-Index out of range error

Hello all!

I am trying to get my update button to function from my datagrid. But I
keep getting a index out of range error. I see this post alot, and now I'm
proabably more confused about tha ever. When I hit my edit button, it loads
the right fields into my textboxes, there I can change the info, then hit
save. But then the error pop's up. Now I can add a new record with out any
problem. I do not have a textbox for my ID column, which is my key.
To my understanding, it's not reading the "key" column properly.

I guess i'm not sure what I'm looking for. what would be the line of code
that would cause this problem, or what areas may I look at to make sure I
have it set up right. For all I know, I may not even have the right line of
code in there.
I tried the EditItemIndex = e.item thing, but I'm not sure where to put it.

I'm sorry I don't have my code with me right now, but I can post later
tonite if needed. I know it makes it alot easier to figure out.

As always, thanks!

RudyRudy,

I think it's probably best to post your code. The error typically means
you're trying to update a row (item) but the index or row positions that
you've set is greater than the total number of rows.

Jon

"Rudy" wrote:

> Hello all!
> I am trying to get my update button to function from my datagrid. But I
> keep getting a index out of range error. I see this post alot, and now I'm
> proabably more confused about tha ever. When I hit my edit button, it loads
> the right fields into my textboxes, there I can change the info, then hit
> save. But then the error pop's up. Now I can add a new record with out any
> problem. I do not have a textbox for my ID column, which is my key.
> To my understanding, it's not reading the "key" column properly.
> I guess i'm not sure what I'm looking for. what would be the line of code
> that would cause this problem, or what areas may I look at to make sure I
> have it set up right. For all I know, I may not even have the right line of
> code in there.
> I tried the EditItemIndex = e.item thing, but I'm not sure where to put it.
> I'm sorry I don't have my code with me right now, but I can post later
> tonite if needed. I know it makes it alot easier to figure out.
> As always, thanks!
> Rudy
Hi Jon!
Here is the code that I have.

Private Sub SaveItem()

Dim strSQL As String

If btnSave.CommandArgument = "Add" Then
strSQL = _
"INSERT INTO IMSProducts " & _
" (ProductName, SupplierPart, UnitCost, UnitsInStock, " & _
" Discontinued, UnitSRP, Used) " & _
"VALUES " & _
" (@.ProductName, @.SupplierPart, @.UnitCost, @.UnitsInStock,
" & _
" @.Discontinued, @.UnitSRP, @.Used)"
Else ' The user is updating an existing item.
strSQL = _
"UPDATE IMSProducts " & _
"SET ProductName = @.ProductName, " & _
" SupplierPart = @.SupplierPart, " & _
" UnitSRP = @.UnitSRP, " & _
" UnitCost = @.UnitCost, " & _
" UnitsInStock = @.UnitsInStock, " & _
" Discontinued = @.Discontinued, " & _
" Used = @.Used " & _
"WHERE ProductID = @.ProductID"

End If

Dim Sqlconnection1 As New SqlConnection(SQL_CONNECTION_STRING)
Dim scmd As New SqlCommand(strSQL, Sqlconnection1)

' Add all the required SQL parameters.
With scmd.Parameters
' The ProductID parameter is only needed for updating.
If btnSave.CommandArgument <> "Add" Then
.Add(New SqlParameter("@.ProductID", _
SqlDbType.Int)).Value = _

CInt(grdProducts.DataKeys(grdProducts.SelectedInde x).ToString)
' grdProducts.EditItemIndex = -1
End If

.Add(New SqlParameter("@.ProductName", _
SqlDbType.NVarChar, 40)).Value = txtProductName.Text
.Add(New SqlParameter("@.SupplierPart", _
SqlDbType.NVarChar, 50)).Value = txtSupplier.Text
.Add(New SqlParameter("@.UnitCost", _
SqlDbType.Money)).Value = CDbl(txtCost.Text)
.Add(New SqlParameter("@.UnitSRP", _
SqlDbType.Money)).Value = CDbl(txtSRP.Text)
.Add(New SqlParameter("@.UnitsInStock", _
SqlDbType.Int)).Value = CInt(txtInStock.Text)
.Add(New SqlParameter("@.Discontinued", _
SqlDbType.Bit)).Value = chkDiscontinued.Checked
'.Add(New SqlParameter("@.New", _
' SqlDbType.Bit)).Value = chkNew.Checked
.Add(New SqlParameter("@.Used", _
SqlDbType.Bit)).Value = chkUsed.Checked
End With

Try
Sqlconnection1.Open()
scmd.ExecuteNonQuery()

Cache.Remove("dvProducts")
BindProductsGrid()

strMsg = "Your a star! Product successfully saved to the
database."
pnlForm.Visible = True

Catch exp As Exception
strErrorMsg = "Database error! Product not saved to the " & _
"database. Error message: " & exp.Message
Finally
Sqlconnection1.Close()
End Try
End Sub
Here is the code for the save btn.
' This routine handles the "Save Changes" button Click event.
Private Sub btnSave_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSave.Click

If IsValid Then
SaveItem()
txtProductName.Text = ""
txtSupplier.Text = ""
txtCost.Text = ""
txtSRP.Text = ""
txtInStock.Text = ""
chkDiscontinued.Checked = False
chkUsed.Checked = False

End If
End Sub

I hope this makes a little more sense.
Thank you for your time!!

Rudy

"Jon" wrote:

> Rudy,
> I think it's probably best to post your code. The error typically means
> you're trying to update a row (item) but the index or row positions that
> you've set is greater than the total number of rows.
> Jon
> "Rudy" wrote:
> > Hello all!
> > I am trying to get my update button to function from my datagrid. But I
> > keep getting a index out of range error. I see this post alot, and now I'm
> > proabably more confused about tha ever. When I hit my edit button, it loads
> > the right fields into my textboxes, there I can change the info, then hit
> > save. But then the error pop's up. Now I can add a new record with out any
> > problem. I do not have a textbox for my ID column, which is my key.
> > To my understanding, it's not reading the "key" column properly.
> > I guess i'm not sure what I'm looking for. what would be the line of code
> > that would cause this problem, or what areas may I look at to make sure I
> > have it set up right. For all I know, I may not even have the right line of
> > code in there.
> > I tried the EditItemIndex = e.item thing, but I'm not sure where to put it.
> > I'm sorry I don't have my code with me right now, but I can post later
> > tonite if needed. I know it makes it alot easier to figure out.
> > As always, thanks!
> > Rudy

Newbie-Q: 403 Error

I'm just getting started with ASP.NET. I got a 403 error the first time I
tried to run a web site in VS 2005, so I did two things:
1) I confirmed that the IIS default web site was configured for anonymous
access in the MMC Authentication Methods dialog.
2) I gave the Internet Guest account read and write permissions on the
Inetpub\wwwroot folder.
Do I need to do anything else to configure ASP.NET for IIS or for NT file
access? Are there any articles that discuss this aspect of security? Thanks.I spoke too soon-- I'm still getting the 403 error

Newbie-Q: 403 Error

I'm just getting started with ASP.NET. I got a 403 error the first time I
tried to run a web site in VS 2005, so I did two things:

1) I confirmed that the IIS default web site was configured for anonymous
access in the MMC Authentication Methods dialog.

2) I gave the Internet Guest account read and write permissions on the
Inetpub\wwwroot folder.

Do I need to do anything else to configure ASP.NET for IIS or for NT file
access? Are there any articles that discuss this aspect of security? Thanks.I spoke too soon-- I'm still getting the 403 error

Friday, March 16, 2012

newline in constant error

Hi,

I've been getting this error for a long time and haven't been able to figure it out. Up until now I've been doing workarounds to avoid this type of error, but I want to figure out how to fix it without the workarounds.

The error is:
CS1010: Newline in constant

And this is the code:

string scriptString = "<script language=\"JavaScript\" src=\"";
scriptString += appPath + "/js/popupmenu.js\"></script>";

The thing I really don't get is that if I put this exact same code in a cs file it compiles, but if I put it between script tags in an aspx file the error occurs...Hm, I found the answer for anyone who's interested:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;827420

However, why is this behavior by design? Shouldn't the error message be more specific if you're not supposed to put </script> in a string?

Thanks to anyone if they replied before this message gets approved.
Can you show us the full error (including the 5 lines of code that it shows)? There might be more to it.

Newly added asp.net webforms cannot parse

Hi,
I simply try to add new default webforms to my project and none of them
can load.
Has anybody received an error like this?

Thanks,

Do

Parser Error
Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.

Parser Error Message: Could not load type 'nspi1.WebForm3'.

Source Error:

Line 1: <%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm3.aspx.vb" Inherits="nspi1.WebForm3"%>
Line 2: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Line 3: <html
Source File: c:\hosting\webhost4life\member\userb\nspi1.3\WebFo rm3.aspx
Line: 1

-----------------------
--
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573Hi,

Try to rebuild the project and re-load the page in the browser. You might be
having this error as the page class the newly added page inherits from in
its @.Page directive has not been compiled into the code-behind assembly.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Do" <doduong12141214@.hotmail.com> wrote in message
news:e%23KSrMFmDHA.2676@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I simply try to add new default webforms to my project and none of them
> can load.
> Has anybody received an error like this?
> Thanks,
> Do
> Parser Error
> Description: An error occurred during the parsing of a resource required
to
> service this request. Please review the following specific parse error
> details and modify your source file appropriately.
> Parser Error Message: Could not load type 'nspi1.WebForm3'.
> Source Error:
> Line 1: <%@. Page Language="vb" AutoEventWireup="false"
> Codebehind="WebForm3.aspx.vb" Inherits="nspi1.WebForm3"%>
> Line 2: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> Line 3: <html>
> Source File: c:\hosting\webhost4life\member\userb\nspi1.3\WebFo rm3.aspx
> Line: 1
>
> -----------------------
--
> --
> Version Information: Microsoft .NET Framework Version:1.1.4322.573;
ASP.NET
> Version:1.1.4322.573
Hi,

Try to rebuild the project and re-load the page in the browser. You might be
having this error as the page class the newly added page inherits from in
its @.Page directive has not been compiled into the code-behind assembly.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Do" <doduong12141214@.hotmail.com> wrote in message
news:e%23KSrMFmDHA.2676@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I simply try to add new default webforms to my project and none of them
> can load.
> Has anybody received an error like this?
> Thanks,
> Do
> Parser Error
> Description: An error occurred during the parsing of a resource required
to
> service this request. Please review the following specific parse error
> details and modify your source file appropriately.
> Parser Error Message: Could not load type 'nspi1.WebForm3'.
> Source Error:
> Line 1: <%@. Page Language="vb" AutoEventWireup="false"
> Codebehind="WebForm3.aspx.vb" Inherits="nspi1.WebForm3"%>
> Line 2: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> Line 3: <html>
> Source File: c:\hosting\webhost4life\member\userb\nspi1.3\WebFo rm3.aspx
> Line: 1
>
> -----------------------
--
> --
> Version Information: Microsoft .NET Framework Version:1.1.4322.573;
ASP.NET
> Version:1.1.4322.573

NewPageIndex error

Imports System.Data.OleDbImports fish.configuration1Public Class CheckReplyFeedbacksInherits System.Web.UI.PageDim dsAs DataSet#Region" Web Form Designer Generated Code "'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()>Private Sub InitializeComponent()End Sub Protected WithEvents lbCRFBAs System.Web.UI.WebControls.LabelProtected WithEvents lbLoggerAs System.Web.UI.WebControls.LabelProtected WithEvents dtgCheckReplyFIAs System.Web.UI.WebControls.DataGrid'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it.Private designerPlaceholderDeclarationAs System.Object Private Sub Page_Init(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles MyBase.Init'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent()End Sub#End Region Private Sub Page_Load(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles MyBase.Load'Put user code to initialize the page here 'load_data()Dim config1As New fish.configuration1 ds = config1.load_data("select * from feedback") bind_data()End Sub Public Sub page_change(ByVal senderAs Object,ByVal eAs DataGridCommandEventArgs) dtgCheckReplyFI.CurrentPageIndex =e.NewPageIndex'load_data() bind_data()End Sub Private Sub bind_data() dtgCheckReplyFI.DataSource = ds dtgCheckReplyFI.DataBind()End SubEnd Class

hello, im doing a paging grid. may i know what is wrong with this code.. because the code in purple keep giving " NewPageIndex" is not a member of 'System.Web.UI.Webcontrols.DataGridCommandEventArgs'. what should i do?

jellyfied

I see 2 things here:

1. Your DataGrid must contain an attribute specifying which method to fire on the page index change event. You do that like this:

 <asp:DataGrid id="DataGrid1" OnPageIndexChanged="Page_Change" runat="server"></asp:DataGrid>
 
2. Your page_change method contains the wrong definition. This is the correct definition:
Protected Sub Page_Change(ByVal sourceAs Object,ByVal eAs System.Web.UI.WebControls.DataGridPageChangedEventArgs)

Hi
DataGridCommandEventArgs doesnt contain NewPageIndex. You are passing the wrong
event arguments. It should be DataGridPageChangedEventArgs as told by jstawski

Thanks


News_view error

Why am I getting this error....Please help anyone

Robert

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

Source Error:

Line 18: Protected Sub FormView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs)Line 19: Dim view As Data.DataRowView = CType(FormView1.DataItem, Data.DataRowView)Line 20: Dim o As Object = view.Item("staticURL")Line 21: If Not o Is Nothing AndAlso Not IsDBNull(o) ThenLine 22: 'We have a static URL, we need to redirect.


Source File:C:\Documents and Settings\Robert Rucker\My Documents\SwingSet Group, Inc\News_View.aspx Line:20

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.] ASP.news_view_aspx.FormView1_DataBound(Object sender, EventArgs e) in C:\Documents and Settings\Robert Rucker\My Documents\SwingSet Group, Inc\News_View.aspx:20 System.Web.UI.WebControls.BaseDataBoundControl.OnDataBound(EventArgs e) +56 System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +117 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +25 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +140 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +68 System.Web.UI.WebControls.FormView.DataBind() +5 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +61 System.Web.UI.WebControls.FormView.EnsureDataBound() +138 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +67 System.Web.UI.Control.EnsureChildControls() +97 System.Web.UI.Control.PreRenderRecursiveInternal() +50 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5684

FormView1.DataItem is Nothing and therefore access of the Item Property on nothing is "Object reference not set to an instance of an object"

Dim o As Object = view.Item("staticURL")


What should I do then...don't understand...should I change it?