Saturday, March 31, 2012
Triggering event, listbox
listbox I have on a page. I'm able to populate the listbox with data from a
stored procedure, but cannot trigger the event. I do have EnableViewState =
True for the listbox. I'm imagining (wanting) to populate the listbox named:
lstNames by using the DataValueField from lstDepartments.
It's quite apparent though that the event is not triggering as I can misname
the stored procedure and no error occurs.
Here is the code, I'm sure it will wrap terribly however::
MGSurvey.aspx:
<FORM id="MGSurvey" runat="server">
<p style="Z-INDEX: 101; LEFT: 15px; POSITION: relative">
<asp:listbox id="lstDepartments" style="Z-INDEX: 102; POSITION: relative;
TOP: 6px" runat="server" EnableViewState="true" OnSelectedIndexChanged =
"lstDepartments_SelectedIndexChanged" Width="258px"
Height="118px"></asp:listbox>
<asp:panel id="pnDepartmentMembers" style="Z-INDEX: 103; POSITION: relative"
runat="server" Width="559px" Height="144px" BackColor="Transparent"
BorderColor="Transparent">
<asp:listbox id="lstNames" style="Z-INDEX: 103; LEFT: 15px; POSITION:
relative; TOP: 20px" runat="server" Width="258px" EnableViewState="True"
BackColor="Transparent"></asp:listbox>
</asp:panel>
</p>
</FORM>
MGSurvey.aspx.vb:
Public Sub lstDepartments_SelectedIndexChanged(ByVa
l sender As Object, ByVal
e As EventArgs)
If (Not IsPostBack) Then
adoConn.Open()
Dim adoCommDeptMembers As New SqlCommand("dbo.MG_EmployeesByDepartment "
& lstDepartments.SelectedItem.Value, adoConn)
With lstNames
.DataSource =
adoCommDeptMembers.ExecuteReader(CommandBehavior.CloseConnection)
.DataTextField = "Name"
.DataValueField = "tp_ID"
.DataBind()
End With
adoConn.Close()
End If
End SubHow is the user triggering a postback to the server?
What happens when the page posts back to the server? What does it all look
like?
"Steve Schroeder" <sschroeder@.somewhere.com> wrote in message
news:ez4PuKNrFHA.260@.TK2MSFTNGP11.phx.gbl...
> For some reason I cannot get the OnSelectedIndexChanged event to fire for
> a
> listbox I have on a page. I'm able to populate the listbox with data from
> a
> stored procedure, but cannot trigger the event. I do have EnableViewState
> =
> True for the listbox. I'm imagining (wanting) to populate the listbox
> named:
> lstNames by using the DataValueField from lstDepartments.
> It's quite apparent though that the event is not triggering as I can
> misname
> the stored procedure and no error occurs.
> Here is the code, I'm sure it will wrap terribly however::
> MGSurvey.aspx:
> <FORM id="MGSurvey" runat="server">
> <p style="Z-INDEX: 101; LEFT: 15px; POSITION: relative">
> <asp:listbox id="lstDepartments" style="Z-INDEX: 102; POSITION: relative;
> TOP: 6px" runat="server" EnableViewState="true" OnSelectedIndexChanged =
> "lstDepartments_SelectedIndexChanged" Width="258px"
> Height="118px"></asp:listbox>
> <asp:panel id="pnDepartmentMembers" style="Z-INDEX: 103; POSITION:
> relative"
> runat="server" Width="559px" Height="144px" BackColor="Transparent"
> BorderColor="Transparent">
> <asp:listbox id="lstNames" style="Z-INDEX: 103; LEFT: 15px; POSITION:
> relative; TOP: 20px" runat="server" Width="258px" EnableViewState="True"
> BackColor="Transparent"></asp:listbox>
> </asp:panel>
> </p>
> </FORM>
> MGSurvey.aspx.vb:
> Public Sub lstDepartments_SelectedIndexChanged(ByVa
l sender As Object,
> ByVal
> e As EventArgs)
> If (Not IsPostBack) Then
> adoConn.Open()
> Dim adoCommDeptMembers As New SqlCommand("dbo.MG_EmployeesByDepartment
> "
> & lstDepartments.SelectedItem.Value, adoConn)
> With lstNames
> .DataSource =
> adoCommDeptMembers.ExecuteReader(CommandBehavior.CloseConnection)
> .DataTextField = "Name"
> .DataValueField = "tp_ID"
> .DataBind()
> End With
> adoConn.Close()
> End If
> End Sub
>
Well, I have two listboxes.
lstDepartments - Lists Departments
lstNames - Lists Members of Departments
On Page Load lstDepartments is loaded with a list of departments, with the
department 'code' as the DataValueField.
What I want to happen is, when you click on an item in the list of
departments, lstNames gets populated with the members of that department.
Stored procedures worked, tested them, they have the proper permissions,
etc.
Just can't seem to get OnSelectedIndexChanged to fire...I've tried with 'Not
IsPostBack' and without it...not sure how else to answer your
question...thanks! :)
"Marina" <someone@.nospam.com> wrote in message
news:erppRNNrFHA.3720@.TK2MSFTNGP14.phx.gbl...
> How is the user triggering a postback to the server?
> What happens when the page posts back to the server? What does it all look
> like?
> "Steve Schroeder" <sschroeder@.somewhere.com> wrote in message
> news:ez4PuKNrFHA.260@.TK2MSFTNGP11.phx.gbl...
for
from
EnableViewState
relative;
SqlCommand("dbo.MG_EmployeesByDepartment
>
You didn't really answer my questions at all, so I'm sorry but I don't have
any ideas on how to help you.
"Steve Schroeder" <sschroeder@.somewhere.com> wrote in message
news:u0gIWTNrFHA.2768@.TK2MSFTNGP12.phx.gbl...
> Well, I have two listboxes.
> lstDepartments - Lists Departments
> lstNames - Lists Members of Departments
> On Page Load lstDepartments is loaded with a list of departments, with the
> department 'code' as the DataValueField.
> What I want to happen is, when you click on an item in the list of
> departments, lstNames gets populated with the members of that department.
> Stored procedures worked, tested them, they have the proper permissions,
> etc.
> Just can't seem to get OnSelectedIndexChanged to fire...I've tried with
> 'Not
> IsPostBack' and without it...not sure how else to answer your
> question...thanks! :)
> "Marina" <someone@.nospam.com> wrote in message
> news:erppRNNrFHA.3720@.TK2MSFTNGP14.phx.gbl...
> for
> from
> EnableViewState
> relative;
> SqlCommand("dbo.MG_EmployeesByDepartment
>
"How is the user triggering a postback to the server?" - Postback, as I unde
rstand it is triggered by reloading the page. In my case, this is not happen
ing. All the user should be doing is selecting with their mouse and item in
the listbox, and hopefully triggering the OnSelectedIndexChanged event of th
e listbox named lstDepartments.
"What happens when the page posts back to the server? What does it all look
like?" - Nothing happens, the first listbox flickers when you select an item
, and the second listbox remains empty, and no error message occurs.
"Marina" <someone@.nospam.com> wrote in message news:uJuQVWNrFHA.3444@.TK2MSFTNGP12.phx.gbl..
.
> You didn't really answer my questions at all, so I'm sorry but I don't hav
e
> any ideas on how to help you.
>
> "Steve Schroeder" <sschroeder@.somewhere.com> wrote in message
> news:u0gIWTNrFHA.2768@.TK2MSFTNGP12.phx.gbl...
>
>
Ok, so the problem is that there is no postback to the server!
A server side event can't run, unless something forces a postback to the ser
ver. Your page is sitting in the browser - whatever objects the server used
to generate the page are long gone. HTTP is a connectionless protocol - it'
s just the browser on its own.
So you need something there to trigger an event to the server.
I think the listbox may be one of the objects that has an AutoPostback prope
rty. If it does, setting this to True, will trigger a postback to the server
whenever the selected item is changed.
If the listbox does not have such a property, you need to trigger a postback
. It may be that there is a button the user has to click to proceed, or you
may have to write some javascript to trigger the post.
"Steve Schroeder" <sschroeder@.somewhere.com> wrote in message news:e0RNqcNrF
HA.1128@.TK2MSFTNGP11.phx.gbl...
"How is the user triggering a postback to the server?" - Postback, as I unde
rstand it is triggered by reloading the page. In my case, this is not happen
ing. All the user should be doing is selecting with their mouse and item in
the listbox, and hopefully triggering the OnSelectedIndexChanged event of th
e listbox named lstDepartments.
"What happens when the page posts back to the server? What does it all look
like?" - Nothing happens, the first listbox flickers when you select an item
, and the second listbox remains empty, and no error message occurs.
"Marina" <someone@.nospam.com> wrote in message news:uJuQVWNrFHA.3444@.TK2MSFTNGP12.phx.gbl..
.
> You didn't really answer my questions at all, so I'm sorry but I don't hav
e
> any ideas on how to help you.
>
> "Steve Schroeder" <sschroeder@.somewhere.com> wrote in message
> news:u0gIWTNrFHA.2768@.TK2MSFTNGP12.phx.gbl...
>
>
Well I'll be damned...that worked! Thank you!
For future reference...when would I not want to do a postback, and if 90% of
the time people do postback, why isn't it the default behavior? I would hav
e gnashed my teeth over that one indefinately...
"Marina" <someone@.nospam.com> wrote in message news:O6YP1gNrFHA.528@.TK2MSFTN
GP09.phx.gbl...
Ok, so the problem is that there is no postback to the server!
A server side event can't run, unless something forces a postback to the ser
ver. Your page is sitting in the browser - whatever objects the server used
to generate the page are long gone. HTTP is a connectionless protocol - it'
s just the browser on its own.
So you need something there to trigger an event to the server.
I think the listbox may be one of the objects that has an AutoPostback prope
rty. If it does, setting this to True, will trigger a postback to the server
whenever the selected item is changed.
If the listbox does not have such a property, you need to trigger a postback
. It may be that there is a button the user has to click to proceed, or you
may have to write some javascript to trigger the post.
"Steve Schroeder" <sschroeder@.somewhere.com> wrote in message news:e0RNqcNrF
HA.1128@.TK2MSFTNGP11.phx.gbl...
"How is the user triggering a postback to the server?" - Postback, as I unde
rstand it is triggered by reloading the page. In my case, this is not happen
ing. All the user should be doing is selecting with their mouse and item in
the listbox, and hopefully triggering the OnSelectedIndexChanged event of th
e listbox named lstDepartments.
"What happens when the page posts back to the server? What does it all look
like?" - Nothing happens, the first listbox flickers when you select an item
, and the second listbox remains empty, and no error message occurs.
"Marina" <someone@.nospam.com> wrote in message news:uJuQVWNrFHA.3444@.TK2MSFTNGP12.phx.gbl..
.
> You didn't really answer my questions at all, so I'm sorry but I don't hav
e
> any ideas on how to help you.
>
> "Steve Schroeder" <sschroeder@.somewhere.com> wrote in message
> news:u0gIWTNrFHA.2768@.TK2MSFTNGP12.phx.gbl...
>
>
Because, who is to say that you always want a postback?
A lot of times, a user is filling out a form, and has many fields to fill ou
t. Then they hit 'Submit', and go to the next page. In this case you would
not want to postback automatically. Not only because there is nothing to do
until the form is filled out, but because it is a waste of resources, and l
ooks ugly with the screen flashing all the time.
So I would say, that it is not the case that people want to postback most of
the time. It really just depends on the type of application and what the UI
needs to do.
I think most people would assume that nothing happens by default, because th
at is what HTML equivalents of these controls would do. And then they add c
ode to change the default behavior.
"Steve Schroeder" <sschroeder@.somewhere.com> wrote in message news:OFaBqoNrF
HA.2624@.TK2MSFTNGP15.phx.gbl...
Well I'll be damned...that worked! Thank you!
For future reference...when would I not want to do a postback, and if 90% of
the time people do postback, why isn't it the default behavior? I would hav
e gnashed my teeth over that one indefinately...
"Marina" <someone@.nospam.com> wrote in message news:O6YP1gNrFHA.528@.TK2MSFTN
GP09.phx.gbl...
Ok, so the problem is that there is no postback to the server!
A server side event can't run, unless something forces a postback to the ser
ver. Your page is sitting in the browser - whatever objects the server used
to generate the page are long gone. HTTP is a connectionless protocol - it'
s just the browser on its own.
So you need something there to trigger an event to the server.
I think the listbox may be one of the objects that has an AutoPostback prope
rty. If it does, setting this to True, will trigger a postback to the server
whenever the selected item is changed.
If the listbox does not have such a property, you need to trigger a postback
. It may be that there is a button the user has to click to proceed, or you
may have to write some javascript to trigger the post.
"Steve Schroeder" <sschroeder@.somewhere.com> wrote in message news:e0RNqcNrF
HA.1128@.TK2MSFTNGP11.phx.gbl...
"How is the user triggering a postback to the server?" - Postback, as I unde
rstand it is triggered by reloading the page. In my case, this is not happen
ing. All the user should be doing is selecting with their mouse and item in
the listbox, and hopefully triggering the OnSelectedIndexChanged event of th
e listbox named lstDepartments.
"What happens when the page posts back to the server? What does it all look
like?" - Nothing happens, the first listbox flickers when you select an item
, and the second listbox remains empty, and no error message occurs.
"Marina" <someone@.nospam.com> wrote in message news:uJuQVWNrFHA.3444@.TK2MSFTNGP12.phx.gbl..
.
> You didn't really answer my questions at all, so I'm sorry but I don't hav
e
> any ideas on how to help you.
>
> "Steve Schroeder" <sschroeder@.somewhere.com> wrote in message
> news:u0gIWTNrFHA.2768@.TK2MSFTNGP12.phx.gbl...
>
>
I appreciate the great explanation. Thank you.
"Marina" <someone@.nospam.com> wrote in message news:uQjFnrNrFHA.2880@.TK2MSFT
NGP12.phx.gbl...
Because, who is to say that you always want a postback?
A lot of times, a user is filling out a form, and has many fields to fill ou
t. Then they hit 'Submit', and go to the next page. In this case you would
not want to postback automatically. Not only because there is nothing to do
until the form is filled out, but because it is a waste of resources, and l
ooks ugly with the screen flashing all the time.
So I would say, that it is not the case that people want to postback most of
the time. It really just depends on the type of application and what the UI
needs to do.
I think most people would assume that nothing happens by default, because th
at is what HTML equivalents of these controls would do. And then they add c
ode to change the default behavior.
"Steve Schroeder" <sschroeder@.somewhere.com> wrote in message news:OFaBqoNrF
HA.2624@.TK2MSFTNGP15.phx.gbl...
Well I'll be damned...that worked! Thank you!
For future reference...when would I not want to do a postback, and if 90% of
the time people do postback, why isn't it the default behavior? I would hav
e gnashed my teeth over that one indefinately...
"Marina" <someone@.nospam.com> wrote in message news:O6YP1gNrFHA.528@.TK2MSFTN
GP09.phx.gbl...
Ok, so the problem is that there is no postback to the server!
A server side event can't run, unless something forces a postback to the ser
ver. Your page is sitting in the browser - whatever objects the server used
to generate the page are long gone. HTTP is a connectionless protocol - it'
s just the browser on its own.
So you need something there to trigger an event to the server.
I think the listbox may be one of the objects that has an AutoPostback prope
rty. If it does, setting this to True, will trigger a postback to the server
whenever the selected item is changed.
If the listbox does not have such a property, you need to trigger a postback
. It may be that there is a button the user has to click to proceed, or you
may have to write some javascript to trigger the post.
"Steve Schroeder" <sschroeder@.somewhere.com> wrote in message news:e0RNqcNrF
HA.1128@.TK2MSFTNGP11.phx.gbl...
"How is the user triggering a postback to the server?" - Postback, as I unde
rstand it is triggered by reloading the page. In my case, this is not happen
ing. All the user should be doing is selecting with their mouse and item in
the listbox, and hopefully triggering the OnSelectedIndexChanged event of th
e listbox named lstDepartments.
"What happens when the page posts back to the server? What does it all look
like?" - Nothing happens, the first listbox flickers when you select an item
, and the second listbox remains empty, and no error message occurs.
"Marina" <someone@.nospam.com> wrote in message news:uJuQVWNrFHA.3444@.TK2MSFTNGP12.phx.gbl..
.
> You didn't really answer my questions at all, so I'm sorry but I don't hav
e
> any ideas on how to help you.
>
> "Steve Schroeder" <sschroeder@.somewhere.com> wrote in message
> news:u0gIWTNrFHA.2768@.TK2MSFTNGP12.phx.gbl...
>
>
Trim String
Hi
I want to trim the end of a string placed on my page.
I want to make it so that even if the text is 100 char long it will only display the first 15 characters.
Is this correct, i cant seem to make it work.
Regards
Ant
<%#Container.DataItem("OutboundCarrierName").ToString.Trim("15") %>
use Substring function in place of this:
<%#Container.DataItem("OutboundCarrierName").ToString().Substring(0,15) %>
thanks
Perfect, that works.
Trim URL
I am involved in designing a website in which on a certain page(that contains a form) if some message is to be shown to the user the URL looks like
http://myserver/somepage.aspx?message=.....
Now if on that page the user requests re-submits the form I want the URL to be trimmed as simply http://myserver/somepage.aspx
Also is there some way that I can send such error messages through some means(like POST) such that there is no change in the url.If yes plz elaborate on it
Cheers,
-Aayush
Why don't you pass the parameter into a session, so instead of passing ?message=.....
do
Session["message"] = "...";
and in the next page you do:
string message = Session["message"].ToString();
Session.Remove("message");
you can use server variables and retrieve the required info
Triming the Back Button
user gets to a certain page and presses the back button I want to bypass
some of the pages that he got to on the way to that page. For example, I
don't want the user to see the forms he posted before he got to this page.
To illustrate, suppose the users sees these pages in sequence:
P1-->P2-->P3-->P4
What I want is when the user is viewing P4 and presses the back button he
goes to P1 rather than P3.Hi,
as far as I know the only way to achieve this behavior is only by
supplying your own navigation mechanism. I'll be happy to hear other
options...
Natty Gur[MVP]
blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
"Ron Lautmann" <ronUNDERSCORElautmann@.pacbell.net> wrote in message
news:eARi7G3TEHA.972@.TK2MSFTNGP10.phx.gbl...
> Is there a way to remove items from the Back Button programatically? When
a
> user gets to a certain page and presses the back button I want to bypass
> some of the pages that he got to on the way to that page. For example, I
> don't want the user to see the forms he posted before he got to this page.
> To illustrate, suppose the users sees these pages in sequence:
> P1-->P2-->P3-->P4
> What I want is when the user is viewing P4 and presses the back button he
> goes to P1 rather than P3.
>
"Ron Lautmann" <ronUNDERSCORElautmann@.pacbell.net> wrote in message
news:eARi7G3TEHA.972@.TK2MSFTNGP10.phx.gbl...
> Is there a way to remove items from the Back Button programatically? When
a
> user gets to a certain page and presses the back button I want to bypass
> some of the pages that he got to on the way to that page. For example, I
> don't want the user to see the forms he posted before he got to this page.
> To illustrate, suppose the users sees these pages in sequence:
> P1-->P2-->P3-->P4
> What I want is when the user is viewing P4 and presses the back button he
> goes to P1 rather than P3.
Did I just send a blank response? Sorry if so.
There's no good way to do this. What if the user is viewing P4 and enters P3
into the browser's address bar? What if the user creates a new browser
window and has that window go to P2 while the first one goes back to P3?
This is one of the characteristics of a web application. Because you didn't
create the program the user is using (the browser), you don't have complete
control over what the user does with that program. The trick is to simply
get over it and come up with another way of accomplishing what you need.
--
John Saunders
johnwsaundersiii at hotmail
Triming the Back Button
user gets to a certain page and presses the back button I want to bypass
some of the pages that he got to on the way to that page. For example, I
don't want the user to see the forms he posted before he got to this page.
To illustrate, suppose the users sees these pages in sequence:
P1-->P2-->P3-->P4
What I want is when the user is viewing P4 and presses the back button he
goes to P1 rather than P3.Hi,
as far as I know the only way to achieve this behavior is only by
supplying your own navigation mechanism. I'll be happy to hear other
options...
Natty Gur[MVP]
blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
"Ron Lautmann" <ronUNDERSCORElautmann@.pacbell.net> wrote in message
news:eARi7G3TEHA.972@.TK2MSFTNGP10.phx.gbl...
> Is there a way to remove items from the Back Button programatically? When
a
> user gets to a certain page and presses the back button I want to bypass
> some of the pages that he got to on the way to that page. For example, I
> don't want the user to see the forms he posted before he got to this page.
> To illustrate, suppose the users sees these pages in sequence:
> P1-->P2-->P3-->P4
> What I want is when the user is viewing P4 and presses the back button he
> goes to P1 rather than P3.
"Ron Lautmann" <ronUNDERSCORElautmann@.pacbell.net> wrote in message
news:eARi7G3TEHA.972@.TK2MSFTNGP10.phx.gbl...
> Is there a way to remove items from the Back Button programatically? When
a
> user gets to a certain page and presses the back button I want to bypass
> some of the pages that he got to on the way to that page. For example, I
> don't want the user to see the forms he posted before he got to this page.
> To illustrate, suppose the users sees these pages in sequence:
> P1-->P2-->P3-->P4
> What I want is when the user is viewing P4 and presses the back button he
> goes to P1 rather than P3.
Did I just send a blank response? Sorry if so.
There's no good way to do this. What if the user is viewing P4 and enters P3
into the browser's address bar? What if the user creates a new browser
window and has that window go to P2 while the first one goes back to P3?
This is one of the characteristics of a web application. Because you didn't
create the program the user is using (the browser), you don't have complete
control over what the user does with that program. The trick is to simply
get over it and come up with another way of accomplishing what you need.
--
John Saunders
johnwsaundersiii at hotmail
Trimming spaces with calendar picker to send to sql statement
I have a Calendar PIcker that we choose a date from and send that out as a parameter to a sql statement. I have created my page in the visual studio designer and what I want to do is send is
RTrim(Calendar1.SelectedDate.ToShortDateString). My problem is since this was created in designer the code is all hidden. I can't place the RTrim() anywhere to accomplish this. Or maybe this whole process needs to be hard coded. It seems to me in VS 2003 you would see all the code thru expanding regions.
Thanks
Hey,
It should be there in the regions; I don't know how you are doing this; if you place it as an expression in the page, it could be in the page HTML. But how are you doing this? I need a little more info...
Wednesday, March 28, 2012
Trouble building aspx page in the HTML designer
I am building a aspx page. I have noticed that when use <Table><Tr><Td> with
<asp:Checkbox> that the intellisense does not show for <asp:whateverObject> Is there a way to show the intellisense for asp .net objects? If so, how. Or you just can't mix the two. Furthermore, I am building the page through the HTML designer.
Any help will be very much appreciated.
Thanks,
poc1010What HTML Designer are you using? I know that intellisense works with VS.net and maybe WebMatrix. Beyond that I'm not sure.
Jeff
Jeff,
I am using VS.Net. It does work when I only use <asp:Table><asp:TableRow><asp:TableCell> and then use the <asp:any object>. But it does not work when you use <Table><Tr><Td> and then use the <asp:any object>. I am modifying code and do not wish to change the whole page.
I thought there was a way.
Thanks,
poc1010
It should still work. What version of visual studio are you using? What operating system?
Jeff
Jeff,
I am using vs.net 2003 and windows 2000 NT.
poc1010
Which did you install first: visual studio.net or IIS?
Jeff
Trouble Declaring and Setting Variable
I have a page that sends the value of a textbox in a form through GET.
My next page is supposed to grab that value, and put it in a variable. This is what I have for my next page:
1<%@dotnet.itags.org. Import namespace="System.IO"%>2<html>
3<head>
4<title>Uploading a File</title>
5678<script language="VB" runat="server">
9Dim strPath
10 strPath = Request.QueryString("path")
11
12 Dim savePath As String = StrPath
13Sub Upload_Click(source As Object, e As EventArgs)
1415 If Not (uploadedFile.PostedFile Is Nothing) Then
16 Try
17 Dim postedFile = uploadedFile.PostedFile
18 Dim filename As String = Path.GetFileName(postedFile.FileName)
19 Dim contentType As String = postedFile.ContentType
20 Dim contentLength As Integer = postedFile.ContentLength
2122 postedFile.SaveAs(savePath & filename)
23 message.Text = postedFile.Filename & " uploaded" & _
24 "<br>content type: " & contentType & _
25 "<br>content length: " & contentLength.ToString()
26 Catch exc As Exception
27 message.Text = "Failed uploading file"
28 End Try
29 End If
30End Sub
31</script>
32
33</head>
34<body>
35
36<form id="Form1" enctype="multipart/form-data" runat="server">
37 Select File to Upload:
3839 <input id="uploadedFile" type="file" runat="server">
40 <p>
41 <input type=button id="upload"
42 value="Upload"
43 OnServerClick="Upload_Click"
44 runat="server">
45 <p>
46 <asp:Label id="message" runat="server"/>
47</form>
48
49</body>
50</html>
I get a "declaration expected" on line 10. Any Ideas why?
A simle fix is to move both lines
Dim strPath as String = Request.QueryString("path")
Dim savePath As String = StrPath
to the top of Sub Upload_Click.
The actual error is that line 9 is not complete with a type declaration.
Dim strPathAs String
Also, you don't seem to need both strPath and savePath.
Dim savePath As String = Request.QueryString("path")should be enough
Gunteman, I must respectfully disagree. If you put
Dim savePath As String = Request.QueryString("path")
outside of Sub Upload_Click, you get the following exception:
"Request is not available in this context."
However, removing strPath does make sense.
Thanks to both of you. I still got a problem even after doing that, but adding "Context." before "Request" cleared things up.
louis210:
Gunteman, I must respectfully disagree. If you put
Dim savePath As String = Request.QueryString("path")
outside of Sub Upload_Click, you get the following exception:
"Request is not available in this context."
Quite right!
Monday, March 26, 2012
Trouble displaying Japanese text with aspx
I am having trouble displaying Japanese text within a textbox (or
anywhere else) in an aspx page with .net 2.0 framework. Initial
default text in Japanese displays perfectly but when I attempt to
change the text following a button-click event, it displays as junk.
I have tried setting the globalization tag in the web.config file but
that does not help eiter.
<globalization requestEncoding="UTF-8" responseEncoding="UTF-8"
fileEncoding="UTF-8"/>
I should mention that the problem does not happen in my development pc
where I am using the Visual Web Developer 2005 IDE. It happens only
when I deploy the files to the actual IIS webserver on Windows 2000.
Would greatly appreciate any help.
Here's what I have:
1. TestJP.aspx contains:
<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true"
CodeFile="TestJP.aspx.cs" Inherits="TestJP" %>
<!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 runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test JP</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtJP" runat="server" Height="101px"
Width="374px">Default Japanese Text</asp:TextBox>
<br />
<asp:Button ID="cmdJP" runat="server" Text="Change Text"
OnClick="cmdJP_Click" />
</div>
</form>
</body>
</html>
2. TestJP.aspx.cs contains:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class TestJP : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void cmdJP_Click(object sender, EventArgs e)
{
txtJP.Text = "New Japanese text";
}
}On May 8, 9:16 am, pardesiya <zenst...@.gmail.com> wrote:
> Friends,
> I am having trouble displaying Japanese text within a textbox (or
> anywhere else) in an aspx page with .net 2.0 framework. Initial
> default text in Japanese displays perfectly but when I attempt to
> change the text following a button-click event, it displays as junk.
> I have tried setting the globalization tag in the web.config file but
> that does not help eiter.
> <globalization requestEncoding="UTF-8" responseEncoding="UTF-8"
> fileEncoding="UTF-8"/>
> I should mention that the problem does not happen in my development pc
> where I am using the Visual Web Developer 2005 IDE. It happens only
> when I deploy the files to the actual IIS webserver on Windows 2000.
> Would greatly appreciate any help.
> Here's what I have:
> 1. TestJP.aspx contains:
> <%@. Page Language="C#" AutoEventWireup="true"
> CodeFile="TestJP.aspx.cs" Inherits="TestJP" %>
> <!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 runat="server">
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
> <title>Test JP</title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
> <asp:TextBox ID="txtJP" runat="server" Height="101px"
> Width="374px">Default Japanese Text</asp:TextBox>
> <br />
> <asp:Button ID="cmdJP" runat="server" Text="Change Text"
> OnClick="cmdJP_Click" />
> </div>
> </form>
> </body>
> </html>
> 2. TestJP.aspx.cs contains:
> using System;
> using System.Data;
> using System.Configuration;
> using System.Collections;
> using System.Web;
> using System.Web.Security;
> using System.Web.UI;
> using System.Web.UI.WebControls;
> using System.Web.UI.WebControls.WebParts;
> using System.Web.UI.HtmlControls;
> public partial class TestJP : System.Web.UI.Page
> {
> protected void Page_Load(object sender, EventArgs e)
> {
> }
> protected void cmdJP_Click(object sender, EventArgs e)
> {
> txtJP.Text = "New Japanese text";
> }
>
> }- Hide quoted text -
> - Show quoted text -
Go to File - Save .aspx As - point to Save and select Save with
Encoding... What encoding do you use to save the file?
On May 8, 9:30 am, Alexey Smirnov <alexey.smir...@.gmail.com> wrote:
> Go to File - Save .aspx As - point to Save and select Save with
> Encoding... What encoding do you use to save the file... Hide quoted text -
>
Wait... you have to check the encoding for your TestJP.aspx.cs file.
It seems that it saved in a different encoding...
Alexey thanks a lot for your prompt suggestion. That worked!
TestJP.aspx.cs and TestJP.aspx were saved with Shift_JIS. Changed
that to UTF-8 and it works fine!
I have a second question which is related. I query data into a dataset
and display the result in the same text box but it appears junk. Is
there any way I should set the charset of the DataSet? The database is
probably encoded with Unicode.
DataSet dsTables = new DataSet();
dsTables = <code to get data from database>
txtJP.Text = dsTables.Tables[0].Rows[0]["japanese_name"].ToString();
using System.Data.OleDb;
On May 8, 10:32 am, pardesiya <zenst...@.gmail.com> wrote:
> Alexey thanks a lot for your prompt suggestion. That worked!
> TestJP.aspx.cs and TestJP.aspx were saved with Shift_JIS. Changed
> that to UTF-8 and it works fine!
> I have a second question which is related. I query data into a dataset
> and display the result in the same text box but it appears junk. Is
> there any way I should set the charset of the DataSet? The database is
> probably encoded with Unicode.
> DataSet dsTables = new DataSet();
> dsTables = <code to get data from database>
> txtJP.Text = dsTables.Tables[0].Rows[0]["japanese_name"].ToString();
Where data came from? Did you do that from your asp.net application?
It seems that the data encoded in other format...
Try to change encoding of your result page, in IE right click,
Encoding - Shift_JIS (or any other)
Thanks Alexey. Yes, I'm getting the data from asp.net application.
But changing the encoding in IE doesnt seem to help. As you mention
maybe the data is encoded differently. Probably I should post this as
a separate thread.
using System.Data.OleDb;
OleDbConnection OledbConn = new OleDbConnection();
OleDbDataAdapter OledbDataAdap = new OleDbDataAdapter();
DataSet OleDbDS = new DataSet();
OledbConn.ConnectionString = <connection string to Sybase
database>;
OledbConn.Open();
OledbDataAdap.SelectCommand = new OleDbCommand("select
japanese_name from ... ", OledbConn);
OledbDataAdap.Fill(OleDbDS);
OledbConn.Close();
return OleDbDS;
On May 8, 11:06 am, pardesiya <zenst...@.gmail.com> wrote:
> Thanks Alexey. Yes, I'm getting the data from asp.net application.
> But changing the encoding in IE doesnt seem to help. As you mention
> maybe the data is encoded differently. Probably I should post this as
> a separate thread.
> using System.Data.OleDb;
> OleDbConnection OledbConn = new OleDbConnection();
> OleDbDataAdapter OledbDataAdap = new OleDbDataAdapter();
> DataSet OleDbDS = new DataSet();
> OledbConn.ConnectionString = <connection string to Sybase
> database>;
> OledbConn.Open();
> OledbDataAdap.SelectCommand = new OleDbCommand("select
> japanese_name from ... ", OledbConn);
> OledbDataAdap.Fill(OleDbDS);
> OledbConn.Close();
> return OleDbDS;
Sorry, I think I was not clear. I'm interesting in the code which
stored the data in the database. I guess, you have a kind of web form
with fields and submit button which fires the code-behind action. This
form has to be in UTF encoded
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
not sure about a code (want to see it first)
and your database should support that encoding.
Actually, if you browse the database using a shell, do you see the
correct characters? Are you able to insert any data in Japanese (using
a shell) and see that text on the website?
Ok I understand what you mean. Actually I am not sure about how the
data is stored in the database. The people who maintain the database
have some kind of tool or database application to insert the data. I
only try to retrieve some data using an oledb connection in my asp.net
form.
But I am able to browse the database using Microsoft Query and see the
Japanese data correctly. I can even download the correct data into
Excel. I dont have permission to insert data so cannot check that
part.
On May 8, 11:50 am, pardesiya <zenst...@.gmail.com> wrote:
> Ok I understand what you mean. Actually I am not sure about how the
> data is stored in the database. The people who maintain the database
> have some kind of tool or database application to insert the data. I
> only try to retrieve some data using an oledb connection in my asp.net
> form.
> But I am able to browse the database using Microsoft Query and see the
> Japanese data correctly. I can even download the correct data into
> Excel. I dont have permission to insert data so cannot check that
> part.
1. Check the existing output. Maybe it will give you idea about
encoding.
2. Try to encode
System.Text.Encoding en1 = System.Text.Encoding.Unicode;
System.Text.Encoding en2 = System.Text.Encoding.UTF8;
txtJP.Text = en2.GetString(en1.GetBytes(dsTables.Tables[0].Rows[0]
["japanese_name"].ToString()));
or
System.Text.Encoding en1 =
System.Text.Encoding.Encoding.GetEncoding("Shift_JIS"); // or any
other standard JP-encoding
System.Text.Encoding en2 = System.Text.Encoding.UTF8;
txtJP.Text = en2.GetString(en1.GetBytes(dsTables.Tables[0].Rows[0]
["japanese_name"].ToString()));
3. Check code page of your database
4. Contact db-developers :-)
Trouble Displaying Image in a User Control....
When I run this locally without trying to display an image it runs fine. The problem is displaying the image in the detail.aspx page. Below I entered what I thought would work. Can anyone take a good hard look at this and help get me on the right track.
At the very bottom I'm using the following to pull the image:
<IMG SRC='images/<%# Container.DataItem("ImageLabel") %>' Border="0"
Any opinions would be greatly appreciated.
Thank You.
I have included before detail.aspx and testad.ascx below.
===================================================
DETAIL.aspx PAGE...
<%@dotnet.itags.org. Register TagPrefix="ASPFD" TagName="Header" src="http://pics.10026.com/?src=header.ascx" %>
<%@dotnet.itags.org. Register TagPrefix="ASPFD" TagName="TestAd" src="http://pics.10026.com/?src=Testad.ascx" %>
<HTML>
<script runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
If Not IsPostBack Then
Dim AdNumSent As Integer
If Trim(Request.QueryString("AdNum")) = "" Then
Response.Redirect("default.aspx")
End If
Header.AddPageName("Ad Detail")
AdNumSent = Trim(Request.QueryString("AdNum"))
TestAd.GetAd(AdNumSent)
End If
End Sub
</script>
<body vlink="red">
<form runat="server">
<aspfd:header id="Header" runat="server" />
<aspfd:testad id="testAd" runat="server" />
</form>
</body>
</HTML
===================================================
TESTAD.ascx Page...
<%@dotnet.itags.org. Import Namespace="System.Data" %>
<%@dotnet.itags.org. Import Namespace="System.Data.OleDb" %>
<script runat="server">
Dim ConnectString, SelectStatement As String
Dim Connect As OleDbConnection = New OleDbConnection
Dim Adapter As OleDbDataAdapter = New OleDbDataAdapter
Dim TestCB As OleDbCommandBuilder
Dim TestDS As DataSet = New DataSet
Dim Row As DataRow
Public AdNum As Integer
Public Title As String
Public Description As String
Public Category As String
Public Price As String
Public Phone As String
Public Email As String
Public State As String
Public Posted As Date
Public Password As String
Public Image As String
Public HasErrors As Boolean
Public RowError As String
Sub GetAd(AdNumSent As Integer)
SelectStatement = "Select * From Ads Where AdNum=" & AdNumSent
ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("Testdb.mdb") & ";"
Connect.ConnectionString = ConnectString
Adapter.SelectCommand = new OleDbCommand(SelectStatement, Connect)
Adapter.Fill(TestDS,"Ads")
TestCB = New OleDbCommandBuilder(Adapter)
If TestDS.Tables("Ads").Rows.Count > 0 Then
Row = TestDS.Tables("Ads").Rows(0)
AdNum = Row.Item("AdNum")
Title = Row.Item("Title")
Description = Row.Item("Description")
Category = Row.Item("Category")
Price = Row.Item("Price")
Phone = Row.Item("Phone")
Email = Row.Item("Email")
State = Row.Item("State")
Posted = Row.Item("Posted")
Password = Row.Item("Password")
Image = Row.Item("Image")
TitleLabel.Text = Title
DescriptionLabel.Text = Description
PriceLabel.Text = Price
PhoneLabel.Text = Phone
EmailLink.Text = Email
EmailLink.NavigateURL = "mailto:" & Email
StateLabel.Text = State
PostedLabel.Text = Posted
ImageLabel.Text = Image
End If
PostErrors
End Sub
Sub PlaceAd
Row = TestDS.Tables("Ads").NewRow
CopyToDS
Row.Item("Posted") = CDate(Today)
TestDS.Tables("Ads").Rows.Add(Row)
Adapter.Update(TestDS, "Ads")
PostErrors
End Sub
Sub EditAd
CopyToDS
Adapter.Update(TestDS, "Ads")
PostErrors
End Sub
Sub DeleteAd
TestDS.Tables("Ads").Rows(0).Delete
Adapter.Update(TestDS, "Ads")
PostErrors
End Sub
' Copy the values in the properties of this
' control in the TestDS
Private Sub CopyToDS
Row.Item("Title") = Title
Row.Item("Description") = Description
Row.Item("Category") = Category
Row.Item("Price") = CSng(Price)
Row.Item("Phone") = Phone
Row.Item("Email") = Email
Row.Item("State") = State
Row.Item("Password") = Password
Row.Item("Image") = Image
End Sub
Private Sub PostErrors
HasErrors = TestDS.HasErrors
If HasErrors Then
RowError = TestDS.Tables("Ads").Rows(0).RowError
End If
End Sub
</script>
<asp:datalist id="DataList1" runat="server"></asp:datalist>
<TABLE id="Table1" cellSpacing="0" cellPadding="2" width="100%" bgColor="lime" border="1">
<tr>
<td bgColor="yellow" colSpan="2"><asp:label id="TitleLabel" runat="server" font-bold="true" font-size="12 pt"></asp:label></td>
</tr>
<tr>
<td vAlign="top" width="25%">Description:</td>
<td><asp:label id="DescriptionLabel" runat="server" font-bold="true" font-size="12 pt"></asp:label></td>
</tr>
<tr>
<td width="25%">Price:</td>
<td>$<asp:label id="PriceLabel" runat="server" font-bold="true" font-size="12 pt"></asp:label>
</td>
</tr>
<tr>
<td width="25%">Phone:</td>
<td><asp:label id="PhoneLabel" runat="server" font-bold="true" font-size="12 pt"></asp:label></td>
</tr>
<tr>
<td width="25%">Email:</td>
<td><asp:hyperlink id="EmailLink" runat="server" font-bold="true" font-size="12 pt"></asp:hyperlink></td>
</tr>
<tr>
<td width="25%">Location:</td>
<td><asp:label id="StateLabel" runat="server" font-bold="true" font-size="12 pt"></asp:label></td>
</tr>
<tr>
<td width="25%">Posted Date:</td>
<td><asp:label id="PostedLabel" runat="server" font-bold="true" font-size="12 pt"></asp:label></td>
</tr>
<tr>
<td width="25%">Image:</td>
<td><IMG SRC='images/<%# Container.DataItem("ImageLabel") %>' Border="0"></td>
</tr>
</TABLE>Anyone have any idea??????
You forgot to DataBind()
Bleroy,
If I run the code without trying to pull an image it works and I didn't Data Bind() it. When an image is add into the mix do you have to Data Bind()? Is an image handled different?
Thanks.
A help would be apprieciated. This is really frustrating me. grrrr
What does ImageLabel contain? What do you see when you look at the client-side HTML?
trouble dynamically loading content to my website
My code looks like this:
default.aspx:
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
string page = Request.QueryString.Get("page");
PlaceHolder1.Controls.Clear();
if (page == null)
PlaceHolder1.Controls.Add(LoadControl("default" + ".ascx"));
else
{
PlaceHolder1.Controls.Add(LoadControl(page + ".ascx"));
}
}
</script>
<html>
<head></head>
<body>
.....
</body>
</html
and the default.ascx is just a regular html page including a flash document:
<html>
<head>
<title>Main</title>
</head>
<body>
<center>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
width="640" height="480" id="main" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="main.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed src="http://pics.10026.com/?src=main.swf" quality="high" bgcolor="#000000" width="640" height="480"
swLiveConnect="true" NAME="main.swf" name="main" align="middle"
allowScriptAccess="sameDomain" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</center>
</body>
</html
The error I get is :
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: CS0246: The type or namespace name 'PlaceHolder1' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 6: {
Line 7: string p = Request.QueryString.Get("page");
Line 8: PlaceHolder1.Controls.Clear();
Line 9: if (page == null)
Line 10: PlaceHolder1.Controls.Add(LoadControl("default" + ".ascx"));
Source File: F:\WWW\default.aspx Line: 8
What am I doing wrong? Also where do I add code into my default.aspx page to tell it where to load the other pages. As far as I can see, it just knows the load the a page but I can't figure out how it knows where to load it. I really appreciate all your help. Thanks a lot.What this is saying is that your placeholder1 does not exsist. Check your code to ensure you are using the corredt spelling for placeholder 1.
check out this maybe this can help
http://dotnet247.com/247reference/msgs/51/256296.aspx
I copied and pasted my code from my file. I really have no idea why it is saying that it doesnt exist. Do I have to import a library??
Trouble getting page to work in FireFox
javascript. This page works fine in IE.
In FireFox however, I have found that if the page is using XHTML 1.0
Transitional as the doctype, you cannot set the style.left and style.top
properties of image or div tags. If you remove the doctype from the page it
works just fine, although I would rather not do this. You can work around
this by setting the cssText property directly (which works in both browsers),
but I now have the annoying issue of having to fix up the cssText.
Does anyone know if this is a feature of the XHTML 1.0 Transitional
specification or if it is an anoying bug in FireFox?
Thanks in advance.John Bailey wrote:
Quote:
Originally Posted by
I have a ASP .Net page that allows moving around items on the page through
javascript. This page works fine in IE.
>
In FireFox however, I have found that if the page is using XHTML 1.0
Transitional as the doctype, you cannot set the style.left and style.top
properties of image or div tags. If you remove the doctype from the page it
works just fine, although I would rather not do this. You can work around
this by setting the cssText property directly (which works in both browsers),
but I now have the annoying issue of having to fix up the cssText.
>
Does anyone know if this is a feature of the XHTML 1.0 Transitional
specification or if it is an anoying bug in FireFox?
>
Thanks in advance.
I use the same doctype, and have never had the problems that you describe.
There is nothing that prevents you from setting style.left and style.top
on elements, but naturally you also have to make the elements absolutely
or relatively positioned for the properties to have any effect.
The cssText property is non-standard. I would advice against using it.
--
G?ran Andersson
_____
http://www.guffa.com
Actually I figured it out. As it turns out, it was the placement of the
doctype tag itself. In the test page I had the doctype placed before a page
style element. Style elements cannot be inside other elements according to
the spec, which basically means they have to be the first thing on the page.
FireFox doesn't seem to like the misplacement although all other browsers did
not seem to care, and the symptom was particularly odd. Once I moved the
doctype tag to after the closing style tag the page worked without issue.
I have the two pages in a test bed:
Broken page
http://www.baileysw.com/testing/dragdroptest.htm
Working page
http://www.baileysw.com/testing/workingdragdrop.htm
You'll notice that the only difference between them is the placement of the
doctype element.
Oddly, since I only use page level style elements in test pages (as apposed
to css in production pages) I would not have seen this in production at all.
This is by far one of the weirdest behaviors I have seen though.
"G?ran Andersson" wrote:
Quote:
Originally Posted by
John Bailey wrote:
Quote:
Originally Posted by
I have a ASP .Net page that allows moving around items on the page through
javascript. This page works fine in IE.
In FireFox however, I have found that if the page is using XHTML 1.0
Transitional as the doctype, you cannot set the style.left and style.top
properties of image or div tags. If you remove the doctype from the page it
works just fine, although I would rather not do this. You can work around
this by setting the cssText property directly (which works in both browsers),
but I now have the annoying issue of having to fix up the cssText.
Does anyone know if this is a feature of the XHTML 1.0 Transitional
specification or if it is an anoying bug in FireFox?
Thanks in advance.
>
I use the same doctype, and have never had the problems that you describe.
>
There is nothing that prevents you from setting style.left and style.top
on elements, but naturally you also have to make the elements absolutely
or relatively positioned for the properties to have any effect.
>
The cssText property is non-standard. I would advice against using it.
>
--
G?ran Andersson
_____
http://www.guffa.com
>
On Mar 28, 3:07 am, John Bailey <JohnBai...@.discussions.microsoft.com>
wrote:
Quote:
Originally Posted by
Actually I figured it out. As it turns out, it was the placement of the
doctype tag itself. In the test page I had the doctype placed before a page
style element. Style elements cannot be inside other elements according to
the spec, which basically means they have to be the first thing on the page.
FireFox doesn't seem to like the misplacement although all other browsers did
not seem to care, and the symptom was particularly odd. Once I moved the
doctype tag to after the closing style tag the page worked without issue.
>
I have the two pages in a test bed:
Broken pagehttp://www.baileysw.com/testing/dragdroptest.htm
>
Working pagehttp://www.baileysw.com/testing/workingdragdrop.htm
>
You'll notice that the only difference between them is the placement of the
doctype element.
>
Oddly, since I only use page level style elements in test pages (as apposed
to css in production pages) I would not have seen this in production at all.
>
This is by far one of the weirdest behaviors I have seen though.
>
Um, shouldn't the style element be inside the head element?
Certainly this part of the XHTML transitional DTD:
<!ELEMENT html (head, body)>
<!ATTLIST html
%i18n;
id ID #IMPLIED
xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml'
Quote:
Originally Posted by
>
<!--================ Document Head
=======================================-->
<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*">
<!-- content model is %head.misc; combined with a single
title and an optional base element in any order -->
<!ELEMENT head (%head.misc;,
((title, %head.misc;, (base, %head.misc;)?) |
(base, %head.misc;, (title, %head.misc;))))>
says that style is an optional element within head.
Damien
Actually both your pages are broken.
The doctype tag has to be the first tag in the page, or it will be
ignored. If you check the page information (in Firefox) of the page that
you called "Working page", it's displayed using Quirks mode. This
basically means that the browser reverts to a behaviour that tries to do
the best out of badly formed markup.
In Internet Explorer the Quirks mode can be rather devestationg. It
throws the browser in a kind of version 4 compatible mode, which messes
up the box model (padding, margin and size in css) as that version badly
misinterpreted it.
The style tag should be inside the head tag. I think that you have
confused "elements" with "tags". The head tag is not an element in the
page, the elements are inside the body tag.
John Bailey wrote:
Quote:
Originally Posted by
Actually I figured it out. As it turns out, it was the placement of the
doctype tag itself. In the test page I had the doctype placed before a page
style element. Style elements cannot be inside other elements according to
the spec, which basically means they have to be the first thing on the page.
FireFox doesn't seem to like the misplacement although all other browsers did
not seem to care, and the symptom was particularly odd. Once I moved the
doctype tag to after the closing style tag the page worked without issue.
>
I have the two pages in a test bed:
Broken page
http://www.baileysw.com/testing/dragdroptest.htm
>
Working page
http://www.baileysw.com/testing/workingdragdrop.htm
>
You'll notice that the only difference between them is the placement of the
doctype element.
>
Oddly, since I only use page level style elements in test pages (as apposed
to css in production pages) I would not have seen this in production at all.
>
This is by far one of the weirdest behaviors I have seen though.
>
>
"G?ran Andersson" wrote:
>
Quote:
Originally Posted by
>John Bailey wrote:
Quote:
Originally Posted by
>>I have a ASP .Net page that allows moving around items on the page through
>>javascript. This page works fine in IE.
>>>
>>In FireFox however, I have found that if the page is using XHTML 1.0
>>Transitional as the doctype, you cannot set the style.left and style.top
>>properties of image or div tags. If you remove the doctype from the page it
>>works just fine, although I would rather not do this. You can work around
>>this by setting the cssText property directly (which works in both browsers),
>>but I now have the annoying issue of having to fix up the cssText.
>>>
>>Does anyone know if this is a feature of the XHTML 1.0 Transitional
>>specification or if it is an anoying bug in FireFox?
>>>
>>Thanks in advance.
>I use the same doctype, and have never had the problems that you describe.
>>
>There is nothing that prevents you from setting style.left and style.top
>on elements, but naturally you also have to make the elements absolutely
>or relatively positioned for the properties to have any effect.
>>
>The cssText property is non-standard. I would advice against using it.
>>
>--
>G?ran Andersson
>_____
>http://www.guffa.com
>>
--
G?ran Andersson
_____
http://www.guffa.com
Yes, you're absolutely correct, the style element should go inside the head
element. A fact which I picked up on later (I don't use the in page style
tag very often).
The error as it turns out is that FireFox does not support setting the
style.left and style.top to numbers and defaulting to pixels. Apparently you
have to specifically specify "123 px" when specifying the position
properties. None of the other browsers I tested (IE and Opera) had this
restriction.
The "Quirks" mode in FireFox is more of a joke than anything else, as
FireFox is completely unforgiving with errors in markup (which is why I check
in it in the first place), but I do need to remember to check for the page
mode in the future. For some reason I thought you had to enable the Quirks
mode and that it gave an error by default, but I'm obviously mistaken.
Apparently FireFox does support defaulting to pixels in this mode, but not in
standards compliance mode.
Thanks for you help.
"G?ran Andersson" wrote:
Quote:
Originally Posted by
Actually both your pages are broken.
>
The doctype tag has to be the first tag in the page, or it will be
ignored. If you check the page information (in Firefox) of the page that
you called "Working page", it's displayed using Quirks mode. This
basically means that the browser reverts to a behaviour that tries to do
the best out of badly formed markup.
>
In Internet Explorer the Quirks mode can be rather devestationg. It
throws the browser in a kind of version 4 compatible mode, which messes
up the box model (padding, margin and size in css) as that version badly
misinterpreted it.
>
The style tag should be inside the head tag. I think that you have
confused "elements" with "tags". The head tag is not an element in the
page, the elements are inside the body tag.
>
John Bailey wrote:
Quote:
Originally Posted by
Actually I figured it out. As it turns out, it was the placement of the
doctype tag itself. In the test page I had the doctype placed before a page
style element. Style elements cannot be inside other elements according to
the spec, which basically means they have to be the first thing on the page.
FireFox doesn't seem to like the misplacement although all other browsers did
not seem to care, and the symptom was particularly odd. Once I moved the
doctype tag to after the closing style tag the page worked without issue.
I have the two pages in a test bed:
Broken page
http://www.baileysw.com/testing/dragdroptest.htm
Working page
http://www.baileysw.com/testing/workingdragdrop.htm
You'll notice that the only difference between them is the placement of the
doctype element.
Oddly, since I only use page level style elements in test pages (as apposed
to css in production pages) I would not have seen this in production at all.
This is by far one of the weirdest behaviors I have seen though.
"G?ran Andersson" wrote:
Quote:
Originally Posted by
John Bailey wrote:
>I have a ASP .Net page that allows moving around items on the page through
>javascript. This page works fine in IE.
>>
>In FireFox however, I have found that if the page is using XHTML 1.0
>Transitional as the doctype, you cannot set the style.left and style.top
>properties of image or div tags. If you remove the doctype from the page it
>works just fine, although I would rather not do this. You can work around
>this by setting the cssText property directly (which works in both browsers),
>but I now have the annoying issue of having to fix up the cssText.
>>
>Does anyone know if this is a feature of the XHTML 1.0 Transitional
>specification or if it is an anoying bug in FireFox?
>>
>Thanks in advance.
I use the same doctype, and have never had the problems that you describe.
>
There is nothing that prevents you from setting style.left and style.top
on elements, but naturally you also have to make the elements absolutely
or relatively positioned for the properties to have any effect.
>
The cssText property is non-standard. I would advice against using it.
>
--
G?ran Andersson
_____
http://www.guffa.com
>
>
>
--
G?ran Andersson
_____
http://www.guffa.com
>
John Bailey wrote:
Quote:
Originally Posted by
The error as it turns out is that FireFox does not support setting the
style.left and style.top to numbers and defaulting to pixels. Apparently you
have to specifically specify "123 px" when specifying the position
properties. None of the other browsers I tested (IE and Opera) had this
restriction.
The standard says that all measurements needs to have a specified unit,
unless the value is zero. If you omit the unit, the code is invalid, and
the browser may handle it as such.
If a browser adds a default unit to properties, it's adding non-standard
behaviour. As the units may not be omitted according to the standard,
there are no default unit specified for different properties, and pixels
is not the logical default for all properties. The font-size property
for example has no singe unit that clearly would be the preferred
default, and it's quite a big difference between 10px and 10em. If you
write code relying on the chosen default in one browser, another browser
may display the page in a completely different way, and neither of them
is more right than the other.
If you keep to the standards, the page stands a better chance at
displaying the same way in other browsers. After all, you can't try it
in all versions of all browsers, especially as the versions of the
browsers that will be used to view the page in months or years from now
doesn't even exist yet.
--
G?ran Andersson
_____
http://www.guffa.com
The missing unit was an oversight, but either way everyone makes mistakes
including the people writing the browsers. FireFox does use the default unit
when it is in "Quirks" mode, which is why it worked in that instance.
FireFox should either ALWAYS ignore the setting if it is in error or ALWAYS
use it. It is the fact that it switched back and forth that made this so
hard to track down. When I've made a coding mistake, its usually pretty easy
to track down in IE or Opera, but FireFox tends to be the hardest one to find
errors in.
There is no browser that 100% follows the standards, although FireFox is the
one that does the best job. Even if you do a page to standards, you had
better make sure it looks correct in the browsers you are planning to
support, because it is likely that they will not support the standards. If
your page follows the standard, but does not look correct in IE for example,
you have just lost 80% of the general audience.
You also do need to test your pages as new versions of the browsers come
out. If you have needed to do workarounds in your pages to make the page
work with a browser, these workarounds may very well need to be tweaked when
a new version of the browser comes out (look at the last version of Safari
and IE for example).
John Bailey
"G?ran Andersson" wrote:
Quote:
Originally Posted by
John Bailey wrote:
Quote:
Originally Posted by
The error as it turns out is that FireFox does not support setting the
style.left and style.top to numbers and defaulting to pixels. Apparently you
have to specifically specify "123 px" when specifying the position
properties. None of the other browsers I tested (IE and Opera) had this
restriction.
>
The standard says that all measurements needs to have a specified unit,
unless the value is zero. If you omit the unit, the code is invalid, and
the browser may handle it as such.
>
If a browser adds a default unit to properties, it's adding non-standard
behaviour. As the units may not be omitted according to the standard,
there are no default unit specified for different properties, and pixels
is not the logical default for all properties. The font-size property
for example has no singe unit that clearly would be the preferred
default, and it's quite a big difference between 10px and 10em. If you
write code relying on the chosen default in one browser, another browser
may display the page in a completely different way, and neither of them
is more right than the other.
>
If you keep to the standards, the page stands a better chance at
displaying the same way in other browsers. After all, you can't try it
in all versions of all browsers, especially as the versions of the
browsers that will be used to view the page in months or years from now
doesn't even exist yet.
>
--
G?ran Andersson
_____
http://www.guffa.com
>
John Bailey wrote:
Quote:
Originally Posted by
The missing unit was an oversight, but either way everyone makes mistakes
including the people writing the browsers. FireFox does use the default unit
when it is in "Quirks" mode, which is why it worked in that instance.
>
FireFox should either ALWAYS ignore the setting if it is in error or ALWAYS
use it. It is the fact that it switched back and forth that made this so
hard to track down.
I think not. In quirks mode it can use non-standard ways of interpreting
the code, but in standards compliant mode it should follow the
standards, and that is exactly what it is doing in this case.
Internet Explorer on the other hand is not following the standards in
standards compliant mode, which causes probems from time to time.
Quote:
Originally Posted by
When I've made a coding mistake, its usually pretty easy
to track down in IE or Opera, but FireFox tends to be the hardest one to find
errors in.
My experience is the opposite. Building for Firefox rarely causes any
problems, but Internet Explorer have caused many hours of trying to find
ways to circumvent the bugs.
Quote:
Originally Posted by
There is no browser that 100% follows the standards, although FireFox is the
one that does the best job. Even if you do a page to standards, you had
better make sure it looks correct in the browsers you are planning to
support, because it is likely that they will not support the standards.
True. I have recently had some experiences with Internet Explorer, where
it would just hide parts of the page. The solution is often to add some
weird combination of styles that shouldn't have any effect at all, like
adding display:inline to a floating elements.
Quote:
Originally Posted by
If
your page follows the standard, but does not look correct in IE for example,
you have just lost 80% of the general audience.
>
You also do need to test your pages as new versions of the browsers come
out. If you have needed to do workarounds in your pages to make the page
work with a browser, these workarounds may very well need to be tweaked when
a new version of the browser comes out (look at the last version of Safari
and IE for example).
Yes, but you can greatly reduce the risk for newer browser versions to
break your pages by sticking to standard ways of doing things. When
there is rendering problems in some browsers, I always try to find a
more stable way of using the standards instead of adding browser
specific hacks.
--
G?ran Andersson
_____
http://www.guffa.com
On Mar 29, 2:36 am, John Bailey <JohnBai...@.discussions.microsoft.com>
wrote:
Quote:
Originally Posted by
The missing unit was an oversight, but either way everyone makes mistakes
including the people writing the browsers. FireFox does use the default unit
when it is in "Quirks" mode, which is why it worked in that instance.
>
FireFox should either ALWAYS ignore the setting if it is in error or ALWAYS
use it. It is the fact that it switched back and forth that made this so
hard to track down. When I've made a coding mistake, its usually pretty easy
to track down in IE or Opera, but FireFox tends to be the hardest one to find
errors in.
>
If Firefox always applied the same behaviour, whether it was in quirks
mode or not, what would be the point in it having a quirks mode? You
again refered to the "default unit", when no such thing exists.
Damien
Trouble getting page to work in FireFox
javascript. This page works fine in IE.
In FireFox however, I have found that if the page is using XHTML 1.0
Transitional as the doctype, you cannot set the style.left and style.top
properties of image or div tags. If you remove the doctype from the page it
works just fine, although I would rather not do this. You can work around
this by setting the cssText property directly (which works in both browsers)
,
but I now have the annoying issue of having to fix up the cssText.
Does anyone know if this is a feature of the XHTML 1.0 Transitional
specification or if it is an anoying bug in FireFox?
Thanks in advance.John Bailey wrote:
> I have a ASP .Net page that allows moving around items on the page throug
h
> javascript. This page works fine in IE.
> In FireFox however, I have found that if the page is using XHTML 1.0
> Transitional as the doctype, you cannot set the style.left and style.top
> properties of image or div tags. If you remove the doctype from the page
it
> works just fine, although I would rather not do this. You can work around
> this by setting the cssText property directly (which works in both browser
s),
> but I now have the annoying issue of having to fix up the cssText.
> Does anyone know if this is a feature of the XHTML 1.0 Transitional
> specification or if it is an anoying bug in FireFox?
> Thanks in advance.
I use the same doctype, and have never had the problems that you describe.
There is nothing that prevents you from setting style.left and style.top
on elements, but naturally you also have to make the elements absolutely
or relatively positioned for the properties to have any effect.
The cssText property is non-standard. I would advice against using it.
G?ran Andersson
_____
http://www.guffa.com
Actually I figured it out. As it turns out, it was the placement of the
doctype tag itself. In the test page I had the doctype placed before a page
style element. Style elements cannot be inside other elements according to
the spec, which basically means they have to be the first thing on the page.
FireFox doesn't seem to like the misplacement although all other browsers di
d
not seem to care, and the symptom was particularly odd. Once I moved the
doctype tag to after the closing style tag the page worked without issue.
I have the two pages in a test bed:
Broken page
http://www.baileysw.com/testing/dragdroptest.htm
Working page
http://www.baileysw.com/testing/workingdragdrop.htm
You'll notice that the only difference between them is the placement of the
doctype element.
Oddly, since I only use page level style elements in test pages (as apposed
to css in production pages) I would not have seen this in production at all.
This is by far one of the weirdest behaviors I have seen though.
"G?ran Andersson" wrote:
> John Bailey wrote:
> I use the same doctype, and have never had the problems that you describe.
> There is nothing that prevents you from setting style.left and style.top
> on elements, but naturally you also have to make the elements absolutely
> or relatively positioned for the properties to have any effect.
> The cssText property is non-standard. I would advice against using it.
> --
> G?ran Andersson
> _____
> http://www.guffa.com
>
On Mar 28, 3:07 am, John Bailey <JohnBai...@.discussions.microsoft.com>
wrote:
> Actually I figured it out. As it turns out, it was the placement of the
> doctype tag itself. In the test page I had the doctype placed before a pa
ge
> style element. Style elements cannot be inside other elements according t
o
> the spec, which basically means they have to be the first thing on the pag
e.
> FireFox doesn't seem to like the misplacement although all other browsers
did
> not seem to care, and the symptom was particularly odd. Once I moved the
> doctype tag to after the closing style tag the page worked without issue.
> I have the two pages in a test bed:
> Broken pagehttp://www.baileysw.com/testing/dragdroptest.htm
> Working pagehttp://www.baileysw.com/testing/workingdragdrop.htm
> You'll notice that the only difference between them is the placement of th
e
> doctype element.
> Oddly, since I only use page level style elements in test pages (as appose
d
> to css in production pages) I would not have seen this in production at al
l.
> This is by far one of the weirdest behaviors I have seen though.
>
Um, shouldn't the style element be inside the head element?
Certainly this part of the XHTML transitional DTD:
<!ELEMENT html (head, body)>
<!ATTLIST html
%i18n;
id ID #IMPLIED
xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml'
>
<!--================ Document Head
=======================================-->
<!ENTITY % head.misc " (script|style|meta|link|object|isindex)*
">
<!-- content model is %head.misc; combined with a single
title and an optional base element in any order -->
<!ELEMENT head (%head.misc;,
((title, %head.misc;, (base, %head.misc;)?) |
(base, %head.misc;, (title, %head.misc;))))>
says that style is an optional element within head.
Damien
Actually both your pages are broken.
The doctype tag has to be the first tag in the page, or it will be
ignored. If you check the page information (in Firefox) of the page that
you called "Working page", it's displayed using Quirks mode. This
basically means that the browser reverts to a behaviour that tries to do
the best out of badly formed markup.
In Internet Explorer the Quirks mode can be rather devestationg. It
throws the browser in a kind of version 4 compatible mode, which messes
up the box model (padding, margin and size in css) as that version badly
misinterpreted it.
The style tag should be inside the head tag. I think that you have
page, the elements are inside the body tag.
John Bailey wrote:
> Actually I figured it out. As it turns out, it was the placement of the
> doctype tag itself. In the test page I had the doctype placed before a pa
ge
> style element. Style elements cannot be inside other elements according t
o
> the spec, which basically means they have to be the first thing on the pag
e.
> FireFox doesn't seem to like the misplacement although all other browsers
did
> not seem to care, and the symptom was particularly odd. Once I moved the
> doctype tag to after the closing style tag the page worked without issue.
> I have the two pages in a test bed:
> Broken page
> http://www.baileysw.com/testing/dragdroptest.htm
> Working page
> http://www.baileysw.com/testing/workingdragdrop.htm
> You'll notice that the only difference between them is the placement of th
e
> doctype element.
> Oddly, since I only use page level style elements in test pages (as appose
d
> to css in production pages) I would not have seen this in production at al
l.
> This is by far one of the weirdest behaviors I have seen though.
>
> "G?ran Andersson" wrote:
>
G?ran Andersson
_____
http://www.guffa.com
Yes, you're absolutely correct, the style element should go inside the head
element. A fact which I picked up on later (I don't use the in page style
tag very often).
The error as it turns out is that FireFox does not support setting the
style.left and style.top to numbers and defaulting to pixels. Apparently yo
u
have to specifically specify "123 px" when specifying the position
properties. None of the other browsers I tested (IE and Opera) had this
restriction.
The "Quirks" mode in FireFox is more of a joke than anything else, as
FireFox is completely unforgiving with errors in markup (which is why I chec
k
in it in the first place), but I do need to remember to check for the page
mode in the future. For some reason I thought you had to enable the Quirks
mode and that it gave an error by default, but I'm obviously mistaken.
Apparently FireFox does support defaulting to pixels in this mode, but not i
n
standards compliance mode.
Thanks for you help.
"G?ran Andersson" wrote:
> Actually both your pages are broken.
> The doctype tag has to be the first tag in the page, or it will be
> ignored. If you check the page information (in Firefox) of the page that
> you called "Working page", it's displayed using Quirks mode. This
> basically means that the browser reverts to a behaviour that tries to do
> the best out of badly formed markup.
> In Internet Explorer the Quirks mode can be rather devestationg. It
> throws the browser in a kind of version 4 compatible mode, which messes
> up the box model (padding, margin and size in css) as that version badly
> misinterpreted it.
> The style tag should be inside the head tag. I think that you have
>
> page, the elements are inside the body tag.
> John Bailey wrote:
>
> --
> G?ran Andersson
> _____
> http://www.guffa.com
>
John Bailey wrote:
> The error as it turns out is that FireFox does not support setting the
> style.left and style.top to numbers and defaulting to pixels. Apparently
you
> have to specifically specify "123 px" when specifying the position
> properties. None of the other browsers I tested (IE and Opera) had this
> restriction.
The standard says that all measurements needs to have a specified unit,
unless the value is zero. If you omit the unit, the code is invalid, and
the browser may handle it as such.
If a browser adds a default unit to properties, it's adding non-standard
behaviour. As the units may not be omitted according to the standard,
there are no default unit specified for different properties, and pixels
is not the logical default for all properties. The font-size property
for example has no singe unit that clearly would be the preferred
default, and it's quite a big difference between 10px and 10em. If you
write code relying on the chosen default in one browser, another browser
may display the page in a completely different way, and neither of them
is more right than the other.
If you keep to the standards, the page stands a better chance at
displaying the same way in other browsers. After all, you can't try it
in all versions of all browsers, especially as the versions of the
browsers that will be used to view the page in months or years from now
doesn't even exist yet.
G?ran Andersson
_____
http://www.guffa.com
The missing unit was an oversight, but either way everyone makes mistakes
including the people writing the browsers. FireFox does use the default uni
t
when it is in "Quirks" mode, which is why it worked in that instance.
FireFox should either ALWAYS ignore the setting if it is in error or ALWAYS
use it. It is the fact that it switched back and forth that made this so
hard to track down. When I've made a coding mistake, its usually pretty eas
y
to track down in IE or Opera, but FireFox tends to be the hardest one to fin
d
errors in.
There is no browser that 100% follows the standards, although FireFox is the
one that does the best job. Even if you do a page to standards, you had
better make sure it looks correct in the browsers you are planning to
support, because it is likely that they will not support the standards. If
your page follows the standard, but does not look correct in IE for example,
you have just lost 80% of the general audience.
You also do need to test your pages as new versions of the browsers come
out. If you have needed to do workarounds in your pages to make the page
work with a browser, these workarounds may very well need to be tweaked when
a new version of the browser comes out (look at the last version of Safari
and IE for example).
John Bailey
"G?ran Andersson" wrote:
> John Bailey wrote:
> The standard says that all measurements needs to have a specified unit,
> unless the value is zero. If you omit the unit, the code is invalid, and
> the browser may handle it as such.
> If a browser adds a default unit to properties, it's adding non-standard
> behaviour. As the units may not be omitted according to the standard,
> there are no default unit specified for different properties, and pixels
> is not the logical default for all properties. The font-size property
> for example has no singe unit that clearly would be the preferred
> default, and it's quite a big difference between 10px and 10em. If you
> write code relying on the chosen default in one browser, another browser
> may display the page in a completely different way, and neither of them
> is more right than the other.
> If you keep to the standards, the page stands a better chance at
> displaying the same way in other browsers. After all, you can't try it
> in all versions of all browsers, especially as the versions of the
> browsers that will be used to view the page in months or years from now
> doesn't even exist yet.
> --
> G?ran Andersson
> _____
> http://www.guffa.com
>
John Bailey wrote:
> The missing unit was an oversight, but either way everyone makes mistakes
> including the people writing the browsers. FireFox does use the default u
nit
> when it is in "Quirks" mode, which is why it worked in that instance.
> FireFox should either ALWAYS ignore the setting if it is in error or ALWAY
S
> use it. It is the fact that it switched back and forth that made this so
> hard to track down.
I think not. In quirks mode it can use non-standard ways of interpreting
the code, but in standards compliant mode it should follow the
standards, and that is exactly what it is doing in this case.
Internet Explorer on the other hand is not following the standards in
standards compliant mode, which causes probems from time to time.
> When I've made a coding mistake, its usually pretty easy
> to track down in IE or Opera, but FireFox tends to be the hardest one to f
ind
> errors in.
My experience is the opposite. Building for Firefox rarely causes any
problems, but Internet Explorer have caused many hours of trying to find
ways to circumvent the bugs.
> There is no browser that 100% follows the standards, although FireFox is t
he
> one that does the best job. Even if you do a page to standards, you had
> better make sure it looks correct in the browsers you are planning to
> support, because it is likely that they will not support the standards.
True. I have recently had some experiences with Internet Explorer, where
it would just hide parts of the page. The solution is often to add some
weird combination of styles that shouldn't have any effect at all, like
adding display:inline to a floating elements.
> If
> your page follows the standard, but does not look correct in IE for exampl
e,
> you have just lost 80% of the general audience.
> You also do need to test your pages as new versions of the browsers come
> out. If you have needed to do workarounds in your pages to make the page
> work with a browser, these workarounds may very well need to be tweaked wh
en
> a new version of the browser comes out (look at the last version of Safari
> and IE for example).
Yes, but you can greatly reduce the risk for newer browser versions to
break your pages by sticking to standard ways of doing things. When
there is rendering problems in some browsers, I always try to find a
more stable way of using the standards instead of adding browser
specific hacks.
G?ran Andersson
_____
http://www.guffa.com
On Mar 29, 2:36 am, John Bailey <JohnBai...@.discussions.microsoft.com>
wrote:
> The missing unit was an oversight, but either way everyone makes mistakes
> including the people writing the browsers. FireFox does use the default u
nit
> when it is in "Quirks" mode, which is why it worked in that instance.
> FireFox should either ALWAYS ignore the setting if it is in error or ALWAY
S
> use it. It is the fact that it switched back and forth that made this so
> hard to track down. When I've made a coding mistake, its usually pretty e
asy
> to track down in IE or Opera, but FireFox tends to be the hardest one to f
ind
> errors in.
>
If Firefox always applied the same behaviour, whether it was in quirks
mode or not, what would be the point in it having a quirks mode? You
again refered to the "default unit", when no such thing exists.
Damien
Trouble getting started
I have created a new website on my server. I save myfirst page and try to open it and this is the error I get..... can anyone help me...
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The currentcustom error settings for this application prevent the details of theapplication error from being viewed remotely (for security reasons). Itcould, however, be viewed by browsers running on the local servermachine.
Details: To enable the details of this specific error message to beviewable on remote machines, please create a <customErrors> tagwithin a "web.config" configuration file located in the root directoryof the current web application. This <customErrors> tag shouldthen have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File --
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration
Notes: The current error page you are seeing can be replaced by acustom error page by modifying the "defaultRedirect" attribute of theapplication's <customErrors> configuration tag to point to acustom error page URL.
<!-- Web.Config Configuration File --
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
In your web.config file you have the following:
<customErrors mode="Off"/>
Change it to:
<customErrors mode="On"/>
So you will get the description of the real error.
Try it and that didn't work.. but I am not sure where to put that... so here is my xml file...
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="false" strict="false" explicit="true" />
<pages>
<namespaces>
<clear />
<add namespace="System" />
<add namespace="System.Collections" />
<add namespace="System.Collections.Specialized" />
<add namespace="System.Configuration" />
<add namespace="System.Text" />
<add namespace="System.Text.RegularExpressions" />
<add namespace="System.Web" />
<add namespace="System.Web.Caching" />
<add namespace="System.Web.SessionState" />
<add namespace="System.Web.Security" />
<add namespace="System.Web.Profile" />
<add namespace="System.Web.UI" />
<add namespace="System.Web.UI.WebControls" />
<add namespace="System.Web.UI.WebControls.WebParts" />
<add namespace="System.Web.UI.HtmlControls" />
</namespaces>
</pages>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
You need to do this:
<customErrorsmode="Off" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
Nope.. didn't work... same error. I am opening my .xmlfile in Visual studio and then just saving it... I don't have to rebootthe webserver or anything right. Also I am not on thewwwroot. My file is in wwwroot/asp
Rich
Hmmmm. Try to replace this:
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
with this:
<customErrors mode="Off"/>
if mode=
"On" specifies that custom errors are enabled. If no defaultRedirect is specified, users see a generic error.
"Off" specifies that custom errors are disabled. This allows display of detailed errors.
"RemoteOnly" specifies that custom errors are shown only to remote clients, and ASP.NET errors are shown to the local host. This is the default.
Still not working. God this is frustrating. Is there some settings that I have to be changing on my server orsomething??
Since I am new to ASP.. do I need the web.config file?
What is the error that I am actually getting or you can't tell because the error won't show on the page??
Rich
I think you are working directly on your web site virtual path; where you have a tool "Visual Web Developper Express Edition" that you can download for free and work on it on a temporary folder; then after testing your site, you can upload it to whatever IIS server you wish. Correct me if this is not the situation that you are in.
After all, please post the page html, and code behind that you are trying to run.
Hello,
Please do bare with me. I am brand now to ASP, I am switiching from cold fusion.
Soi am working on my computer and I created a new website on mywebserver. I working out of a folder called ASP under thewwwroot.
Not sure what you mean by "web site virtual path". I openmy visual studio, and instead of creating a webstie on my webserver Icreated a new website on mycomputer. I can't seem tofind the directory where it created the website. I found theplace where I copy the files to the remote web site. So i copiedthe website through visual studio over to my webserver. I try toview the page but it give me the same error. Here is my code forthe web page I am trying to run. It is a general template and Ijust put some letters inside the form.
<%@. Page 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>
sdsdaf
</div>
</form>
</body>
</html
First in Visual Studio, there is a window called "Solution Explorer"; if you select the project (left click once on the root of the project), you will find in the properties window a property "Opened URL" which will show you what is the path of your project.
Second before uploading (copying) your files to the remote website, you can run your web application directly from Visual Studio by pressing F5 (to run with debugging enabled) or Ctrl+F5 (to run without debugging enable). So, try to run your application from Visual Studio and see what error you are getting.
As said above check for the virtual folder setting if problem still is not solved get the event log files and post the error message here.
Ok.. so I just did the F5 thing... and the page loaded fine.
So it started a local service host on my computer and ran the page with no errors.
SO now do I copy over to my webserver??
So now I can develop my whole site on my computer and then move it to my webserver??
Rich
Of course you can develop your website on your computer and then move it to your web server.
But you have already mentioned that you have created a website on your web server; are you sure you have configured it correctly? have you installed the asp.net extensions for this website?
I tried creating a new website right on my webserver. And I hit the F5 button, but ran fine with no errors. It lookedlike it ran off my local host on my terminal computer and not thewebserver. SO i went to the page through IE and ran it off thewebserver and then it kicked me the same error. So obivisouly anddon't have the .net set up right on my server. Anychance you know what is going wrong on my webserver...
Rich