user: psw:
| lost password
ASP.NET 3.5 For Dummies :: Forums
Home » Recent messages recent posts - RSS
8/30/2010 1:27:32 PM
topic: Chapter 18 Shop Card not working

dcawkwell
Posts 2
Managed to find the solution.
Something to do with the default connection for the aspnetdb database not being there so it need something in the form of this adding to the web.config file.
Anybody know what the publickeytoken is and what it should be?

<membership>

<providers>

<remove name="AspNetSqlMembershipProvider" />

<add name="AspNetSqlMembershipProvider"

type="System.Web.Security.SqlMembershipProvider,

System.Web, Version=2.0.0.0, Culture=neutral,

PublicKeyToken=b03f5f7f11d50a3a"

connectionStringName="LocalSQLServer"

enablePasswordRetrieval="false"

enablePasswordReset="true"

requiresQuestionAndAnswer="true"

applicationName="/"

requiresUniqueEmail="false"

passwordFormat="Hashed"

maxInvalidPasswordAttempts="5"

minRequiredPasswordLength="7"

minRequiredNonalphanumericCharacters="1"

passwordAttemptWindow="10"

passwordStrengthRegularExpression="" />

</providers>

</membership>

<profile>

<providers>

<remove name="AspNetSqlProfileProvider" />

<add name="AspNetSqlProfileProvider"

connectionStringName="LocalSQLServer"

applicationName="/"

type="System.Web.Profile.SqlProfileProvider,

System.Web, Version=2.0.0.0, Culture=neutral,

PublicKeyToken=b03f5f7f11d50a3a" />

</providers>

</profile>

<roleManager>

<providers>

<remove name="AspNetSqlRoleProvider" />

<add name="AspNetSqlRoleProvider"

connectionStringName="LocalSQLServer"

applicationName="/"

type="System.Web.Security.SqlRoleProvider,

System.Web, Version=2.0.0.0, Culture=neutral,

PublicKeyToken=b03f5f7f11d50a3a" />

</providers>

</roleManager>
8/30/2010 6:14:08 AM
topic: Chapter 18 Shop Card not working

dcawkwell
Posts 2
I tried the shopping cart of CH18 and it worked. But now I come back to it I get the following error
when it is trying to creat items in the cart. What has gone wrong with my system to stop the cart working?

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Source Error:


Line 22: Public Overridable Property ShoppingCart() As ShoppingCart
Line 23: Get
Line 24: Return CType(Me.GetPropertyValue("ShoppingCart"),ShoppingCart)
Line 25: End Get
Line 26: Set
4/2/2010 8:59:47 PM
topic: Drop Down List Control

Ken Cox
Posts 170
mjrodino wrote:
Instead of displaying the first Country, I want it to say "-Select-".Thanks!


You could probably get this answer in the asp.net forums but here you go:

<%@ 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">

Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs)
If Not IsPostBack Then
' Create some data
Dim q = From tz As TimeZoneInfo _
In System.TimeZoneInfo.GetSystemTimeZones() _
Select tz.DisplayName, tz.Id, tz.BaseUtcOffset _
Order By BaseUtcOffset
' Tell the ddl to use the data
DropDownList1.DataSource = q
' Tell the ddl what data to use where
DropDownList1.DataTextField = "DisplayName"
DropDownList1.DataValueField = "Id"
' Tell the ddl to absorb this data
DropDownList1.DataBind()
' Create a new item
Dim itm As New ListItem
' Define the item
itm.Text = "-- Select --"
itm.Value = "-1"
itm.Selected = True
' Jam the item into the ddl as the first one
DropDownList1.Items.Insert(0, itm)
' Tell the ddl to select the first item
DropDownList1.SelectedIndex = 0
End If
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>

<aspBig GrinropDownList ID="DropDownList1" runat="server">
</aspBig GrinropDownList>

</div>
</form>
</body>
</html>
4/2/2010 8:42:40 PM
topic: Chp. 5. Pg 70 Drop Down Lists in C#

Ken Cox
Posts 170
D.Rabbit wrote:
Thanks for getting back to me so quickly, but I think that may have routed out the problem, I have no defined web.config file apparently. When I browse to where the files are being saved, all I find is what I can assume is a project file, which is a .sln.


Yup, a web.config is pretty well a necessity.
4/2/2010 2:12:41 PM
topic: Chp. 5. Pg 70 Drop Down Lists in C#

D.Rabbit
Posts 2
Thanks for getting back to me so quickly, but I think that may have routed out the problem, I have no defined web.config file apparently. When I browse to where the files are being saved, all I find is what I can assume is a project file, which is a .sln.
4/2/2010 1:40:02 PM
topic: Chp. 5. Pg 70 Drop Down Lists in C#

Ken Cox
Posts 170
Hi!

Sorry you're having problems.

I'm surprised that you can get any ASP.NET 3.5 stuff to work in Visual Studio 2005. Could you try working with free Visual Web Developer 2008 Express version? (http://www.microsoft.com/express/Web/)

Also you could compare the contents of the working and non-working web.config file. There might be a reference in the one for the sample code that you need.

Let me know how you make out?

Ken
4/2/2010 12:16:25 PM
topic: Chp. 5. Pg 70 Drop Down Lists in C#

D.Rabbit
Posts 2
I have been trying to update myself to C# while also picking up ASP.Net 3.5, which seems to be a losing battle. I have a degree in C++ so some of that is coming in handy, but I have hit a brick wall with Chapter 5's Drop Down Lists.

When I have tried your code posted on this site for C#, if I run it in your file provided, it works fine, however if I wanted to run it in my file I've created, I come up with issues with the "Cast" line:
clrs.AddRange(System.Enum.GetValues
(typeof(System.Drawing.KnownColor)).Cast<System.Drawing.KnownColor>());

Which tells me it doesn't understand "Cast"

If I just copy/paste your code from your page into a new page, I instead get an issue with the system.linq namespace, stating that it doesn't exist:

Error 1 The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?) C:\Documents and Settings\Drowning Rabbit\My Documents\Visual Studio 2005\WebSites\WebSite6\Default.aspx 3

I'm at a loss at where to look for an answer in Visual Studio at this point (I own a copy of VS 2005, and is what I've been using), as when I load your code, everything works, but just a simple copy/paste and I get that issue.



E: Now I'm running into the exact same problem with Page 72, Getting Multiple Choices from a ListBox. Something is odd with the line:
<%@Import Namespace="System.Linq" %>


Again, everything works fine when I use the code provided on the site, yet when I try and run it myself in a different file, it blows up.
edited by D.Rabbit on 4/2/2010
3/31/2010 7:32:03 PM
topic: Drop Down List Control

mjrodino
Posts 1
This is a great book!

I have a question regarding drop down lists. I would like a drop down list to display the text: "-Select-" initially instead of the first value of the data it is bound to. How do I do that? I'm a newbie. Is there any way to do this by using the control tasks items instead of goin directly to the source code? For example, I would like to display it in the example on p.89. Instead of displaying the first Country, I want it to say "-Select-".

Thanks!
3/24/2010 2:28:48 AM
topic: More About Me Than You Care to Know

Ken Cox
Posts 170
I got to writing tonight and ended up with a story - about me.

Everyone has a story to tell, so why not get it out there before someone else publishes the truth!
edited by Ken Cox on 3/24/2010
3/23/2010 4:34:30 PM
topic: Updating & displaying custom image Pg. 231

Ken Cox
Posts 170
fxs wrote:
Hi again,

The Button ID does not work unless you add onclick="Button1_Click" figured that out when I downloaded your code. What I don't get is, when I look into the properties there is no onclick only a onclientclick which doesn't work like the onclick. So where does the onclick come from?


I'm surprised that you're not seeing the OnClick event. It appears with a lightning bolt icon in my IDE. OnClientClick appears next to it in Intellisense.

If you're using the Properties page (F4) to get at the event, you might need to move into Design view and then click the lightning bolt icon to get the list of server-side events.

Does that help at all?

Ken
3/12/2010 2:14:45 PM
topic: Updating & displaying custom image Pg. 231

fxs
Posts 5
Hi again,

The Button ID does not work unless you add onclick="Button1_Click" figured that out when I downloaded your code. What I don't get is, when I look into the properties there is no onclick only a onclientclick which doesn't work like the onclick. So where does the onclick come from?

Thanks
3/12/2010 2:10:24 PM
topic: Using JavaScript and images for rollovers

fxs
Posts 5
Gotcha!
3/9/2010 11:59:11 AM
topic: Using JavaScript and images for rollovers

Ken Cox
Posts 170
The idea is to have a slightly different version of the image so that there's a visible indication that the mouse has passed over and back out.

It's fairly common to have an image button that glows (or otherwise changes appearance) on a mouse action. It's a simple little demo, similar to the one you see here:

http://www.designplace.org/static/rollover_button_example.html

It's not meant to be deep or anything so I'd say you're not missing anything. <grin>

Ken
3/8/2010 2:48:54 PM
topic: Using JavaScript and images for rollovers

fxs
Posts 5
Hi Ken,

The exercise you propose on rollovers using your picture has got me confused, namely the pictures are a different shade to begin with. If I use any other two pics of the same shade the trick does not work. So what is the point if I have to photoshop a copy of the picture I wan to to create a rollover effect for? What am I missing here?

Thanks,

Fed
3/5/2010 4:38:56 PM
topic: nwind.mdb Chapter 9 Connecting to an Access DB

fxs
Posts 5
Ha! You were spot on! I downloaded the db from you and it worked. I guess the one on the MS site must be corrupt.

Thanks!
3/5/2010 3:49:32 PM
topic: nwind.mdb Chapter 9 Connecting to an Access DB

Ken Cox
Posts 170
Hi!

Sorry you're having difficulty.

I'm not sure what the problem could be, but could you try downloading and installing the source code for the Chapter 9 to see if that database works on your machine?

Make sure your project has a web.config file in it, 'cause that's where the connection info is stored. If you send me the web.config, I might be able to see what's causing the failure.

Thanks,

Ken
3/5/2010 3:25:01 PM
topic: nwind.mdb Chapter 9 Connecting to an Access DB

fxs
Posts 5
Hi Ken,

Great book! Congrats! Now for the problem...

When I click next after configuring the data source in the AccessDataSource control I get the following error;

"Database schema could not be retrieved for this connection. Please make sure the connection settings are correct and that the database is online. Cannot open database"

Likewise if I double click the db in Solution Explorer I get "Cannot Open Database."

I am running XP SP3, Access 2007, and VS 2008 Team Edition.

Can you help?

PS

I also tried converting the db to access 2007 but that did not work either, same error.

Thanks
1/28/2010 5:17:29 PM
topic: pg 81 Advanced SQL Generation Option greyed out

martinz
Posts 2
Problem solved, shame on me .

I've skipped the not so unimportant point 6 on pg 81:
"CHoose the Customers table"

So I've left the selection at the 1st table on top, and it seems that it was empty.

Now the Advanced box isn't greyed out anymore, and everything works smoothly.

Sorry for the disturbance.
1/28/2010 2:06:51 PM
topic: pg 81 Advanced SQL Generation Option greyed out

martinz
Posts 2
Dear Ken,
at first thanks for your great book, it really eases my way into the last release of the .Net World.

My problem:
-) I downloaded the Sample Databases from MS, no problem there.
-) I attach the DB-File northwind.mdf
-) I draw a SQL Data Source into the form
-) But when I click on the advanced button, both options are greyed out.


Do I have to enable wrte access to the database somehow?

The test query works fine, but I can just select, not do any changes to the table.

TIA, Martin
1/22/2010 4:08:21 PM
topic: Chapter 5: CheckBox and CheckBoxList Controls

Ken Cox
Posts 170
Hi Christian,

I wasn't aware of the Portuguese version until a reader contacted me. It looks like the publisher did a bad job on transcribing the code snippets. You've found some of the typos and there are obviously more.

If you go to this page and enter 68 (as the page number) and click GO, you'll see the correct source code:

http://kencox.ca/sourcecode.aspx

You can also download the complete code for the chapter here:

http://www.kencox.ca/samplecode/195925_CH05_Code.zip

I'm sorry about the mistakes. If I had been given a chance, I'd have checked the manuscript.

Ken
pages: 1 2

Home » Recent messages