Showing posts with label view. Show all posts
Showing posts with label view. Show all posts

Saturday, March 31, 2012

Strange Behavior for Pages Named Default.aspx

I have several asp.net 2.0 apps written in VS2005 in C#. For each one,
I like to create and track page view events, increment counters, etc.
I do this in a block on each page, like this...
protected void Page_Load(object sender, EventArgs e)
{
if(!this.Page.IsPostBack)
{
Event.Write(EventSource.UserActivity,EventType.Informational,"My
event text");
Counter.Hit(WebPage.MyPage);
}
}
Now, for the problem. I noticed that many events are being written
twice, and many counters are being incremented twice when viewing the
page only once. When I set a breakpoint inside the code block above,
for any page named "Default.aspx" (no matter where it is in the folder
structure) the lines inside the code block execute twice. If I rename
the page to something else, they execute only once, as expected.
Does anyone know what causes this? How can I fix it?Hi Joey,
Seems page events are fired twice because event handler is assigned two
times - by the AutoWireupEvent directive and by your code by adding the
handler explicitely (vb.net AddHandler or Handles clauses)
Milosz
"Joey" wrote:

> I have several asp.net 2.0 apps written in VS2005 in C#. For each one,
> I like to create and track page view events, increment counters, etc.
> I do this in a block on each page, like this...
> protected void Page_Load(object sender, EventArgs e)
> {
> if(!this.Page.IsPostBack)
> {
> Event.Write(EventSource.UserActivity,EventType.Informational,"My
> event text");
> Counter.Hit(WebPage.MyPage);
> }
> }
> Now, for the problem. I noticed that many events are being written
> twice, and many counters are being incremented twice when viewing the
> page only once. When I set a breakpoint inside the code block above,
> for any page named "Default.aspx" (no matter where it is in the folder
> structure) the lines inside the code block execute twice. If I rename
> the page to something else, they execute only once, as expected.
> Does anyone know what causes this? How can I fix it?
>
On Jun 27, 5:38 pm, Milosz Skalecki [MCAD] <mily...@.DONTLIKESPAMwp.pl>
wrote:
> Hi Joey,
> Seems page events are fired twice because event handler is assigned two
> times - by the AutoWireupEvent directive and by your code by adding the
> handler explicitely (vb.net AddHandler or Handles clauses)
> --
> Milosz
>
> "Joey" wrote:
>
>
>
> - Show quoted text -
My code does not explicitly assign any event handlers.
Hi again Joey,
I hope you are well. Could you please paste both aspx page and code beside
so we could have a look?
--
Milosz
"Joey" wrote:

> On Jun 27, 5:38 pm, Milosz Skalecki [MCAD] <mily...@.DONTLIKESPAMwp.pl>
> wrote:
> My code does not explicitly assign any event handlers.
>

Strange Behavior for Pages Named Default.aspx

I have several asp.net 2.0 apps written in VS2005 in C#. For each one,
I like to create and track page view events, increment counters, etc.
I do this in a block on each page, like this...

protected void Page_Load(object sender, EventArgs e)
{
if(!this.Page.IsPostBack)
{
Event.Write(EventSource.UserActivity,EventType.Inf ormational,"My
event text");
Counter.Hit(WebPage.MyPage);
}
}

Now, for the problem. I noticed that many events are being written
twice, and many counters are being incremented twice when viewing the
page only once. When I set a breakpoint inside the code block above,
for any page named "Default.aspx" (no matter where it is in the folder
structure) the lines inside the code block execute twice. If I rename
the page to something else, they execute only once, as expected.

Does anyone know what causes this? How can I fix it?Hi Joey,

Seems page events are fired twice because event handler is assigned two
times - by the AutoWireupEvent directive and by your code by adding the
handler explicitely (vb.net AddHandler or Handles clauses)

--
Milosz

"Joey" wrote:

Quote:

Originally Posted by

I have several asp.net 2.0 apps written in VS2005 in C#. For each one,
I like to create and track page view events, increment counters, etc.
I do this in a block on each page, like this...
>
protected void Page_Load(object sender, EventArgs e)
{
if(!this.Page.IsPostBack)
{
Event.Write(EventSource.UserActivity,EventType.Inf ormational,"My
event text");
Counter.Hit(WebPage.MyPage);
}
}
>
Now, for the problem. I noticed that many events are being written
twice, and many counters are being incremented twice when viewing the
page only once. When I set a breakpoint inside the code block above,
for any page named "Default.aspx" (no matter where it is in the folder
structure) the lines inside the code block execute twice. If I rename
the page to something else, they execute only once, as expected.
>
Does anyone know what causes this? How can I fix it?
>
>


On Jun 27, 5:38 pm, Milosz Skalecki [MCAD] <mily...@.DONTLIKESPAMwp.pl>
wrote:

Quote:

Originally Posted by

Hi Joey,
>
Seems page events are fired twice because event handler is assigned two
times - by the AutoWireupEvent directive and by your code by adding the
handler explicitely (vb.net AddHandler or Handles clauses)
>
--
Milosz
>
>
>
"Joey" wrote:

Quote:

Originally Posted by

I have several asp.net 2.0 apps written in VS2005 in C#. For each one,
I like to create and track page view events, increment counters, etc.
I do this in a block on each page, like this...


>

Quote:

Originally Posted by

protected void Page_Load(object sender, EventArgs e)
{
if(!this.Page.IsPostBack)
{
Event.Write(EventSource.UserActivity,EventType.Inf ormational,"My
event text");
Counter.Hit(WebPage.MyPage);
}
}


>

Quote:

Originally Posted by

Now, for the problem. I noticed that many events are being written
twice, and many counters are being incremented twice when viewing the
page only once. When I set a breakpoint inside the code block above,
for any page named "Default.aspx" (no matter where it is in the folder
structure) the lines inside the code block execute twice. If I rename
the page to something else, they execute only once, as expected.


>

Quote:

Originally Posted by

Does anyone know what causes this? How can I fix it?- Hide quoted text -


>
- Show quoted text -


My code does not explicitly assign any event handlers.
Hi again Joey,

I hope you are well. Could you please paste both aspx page and code beside
so we could have a look?
--
Milosz

"Joey" wrote:

Quote:

Originally Posted by

On Jun 27, 5:38 pm, Milosz Skalecki [MCAD] <mily...@.DONTLIKESPAMwp.pl>
wrote:

Quote:

Originally Posted by

Hi Joey,

Seems page events are fired twice because event handler is assigned two
times - by the AutoWireupEvent directive and by your code by adding the
handler explicitely (vb.net AddHandler or Handles clauses)

--
Milosz

"Joey" wrote:

Quote:

Originally Posted by

I have several asp.net 2.0 apps written in VS2005 in C#. For each one,
I like to create and track page view events, increment counters, etc.
I do this in a block on each page, like this...


Quote:

Originally Posted by

protected void Page_Load(object sender, EventArgs e)
{
if(!this.Page.IsPostBack)
{
Event.Write(EventSource.UserActivity,EventType.Inf ormational,"My
event text");
Counter.Hit(WebPage.MyPage);
}
}


Quote:

Originally Posted by

Now, for the problem. I noticed that many events are being written
twice, and many counters are being incremented twice when viewing the
page only once. When I set a breakpoint inside the code block above,
for any page named "Default.aspx" (no matter where it is in the folder
structure) the lines inside the code block execute twice. If I rename
the page to something else, they execute only once, as expected.


Quote:

Originally Posted by

Does anyone know what causes this? How can I fix it?- Hide quoted text -


- Show quoted text -


>
My code does not explicitly assign any event handlers.
>
>

Monday, March 26, 2012

Strange danish letters bug.

Hello,
I have a web site and i use some danish text on some of the page.
The letters appear as expected when i view the site with the VS 2005 built
in web server.
When i deploy the site either by XCOPY or as precompiled on win 2k3 IIS 6,
then i loose my danish chars.
can someone tell me how i can best deal with this problem.
many thanks in advance
JJOn 13 Feb, 10:15, "Jens Jensen" <j...@.jensen.dk> wrote:
> Hello,
> I have a web site and i use some danish text on some of the page.
> The letters appear as expected when i view the site with the VS 2005 built
> in web server.
> When i deploy the site either by XCOPY or as precompiled on win 2k3 IIS 6
,
> then i loose my danish chars.
> can someone tell me how i can best deal with this problem.
> many thanks in advance
> JJ
Are you including charset="UTF-8" in your html headers? Might be the
browser not interpreting the encoding correctly, so if you set it
explicitly it could work (alternatively, ISO-88591 should also be a
suitable encoding for Danish).
Tobes
> Are you including charset="UTF-8" in your html headers? Might be the
> browser not interpreting the encoding correctly, so if you set it
> explicitly it could work (alternatively, ISO-88591 should also be a
> suitable encoding for Danish).
> Tobes
>
Hi Tobes, that is an interesting detail. Can you give an example of where i
need to write this?
I'm using a master page.
Thanks
JJ
I tried the following :
<head runat="server">
<title>Untitled Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-88591"/>
</head>
<head runat="server">
<title>Untitled Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
non of them seems to help

Strange danish letters bug.

Hello,
I have a web site and i use some danish text on some of the page.
The letters appear as expected when i view the site with the VS 2005 built
in web server.
When i deploy the site either by XCOPY or as precompiled on win 2k3 IIS 6,
then i loose my danish chars.

can someone tell me how i can best deal with this problem.

many thanks in advance
JJOn 13 Feb, 10:15, "Jens Jensen" <j...@.jensen.dkwrote:

Quote:

Originally Posted by

Hello,
I have a web site and i use some danish text on some of the page.
The letters appear as expected when i view the site with the VS 2005 built
in web server.
When i deploy the site either by XCOPY or as precompiled on win 2k3 IIS 6,
then i loose my danish chars.
>
can someone tell me how i can best deal with this problem.
>
many thanks in advance
JJ


Are you including charset="UTF-8" in your html headers? Might be the
browser not interpreting the encoding correctly, so if you set it
explicitly it could work (alternatively, ISO-88591 should also be a
suitable encoding for Danish).

Tobes
Are you including charset="UTF-8" in your html headers? Might be the

Quote:

Originally Posted by

browser not interpreting the encoding correctly, so if you set it
explicitly it could work (alternatively, ISO-88591 should also be a
suitable encoding for Danish).
>
Tobes
>


Hi Tobes, that is an interesting detail. Can you give an example of where i
need to write this?
I'm using a master page.

Thanks
JJ
I tried the following :
<head runat="server">

<title>Untitled Page</title>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-88591"/>

</head>

<head runat="server">

<title>Untitled Page</title>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

</head>

non of them seems to help

Strange Error

I'm getting the following error on when I try to preview webpages from VWD2008. When I upload the pages I can view them fine from my website. Even more stange is it only happens on one certain project and it just started about 10 minutes ago as was fine until then. I have rebooted my computer but that did not help. When I go to view that directory, there are no files in it, nor can I unselect the read-only attribute to delete it.

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:BC30269: 'Public Sub New()' has multiple definitions with identical signatures.

Source Error:

[No relevant source lines]


Source File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mysite\1d37002e\e2be952b\App_Code.stpwyaqr.1.vb Line: 34

Can you show us the code behind for one of the pages that you are getting the error?


Weird on a couple of levels; your post does not display correctly to me, the text is all mashed onto a couple of lines. Fortunately the reply screen shows it ok.

I'm not sure I understand so see if this is correct. When you published the project to the web server it worked fine and the site published ok and is browsable. When you then tried to run the project in VWD to preview locally it gave the error you posted. When you went into the file system on your local machine the directory was blank.

Sound correct so far? If so, are you checking the project directory on your local machine or the temporary directory listed in the error message?


Did you try to do a Clean Project and a Rebuild Project? Are you using the Web Site project or Web Application project?


kraznodar:

I'm not sure I understand so see if this is correct. When you published the project to the web server it worked fine and the site published ok and is browsable. When you then tried to run the project in VWD to preview locally it gave the error you posted. When you went into the file system on your local machine the directory was blank.

Yes that is 100% correct. What is even more odd is the fact that I've been working on this same project for about 7 months, and until a while ago I never got this error. When I tried another project on my computer it ran with no errors. As for the page in question it is all the pages, not just one.

Ohhh, I just tried a rebuild like was suggested and got a bunch of errors relating to a dataset file. I deleted the file in question and now it works 100%

I had copied, then pasted a dataset and that must have corrupted something. I deleted it and no problems.

Guess the lesson is, don't copy/paste a dataset like you can a regular webpage file.

Thanks for the help and suggestions, I'm sure I'll have many more :)


Don't forget to mark noahb's post as the answer. His clean and rebuild led to the discovery of the real issue.

Saturday, March 24, 2012

strange error in a very simple method - what is wrong with asp.net?

Hello,

I have a simple method, which looks from my point of view entirely correct, but I
get the error:

;expected (in the line of declaration, CreateDataTable is red underlined )

The code is the following:

private void DataTable CreateDataTable(string selection){
int maxrowindex;

switch (selection)
{
case "newtable" :

DataColumn myDataColumn;
DataRow myDataRow;
myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.Int32");
myDataColumn.ColumnName = "id";
myDataColumn.ReadOnly = false;
myDataColumn.Unique = true;
myDataTable.Columns.Add(myDataColumn);

myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.String");
myDataColumn.ColumnName = "Material";
myDataColumn.AutoIncrement = false;
myDataColumn.Caption = "Material";
myDataColumn.ReadOnly = false;
myDataColumn.Unique = false;
myDataTable.Columns.Add(myDataColumn);

myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.Int32");
myDataColumn.ColumnName = "Amount";
myDataColumn.AutoIncrement = false;
myDataColumn.Caption = "Amount";
myDataColumn.ReadOnly = false;
myDataColumn.Unique = false;
myDataTable.Columns.Add(myDataColumn);

DataColumn[] PrimaryKeyColumns = new DataColumn[1];
PrimaryKeyColumns[0] = myDataTable.Columns["id"];
myDataTable.PrimaryKey = PrimaryKeyColumns;

//myDataSet = new DataSet();
//myDataSet.Tables.Add(myDataTable);

myDataRow = myDataTable.NewRow();
myDataRow["id"] = 1;
myDataRow["Material"] = "Bezeichnung ";
myDataRow["Amount"] = 0;
myDataTable.Rows.Add(myDataRow);
maxrowindex = 1;

break;

case "newrow" :

break;

case "deleterow" :
break;
}

}


Does anybody know what is wrong?void or DataTable, pick one.
thanks!

strange error when deploying new code-behind assemblies

I have an asp.net application that is running and I updated code behind
assemblies after I modified some internal logic.

Then I tried to view the page and got a very strange error, something like
the following:

Could not find file "C:\WINDOWS\TEMP\qoqdmvbc.dll".

I get errors like that in different places where I've updated assemblies.
They are all named with random alpha letters + .dll.
I'm assuming I am getting caught between the page compilation somehow
because I get the correct pages after a bit.

Can someone clarify on what is really happening?
Thanks
JihoJiho Han wrote:

> I have an asp.net application that is running and I updated code behind
> assemblies after I modified some internal logic.
> Then I tried to view the page and got a very strange error, something like
> the following:
> Could not find file "C:\WINDOWS\TEMP\qoqdmvbc.dll".
> I get errors like that in different places where I've updated assemblies.
> They are all named with random alpha letters + .dll.
> I'm assuming I am getting caught between the page compilation somehow
> because I get the correct pages after a bit.
> Can someone clarify on what is really happening?
> Thanks
> Jiho

these are asp.net compiled code files, they are in directory

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Tempo rary ASP.NET
Files\<yourvirtualdirectory> , or whatever version you are using ..

i get these errors sometimes, when file locking gets asp.net confused, I
just go there and delete the <yourvirtualdirectory> directory.., that
solves the problem,

hth
-ashish

strange error when deploying new code-behind assemblies

I have an asp.net application that is running and I updated code behind
assemblies after I modified some internal logic.
Then I tried to view the page and got a very strange error, something like
the following:
Could not find file "C:\WINDOWS\TEMP\qoqdmvbc.dll".
I get errors like that in different places where I've updated assemblies.
They are all named with random alpha letters + .dll.
I'm assuming I am getting caught between the page compilation somehow
because I get the correct pages after a bit.
Can someone clarify on what is really happening?
Thanks
JihoJiho Han wrote:

> I have an asp.net application that is running and I updated code behind
> assemblies after I modified some internal logic.
> Then I tried to view the page and got a very strange error, something like
> the following:
> Could not find file "C:\WINDOWS\TEMP\qoqdmvbc.dll".
> I get errors like that in different places where I've updated assemblies.
> They are all named with random alpha letters + .dll.
> I'm assuming I am getting caught between the page compilation somehow
> because I get the correct pages after a bit.
> Can someone clarify on what is really happening?
> Thanks
> Jiho
>
these are asp.net compiled code files, they are in directory
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\<yourvirtualdirectory> , or whatever version you are using ..
i get these errors sometimes, when file locking gets asp.net , I
just go there and delete the <yourvirtualdirectory> directory.., that
solves the problem,
hth
-ashish

Strange Error when viewing page

When I view my index.aspx page any time after the first time, I recieve the
following error:

[HttpException (0x80004005): Multiple controls with the same ID
'TitleBanner:_ctl0' were found. Trace requires that controls have unique
IDs.]
System.Web.TraceContext.AddNewControl(String id, String parentId, String
type, Int32 viewStateSize) +313
System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
calcViewState) +201
System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
calcViewState) +263
System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
calcViewState) +263
System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
calcViewState) +263
System.Web.UI.Page.ProcessRequestMain() +1633

TitleBanner is a user control on my page. Because I do not recieve this
error the very first time I view the page after compiling it, ASP.NET is
obviously remembering the control after I view the page the first time. I
find this error strange because _ctl0 is an automatically generated name, so
how can there be two controls with that name? I also find it strange that
the error only seems to occur on my index.aspx page, even though the control
is used in exactly the same way (same parameters and properties) on another
page in the same directory, and it does not give me an error there even when
I view it multiple times. Why might this be happening, and what might I be
able to do to fix it? Thanks.
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/Nathan,

First question,
Are you dynamicly building controls?

Cor
Hi,

If you are adding the control to the webpage via code do not add
it again when the page is posting back.

If not me.postback then
' add the control here
end if

Ken
---------

"Nathan Sokalski" wrote:

> When I view my index.aspx page any time after the first time, I recieve the
> following error:
> [HttpException (0x80004005): Multiple controls with the same ID
> 'TitleBanner:_ctl0' were found. Trace requires that controls have unique
> IDs.]
> System.Web.TraceContext.AddNewControl(String id, String parentId, String
> type, Int32 viewStateSize) +313
> System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
> calcViewState) +201
> System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
> calcViewState) +263
> System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
> calcViewState) +263
> System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
> calcViewState) +263
> System.Web.UI.Page.ProcessRequestMain() +1633
> TitleBanner is a user control on my page. Because I do not recieve this
> error the very first time I view the page after compiling it, ASP.NET is
> obviously remembering the control after I view the page the first time. I
> find this error strange because _ctl0 is an automatically generated name, so
> how can there be two controls with that name? I also find it strange that
> the error only seems to occur on my index.aspx page, even though the control
> is used in exactly the same way (same parameters and properties) on another
> page in the same directory, and it does not give me an error there even when
> I view it multiple times. Why might this be happening, and what might I be
> able to do to fix it? Thanks.
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
>
Yes, I am. The place that it looks like the error occurs (which is pretty
early in my code based on what I can tell, since the control it says it
finds multiple times is pretty early in the Control Tree it displays). A
note that I want to make about this control, however, is that is a control
that I generate in the Application_Start procedure and store in a collection
in the global.asax.vb file, so it is really only generated once (unless the
cache dependency removes it from cache, in which case it is generated
again). Here is my control tree, which you can see is pretty small since it
doesn't get very far:

Control Tree
Control Id Type Render Size Bytes (including children) Viewstate Size
Bytes (excluding children)
__PAGE ASP.index_aspx 0 0
_ctl0 System.Web.UI.LiteralControl 0 0
TitleBar System.Web.UI.HtmlControls.HtmlGenericControl 0 0
_ctl1 System.Web.UI.LiteralControl 0 0
_ctl2 System.Web.UI.ResourceBasedLiteralControl 0 0
Form1 System.Web.UI.HtmlControls.HtmlForm 0 0
_ctl3 System.Web.UI.LiteralControl 0 0
TitleBanner ASP.Banner_ascx 0 0
TitleBanner:lblTitle System.Web.UI.WebControls.Label 0 0
TitleBanner:_ctl0 System.Web.UI.LiteralControl 0 0

My other control, which the application never even gets to which I use for
navigation on all my pages, actually does generate the controls every time.
If you need any more info, I will be happy to give you anything I can.
Thanks.
--
Nathan Sokalski
njsokalski@.hotmail.com
http://www.nathansokalski.com/
"Cor Ligthert" <notmyfirstname@.planet.nl> wrote in message
news:%237wgeAkdFHA.2288@.TK2MSFTNGP14.phx.gbl...
> Nathan,
> First question,
> Are you dynamicly building controls?
> Cor
I do not add the user control via code, the user control is always there.
The basic layout of the control that it looks like the error is occurring in
is as follows:

LABEL CONTROL

imagecontrol imagecontrol imagecontrol

The basic purpose of the user control is to display the title and navigation
bar. The imagecontrols, which are the navigation, are generated when the
application is started in the Application_Start procedure, and are then
stored in a collection in the global.asax.vb file. The only time they would
be generated a second time would be if they were removed from the
application cache (I created cache dependencies for this). I also want to
point out that even though my diagram above says imagecontrol 3 times, the
page in error only places one there (other pages would place more, but this
page only has one). My control tree (or at least the part shown in the
error) is as follows:

Control Tree
Control Id Type Render Size Bytes (including children) Viewstate Size
Bytes (excluding children)
__PAGE ASP.index_aspx 0 0
_ctl0 System.Web.UI.LiteralControl 0 0
TitleBar System.Web.UI.HtmlControls.HtmlGenericControl 0 0
_ctl1 System.Web.UI.LiteralControl 0 0
_ctl2 System.Web.UI.ResourceBasedLiteralControl 0 0
Form1 System.Web.UI.HtmlControls.HtmlForm 0 0
_ctl3 System.Web.UI.LiteralControl 0 0
TitleBanner ASP.Banner_ascx 0 0
TitleBanner:lblTitle System.Web.UI.WebControls.Label 0 0
TitleBanner:_ctl0 System.Web.UI.LiteralControl 0 0

I am having trouble figuring out what the LiteralControl that it stops at
is, because the user control TitleBanner does not create or use any
LiteralControls. All I can think of is that somehow ASP.NET is labeling the
<BR> tag as a LiteralControl, even though the tag is just there. If there is
any more information that might be useful in figuring out the problem, let
me know and I will be happy to give it to you. Thanks.
--
Nathan Sokalski
njsokalski@.hotmail.com
http://www.nathansokalski.com/
"Ken Tucker [MVP]" <KenTuckerMVP@.discussions.microsoft.com> wrote in message
news:4185E94C-784F-4CCF-B060-555ADEC219BB@.microsoft.com...
> Hi,
> If you are adding the control to the webpage via code do not add
> it again when the page is posting back.
> If not me.postback then
> ' add the control here
> end if
> Ken
> ---------
> "Nathan Sokalski" wrote:
>> When I view my index.aspx page any time after the first time, I recieve
>> the
>> following error:
>>
>> [HttpException (0x80004005): Multiple controls with the same ID
>> 'TitleBanner:_ctl0' were found. Trace requires that controls have unique
>> IDs.]
>> System.Web.TraceContext.AddNewControl(String id, String parentId,
>> String
>> type, Int32 viewStateSize) +313
>> System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
>> calcViewState) +201
>> System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
>> calcViewState) +263
>> System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
>> calcViewState) +263
>> System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
>> calcViewState) +263
>> System.Web.UI.Page.ProcessRequestMain() +1633
>>
>> TitleBanner is a user control on my page. Because I do not recieve this
>> error the very first time I view the page after compiling it, ASP.NET is
>> obviously remembering the control after I view the page the first time. I
>> find this error strange because _ctl0 is an automatically generated name,
>> so
>> how can there be two controls with that name? I also find it strange that
>> the error only seems to occur on my index.aspx page, even though the
>> control
>> is used in exactly the same way (same parameters and properties) on
>> another
>> page in the same directory, and it does not give me an error there even
>> when
>> I view it multiple times. Why might this be happening, and what might I
>> be
>> able to do to fix it? Thanks.
>> --
>> Nathan Sokalski
>> njsokalski@.hotmail.com
>> http://www.nathansokalski.com/
>>
>>
>
Nathan,

I think that the way you are doing it, is so special, that I can not give
you any help in this.

Sorry

Cor

Thursday, March 22, 2012

Strange Image Problem

I have created a master page and inserted a couple images. When I look at them in design view the appear as a box with an x in it which is not correct. When I view the page in the browser it displays the image. What is the problem?

Here is the master page code:

<%@dotnet.itags.org. Master Language="VB" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server"
</script
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<center>
<img src="http://pics.10026.com/?src=Images/delilogo.jpg" runat="server"/><br /> <img src="http://pics.10026.com/?src=Images/topmenu.jpg" runat="server"/>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder></center>
</div>
</form>
</body>
</html>

The designer in VS is no good. I would rely on your source and forget the designer most of the time. But if you really want the images to appear in the designer, try draging and dropping your images from VS Solution Explorer onto the designer surface.

Hope this helps.


Hinzamorski ,

try the following:

<asp:ImageID="Image1"runat="server"ImageUrl="~/im.JPG"/>


Hi nzamorski,

I'm sure this should work as well as the asp:Image control.

<img src="http://pics.10026.com/?src=Images/delilogo.jpg" runat="server"/>

First, where is your website project located? Is it IIS project or File System project? Please double check the folder structure if the relative path to Images/delilogo.jpg is right. When the website is located in IIS server, the relatvie path to the image in a virtual directory or a web application might be different.

I agree with the guys above, you can drag and drop the image if you are not certain of the path to the image. But first make sure the Images folder is in the root folder of the project. Thus you will find the folder is appearing in the Solution Explorer window of Visual Studio. Pick up the image and drag & drop it into the Design View will be simpler.

Hope it helps.