Thursday, March 29, 2012

newbie - keeping my object data as page refreshes

Hi all

I have some experience in 'Windows' programming but I am new to Web
programming, I wonder if anyone can help.

I have a middle layer object that brings some data from a database class .
The class reprsents a Callout, has lots of methods and properties and
manages the business logic..

I then have a html page (GUI layer) that creates an instance of a callout,
and from the callout object, it displays some textfields, labour etc plus
some datagrids based on some collections it holds.

Everything works fine until the page refreshes, at which time the object
seems to be destroyed and then recreated.

I want to keep the object alive with its existing data, on the server, and
connect back to it , ie. not create a new object each time. I know I could
use my Callouts WriteDate event to persist the data back to the SQLServer,
and then just re load it, but this isn't what I really want. I would like to
keep the object live until all work has been completed.

I have read a few things about sessions states etc, but don't really know
where to start, and how to make the class persist.

initially I had

public partial class CallOutDetail : System.Web.UI.Page
{
ExistingCallout Currentcallout;
int m_CalloutPK = 0;

protected void Page_Load(object sender, EventArgs e)
{
m_CalloutPK = 1212;
Currentcallout = new ExistingCallout(m_CalloutPK);

I have tried putting the Currentcallout in not postback i.e.

public partial class CallOutDetail : System.Web.UI.Page
{
ExistingCallout Currentcallout;
int m_CalloutPK = 0;

protected void Page_Load(object sender, EventArgs e)
{
m_CalloutPK = 1212;
if (!IsPostBack)
{
// first time
Currentcallout = new ExistingCallout(m_CalloutPK);
SetLabour();
SetMaterials();
}

Any pointers would be welcome

thanks

Andycouple options...
both require that it be serialized

you can place it in the Page's viewstate...

private constant vs_callout="A";

protected CalloutType CurrentCallout{
get{return this.ViewState[vs_callout] as CalloutType;}
set{this.ViewState[vs_callout] = value;}
}

...or place it in the session
}

"AAJ" wrote:

Quote:

Originally Posted by

Hi all
>
I have some experience in 'Windows' programming but I am new to Web
programming, I wonder if anyone can help.
>
I have a middle layer object that brings some data from a database class .
The class reprsents a Callout, has lots of methods and properties and
manages the business logic..
>
I then have a html page (GUI layer) that creates an instance of a callout,
and from the callout object, it displays some textfields, labour etc plus
some datagrids based on some collections it holds.
>
Everything works fine until the page refreshes, at which time the object
seems to be destroyed and then recreated.
>
I want to keep the object alive with its existing data, on the server, and
connect back to it , ie. not create a new object each time. I know I could
use my Callouts WriteDate event to persist the data back to the SQLServer,
and then just re load it, but this isn't what I really want. I would like to
keep the object live until all work has been completed.
>
I have read a few things about sessions states etc, but don't really know
where to start, and how to make the class persist.
>
initially I had
>
public partial class CallOutDetail : System.Web.UI.Page
{
ExistingCallout Currentcallout;
int m_CalloutPK = 0;
>
protected void Page_Load(object sender, EventArgs e)
{
m_CalloutPK = 1212;
Currentcallout = new ExistingCallout(m_CalloutPK);
>
>
I have tried putting the Currentcallout in not postback i.e.
>
public partial class CallOutDetail : System.Web.UI.Page
{
ExistingCallout Currentcallout;
int m_CalloutPK = 0;
>
protected void Page_Load(object sender, EventArgs e)
{
m_CalloutPK = 1212;
if (!IsPostBack)
{
// first time
Currentcallout = new ExistingCallout(m_CalloutPK);
SetLabour();
SetMaterials();
}
>
>
Any pointers would be welcome
>
thanks
>
Andy
>
>
>


thanks David

"David Jessee" <DavidJessee@.discussions.microsoft.comwrote in message
news:CF0F5237-8616-4C4B-9DA9-252BA0946C1D@.microsoft.com...

Quote:

Originally Posted by

couple options...
both require that it be serialized
>
you can place it in the Page's viewstate...
>
private constant vs_callout="A";
>
protected CalloutType CurrentCallout{
get{return this.ViewState[vs_callout] as CalloutType;}
set{this.ViewState[vs_callout] = value;}
}
>
...or place it in the session
}
>
>
>
"AAJ" wrote:
>

Quote:

Originally Posted by

>Hi all
>>
>I have some experience in 'Windows' programming but I am new to Web
>programming, I wonder if anyone can help.
>>
>I have a middle layer object that brings some data from a database class
>.
>The class reprsents a Callout, has lots of methods and properties and
>manages the business logic..
>>
>I then have a html page (GUI layer) that creates an instance of a
>callout,
>and from the callout object, it displays some textfields, labour etc plus
>some datagrids based on some collections it holds.
>>
>Everything works fine until the page refreshes, at which time the object
>seems to be destroyed and then recreated.
>>
>I want to keep the object alive with its existing data, on the server,
>and
>connect back to it , ie. not create a new object each time. I know I
>could
>use my Callouts WriteDate event to persist the data back to the
>SQLServer,
>and then just re load it, but this isn't what I really want. I would like
>to
>keep the object live until all work has been completed.
>>
>I have read a few things about sessions states etc, but don't really know
>where to start, and how to make the class persist.
>>
>initially I had
>>
>public partial class CallOutDetail : System.Web.UI.Page
>{
>ExistingCallout Currentcallout;
>int m_CalloutPK = 0;
>>
>protected void Page_Load(object sender, EventArgs e)
>{
>m_CalloutPK = 1212;
>Currentcallout = new ExistingCallout(m_CalloutPK);
>>
>>
>I have tried putting the Currentcallout in not postback i.e.
>>
>public partial class CallOutDetail : System.Web.UI.Page
>{
>ExistingCallout Currentcallout;
>int m_CalloutPK = 0;
>>
>protected void Page_Load(object sender, EventArgs e)
>{
>m_CalloutPK = 1212;
>if (!IsPostBack)
>{
>// first time
>Currentcallout = new ExistingCallout(m_CalloutPK);
>SetLabour();
>SetMaterials();
>}
>>
>>
>Any pointers would be welcome
>>
>thanks
>>
>Andy
>>
>>
>>

newbie - need early guidance

HI all

I am very new to coding and although I know how things work and what you can do with code and visual design I don't really have experience!

I would like some very basic advise on what coding front end to look into i.e. c++, VB, Web etc.

I am interested in learning to develop a basic system for my cafe that would enable a customer to go through a graphical experience in building their coffee order. I would ideally like to create something that would work well IN the cafe via a touchscreen or on the Internet from their desktop.

Now this is only basic stuff I'm not looking to build a go to market system but just something that applies to my daily life while giving me something new and challenging to look into.

Any guidance would be much appreciated!

Alfo,

I'm glad to hear that you would like to educate yourself in designing / programming / implementing a website.
In my opinion it is this very early stage that is the most important.
It is in this stage that you decide exactly what it is that your site will do and how it will do it.

My advice is to sit down with a pencil and paper and decide on some of the following options:
Will users be required to:
1) Login / Register - if yes
a) before they begin the process of placing an order
b) if they try to place an order
2) How will you accept payment? Cash, credit cards, e-checks, paypal...
3) What are all of the other high level functionalities that you'd like your site to offer?

Regarding what language to use, I much prefer C# (no particular reason, VB.Net is also a great and simple language to use).
It will have no impact on how your site looks to your customers. This is something that is purely up to you.
I do however recommend 2 books (possibly 3 or 4) that will help you greatly in reducing your learning curve and aid you in applying new concepts / ideas in real life situations:
1) Beginning ASP.Net e-commerce in c#. I have the 2005 edition. I'm not sure if there is a newer version or not.
2) Beginning asp.Net in C#.
3) Any beginners SQL book.
4) Any book for HTML / CSS.

If you have any questions or would like any advice let me know.
I used the first 2 books to help me build my first .Net website (https://www.theproductpad.com) and am very greatful for the help that these books gave me.

Good luck,
Michael


thanks

i remember the days when I wrote basic code for ZX Spectrum but now im a little lost!!

I will look into the books.

Aflo

Newbie - need advice on methodology

I am just getting started working on some small, in-house web projects for our work group. These are within the corporate fire-wall, about 10 users or so. Question: The video tutorials on this site show a pretty simple, straightforward way of hooking up a SQl database, master pages, etc. On the other hand, the on-line or PDF tutorials show a much more complex method with what looks to be a lot of hand coding. Leaving aside the standard "It depends on what your're tryingto do" answer for the moment, and given the situation outlined above, is there a reason to go with the all the hand coding as opposed to the drag and drop methods?

I appreciate your opinions and advice!

It depends on what you're trying to do... :)

Drag and drop should be fine, especially for one-off apps that may never be updated. As you gain in your skill set, you'll find where you need to modify your process.

Jeff


I would agree that drag and drop is best to get started as that is what i did. Then once the control is there you can modify it a little more each time. For instance in a gridview maybe format some fields or add hyperlinking.

One caveat is that I had issues with update/insertion working with drag and drop. Also keep in mind that a three tier approrach is best for scalablilty but for under 20 users you can just go straight to the sql. The point of 2.0 and on is ease of development.

Good Luck


It will be much faster to create application if you know how to hand code. However, in my experience, Drag/Drop was a quick and easy way to get started. In about 2-3 weeks, I found my self hand coding since I needed more control over what I was trying to do. Try dragging the controls on to your form, changing settings, then reviewing the code for what you did.

NEWBIE - Multicolumn Listbox populated from SQL statement

Greetings,

I am attempting to generate a multicolumn listbox from a SQL statement in
ASP.NET. Below is my SQL Statement:

SELECT [PA01101].[PACONTNUMBER], [PA01101].[PAcontname] FROM [PA01101]

I would like a two column list box with [PACONTNUMBER] on the left and
[PAcontname] on the right. I can do this in MS Access with no problem, but
I do not know to get my datareader info into a multicolumn listbox. I can
do one column of data just fine, but cannot add the second column.

Thank you for your help,

-DaveDeclare the listbox on the .aspx page:
<asp:ListBox runat="server" id="LB" /
Then in code-behind, add the items as you iterate through the repeater:
'Get Repeater 'Data'...
While ( Data.Read() )
LB.Items.Add(New ListItem(Data.Item("Field1") + "-" + Data.Item("Field2"), Data.Item("Field1")))
End While

Note: The above code will have [Field1-Field2] as the text field and [Field1] as the value field for each item in the SqlDataReader

"RockNRoll" wrote:

> Greetings,
> I am attempting to generate a multicolumn listbox from a SQL statement in
> ASP.NET. Below is my SQL Statement:
> SELECT [PA01101].[PACONTNUMBER], [PA01101].[PAcontname] FROM [PA01101]
> I would like a two column list box with [PACONTNUMBER] on the left and
> [PAcontname] on the right. I can do this in MS Access with no problem, but
> I do not know to get my datareader info into a multicolumn listbox. I can
> do one column of data just fine, but cannot add the second column.
> Thank you for your help,
> -Dave
>
concatenate two columns into one in your sql query

select column1 + column2 as multicolumn
from mytable

then have your datareader use "multicolumn" as your textfield. You'll probably have to do some spacing on top of this if you want the results in actual columns, but that should be easy enough.

Also there is a third party control that does multi-column listbox and some more stuff
http://easylistbox.com/demoQuickStart.aspx#easy

--Michael

"RockNRoll" <daveweber@.yahoo.com> wrote in message news:eJAoYOkeEHA.3916@.TK2MSFTNGP11.phx.gbl...
> Greetings,
>
> I am attempting to generate a multicolumn listbox from a SQL statement in
> ASP.NET. Below is my SQL Statement:
>
> SELECT [PA01101].[PACONTNUMBER], [PA01101].[PAcontname] FROM [PA01101]
>
> I would like a two column list box with [PACONTNUMBER] on the left and
> [PAcontname] on the right. I can do this in MS Access with no problem, but
> I do not know to get my datareader info into a multicolumn listbox. I can
> do one column of data just fine, but cannot add the second column.
>
> Thank you for your help,
>
> -Dave
>

NEWBIE - Multicolumn Listbox populated from SQL statement

Greetings,
I am attempting to generate a multicolumn listbox from a SQL statement in
ASP.NET. Below is my SQL Statement:
SELECT [PA01101].[PACONTNUMBER], [PA01101].[PAcontname] FROM [PA01101]
I would like a two column list box with [PACONTNUMBER] on the left and
[PAcontname] on the right. I can do this in MS Access with no problem, but
I do not know to get my datareader info into a multicolumn listbox. I can
do one column of data just fine, but cannot add the second column.
Thank you for your help,
-DaveDeclare the listbox on the .aspx page:
<asp:ListBox runat="server" id="LB" />
Then in code-behind, add the items as you iterate through the repeater:
'Get Repeater 'Data'...
While ( Data.Read() )
LB.Items.Add(New ListItem(Data.Item("Field1") + "-" + Data.Item("Field2"), D
ata.Item("Field1")))
End While
Note: The above code will have [Field1-Field2] as the text field and [Field1
] as the value field for each item in the SqlDataReader
"RockNRoll" wrote:

> Greetings,
> I am attempting to generate a multicolumn listbox from a SQL statement in
> ASP.NET. Below is my SQL Statement:
> SELECT [PA01101].[PACONTNUMBER], [PA01101].[PAcontname] FROM [PA01101]
> I would like a two column list box with [PACONTNUMBER] on the left and
> [PAcontname] on the right. I can do this in MS Access with no problem, but
> I do not know to get my datareader info into a multicolumn listbox. I can
> do one column of data just fine, but cannot add the second column.
> Thank you for your help,
> -Dave
>
>
concatenate two columns into one in your sql query
select column1 + column2 as multicolumn
from mytable
then have your datareader use "multicolumn" as your textfield. You'll =
probably have to do some spacing on top of this if you want the results =
in actual columns, but that should be easy enough.
Also there is a third party control that does multi-column listbox and =
some more stuff
http://easylistbox.com/demoQuickStart.aspx#easy
--Michael
"RockNRoll" <daveweber@.yahoo.com> wrote in message =
news:eJAoYOkeEHA.3916@.TK2MSFTNGP11.phx.gbl...
> Greetings,
>=20
> I am attempting to generate a multicolumn listbox from a SQL statement =
in
> ASP.NET. Below is my SQL Statement:
>=20
> SELECT [PA01101].[PACONTNUMBER], [PA01101].[PAcontname] FROM [PA01101]
>=20
> I would like a two column list box with [PACONTNUMBER] on the left and
> [PAcontname] on the right. I can do this in MS Access with no =
problem, but
> I do not know to get my datareader info into a multicolumn listbox. I =
can
> do one column of data just fine, but cannot add the second column.
>=20
> Thank you for your help,
>=20
> -Dave
>=20
>

newbie - page load not firing

Using asp.net 2.0. I have a page confirm.aspx:
**********************************
<%@dotnet.itags.org. Page Language="VB" AutoEventWireup="false"
CodeFile="confirm.aspx.vb" Inherits="confirm" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
****************************************
*****************
This is my page behind page (confirm.aspx.vb):
Partial Class confirm
Inherits System.Web.UI.Page
Sub Page_Load(ByVal s As Object, ByVal e As EventArgs)
Response.Write("hello")
End Sub
End Class
****************************************
*******
When I confirm.aspx loads in the browser nothing happens. i.e. a blank
page is returned. Shouldn't "hello" be displayed? What am I doing
wrong?Change AutoEventWireup="false" to AutoEventWireup="true" and it should work.
If you're a newbie to .Net from classic asp, note that response.write will
output before all the other content. - i.e. before "<!DOCTYPE.....". But
you'll see that when you run it :)
Jevon
"Steve" <bahram@.iranmania.com> wrote in message
news:1130840485.862653.166360@.g43g2000cwa.googlegroups.com...
> Using asp.net 2.0. I have a page confirm.aspx:
> **********************************
> <%@. Page Language="VB" AutoEventWireup="false"
> CodeFile="confirm.aspx.vb" Inherits="confirm" %>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" >
> <head runat="server">
> <title>Untitled Page</title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
> </div>
> </form>
> </body>
> </html>
> ****************************************
*****************
> This is my page behind page (confirm.aspx.vb):
>
> Partial Class confirm
> Inherits System.Web.UI.Page
> Sub Page_Load(ByVal s As Object, ByVal e As EventArgs)
> Response.Write("hello")
> End Sub
> End Class
> ****************************************
*******
> When I confirm.aspx loads in the browser nothing happens. i.e. a blank
> page is returned. Shouldn't "hello" be displayed? What am I doing
> wrong?
>
Set AutoEventWireup to True and try.
"Steve" wrote:

> Using asp.net 2.0. I have a page confirm.aspx:
> **********************************
> <%@. Page Language="VB" AutoEventWireup="false"
> CodeFile="confirm.aspx.vb" Inherits="confirm" %>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" >
> <head runat="server">
> <title>Untitled Page</title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
> </div>
> </form>
> </body>
> </html>
> ****************************************
*****************
> This is my page behind page (confirm.aspx.vb):
>
> Partial Class confirm
> Inherits System.Web.UI.Page
> Sub Page_Load(ByVal s As Object, ByVal e As EventArgs)
> Response.Write("hello")
> End Sub
> End Class
> ****************************************
*******
> When I confirm.aspx loads in the browser nothing happens. i.e. a blank
> page is returned. Shouldn't "hello" be displayed? What am I doing
> wrong?
>
Thank you so much for that. I spent more than 2 needless hours this
morning getting frustrated over this. Thank you so much.
So does that mean the Page_Load event can never be captured if the
AutoEventWireup is set to false, or is there a way for the
AutoEventWireup to be set to false and for the Page_Load event to still
be captured?
Yes, manually hook up the handler method with the event:
Sub Page_Load (..., ...) Handles MyBase.Load
...
End Sub
(OR)
' Have the following line in any method/event handler that runs before page
load event.
AddHandler Me.Load, AddressOf Page_Load
"Steve" wrote:

> Thank you so much for that. I spent more than 2 needless hours this
> morning getting frustrated over this. Thank you so much.
> So does that mean the Page_Load event can never be captured if the
> AutoEventWireup is set to false, or is there a way for the
> AutoEventWireup to be set to false and for the Page_Load event to still
> be captured?
>

Newbie - Need to prevent duplicate entries..

Dear All,
Need your help on this issue that I have with asp.net application. I
would really appreciate your help.
I am using Formview to save data into the database, Fields are
(date_from, date_to, time_from, Time_To - All are datetime format and a
roomNumber taken from a value in dropdownlist)
My requirement is simple; I want to prevent other user making
reservation on the specific room with the same dates and times and
within those range.
How will I use sqldatasource insert or any other ways of inserting to
prevent duplicate..
I am sorry for the confusion, i am new to asp.net
Here is the code i am using: --
<%@dotnet.itags.org. Page Language="VB" AutoEventWireup="false"
CodeFile="insert2.aspx.vb" Inherits="adminaccess_insert2" %>
<%@dotnet.itags.org. Register Assembly="eWorld.UI, Version=2.0.3.2310, Culture=neutral,
PublicKeyToken=24d65337282035f2"
Namespace="eWorld.UI" TagPrefix="ew" %>
<%@dotnet.itags.org. Import Namespace="System.Net.Mail" %>
<!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">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:RoomReservationConnect
ionString3 %>"
InsertCommand="INSERT INTO [ReservationInfo]
([Date_From], [Date_To], [Time_From], [Time_To], [RoomNo])
VALUES
(@dotnet.itags.org.Date_From, @dotnet.itags.org.Date_To, @dotnet.itags.org.Time_From, @dotnet.itags.org.Time_To, @dotnet.itags.org.RoomNo)" >
<InsertParameters>
<asp:Parameter Name="Date_From" Type="DateTime" />
<asp:Parameter Name="Date_To" Type="DateTime" />
<asp:Parameter Name="Time_From" Type="DateTime" />
<asp:Parameter Name="Time_To" Type="DateTime" />
<asp:Parameter Name="RoomNo" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<asp:FormView ID="FormView1" runat="server" DataKeyNames="Id"
DataSourceID="SqlDataSource1" DefaultMode="Insert">
<InsertItemTemplate>
Date_From:
<br />
<ew:CalendarPopup ID="Date_From" runat="server"
PostedDate=""
SelectedDate='<%# Bind("Date_From") %>'
ImageUrl="~/images/calendar4.jpg"
ControlDisplay="TextBoxImage"
UpperBoundDate="12/31/9999 23:59:59"
Culture="(Default)" Text="Select Date
From">
<ButtonStyle Font-Names="verdana"
Font-Size="8pt"
BackColor="#DEE37F" />
</ew:CalendarPopup>
<br />
<br />
Date_To:
<br />
<ew:CalendarPopup ID="Date_To" runat="server"
PostedDate="" SelectedDate='<%# Bind("Date_To") %>'
ImageUrl="~/images/calendar4.jpg"
ControlDisplay="TextBoxImage" UpperBoundDate="12/31/9999 23:59:59"
Culture="(Default)" Text="Select Date To">
<ButtonStyle Font-Names="verdana"
Font-Size="8pt" BackColor="#DEE37F" />
</ew:CalendarPopup>
<br />
<br />
Time From:
<br />
<ew:TimePicker ID="Time_From" runat="server"
ImageUrl="~/images/calendar3.jpg" NumberOfColumns="3"
LowerBoundTime="12/30/1899 07:00:00"
UpperBoundTime="12/30/1899 23:00:00"
ControlDisplay="TextBoxImage"
PopupLocation="Bottom" PopupWidth="170px"
PopupHeight="178px" EnableViewState="true"
SelectedValue='<%# Bind("Time_From", "{t}")
%>'
PostedTime="7:00 PM"
SelectedTime="12/30/1899 19:00:00"
Text="Select Time Start">
<SelectedTimeStyle BackColor="Khaki"
ForeColor="Black" />
<TimeStyle BackColor="SteelBlue"
ForeColor="White" />
<ButtonStyle BackColor="#DEE37F"
Font-Names="verdana" Font-Size="8pt" />
</ew:TimePicker>
<br />
<br />
Time To:
<br />
<ew:TimePicker ID="Time_To" runat="server"
ImageUrl="~/images/calendar3.jpg"
ControlDisplay="TextBoxImage"
NumberOfColumns="3" LowerBoundTime="11/25/3506 07:00:00"
UpperBoundTime="11/25/3506 23:00:00"
PopupLocation="Bottom" PopupWidth="170px"
PopupHeight="178px" SelectedValue='<%#
Bind("Time_To", "{0:t}") %>' PostedTime="7:00 PM"
SelectedTime="11/25/3506 19:00:28"
Text="Select Time Ends">
<SelectedTimeStyle BackColor="Khaki"
ForeColor="Black" />
<TimeStyle BackColor="SteelBlue"
ForeColor="White" />
<ButtonStyle BackColor="#DEE37F"
Font-Names="verdana" Font-Size="8pt" />
</ew:TimePicker>
<br />
<br />
RoomNo:
<asp:DropDownList ID="RoomNo" runat="server"
DataSourceID="SqlDataSource3" DataTextField="RoomNo"
AppendDataBoundItems="true"
DataValueField="RoomNo" SelectedValue='<%# Bind("RoomNo") %>'>
<asp:ListItem Selected="True">Pls. Select
Your Room No.</asp:ListItem>
</asp:DropDownList><br />
<br />
<%-- Start of DataSource --%>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$
ConnectionStrings:RoomReservationConnect
ionString %>"
SelectCommand="SELECT * FROM
[RoomInfo]"></asp:SqlDataSource>
<asp:LinkButton ID="InsertButton" runat="server"
CausesValidation="True" CommandName="Insert"
Text="Insert">
</asp:LinkButton>
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel">
</asp:LinkButton>
</InsertItemTemplate>
</asp:FormView>
<br />
<asp:Label ID="Label1" runat="server" Text="Label"
Height="18px" Visible="False"></asp:Label>
</form>
</body>
</html>This is really something you want to do in two places. Firstly, design
your UI such that it only offers the option of reserving a room which
is not yet taken. Have you considered using a calendar control of some
kind?
That would probably be more intuitive for use, and has the advantage
that you can only allow certain ranges to be selected.
Secondly, your database should be responsible for maintaining the
integrity of your data. The business rule "A room can be exclusively
reserved for a set of N days, and the time spans may not overlap" can
be handled as a constraint of some kind.
If you try to violate that constraint, your database will throw an
error, and you can handle the resulting exception in your code.
YMPN wrote:

> Dear All,
> Need your help on this issue that I have with asp.net application. I
> would really appreciate your help.
> I am using Formview to save data into the database, Fields are
> (date_from, date_to, time_from, Time_To - All are datetime format and a
> roomNumber taken from a value in dropdownlist)
> My requirement is simple; I want to prevent other user making
> reservation on the specific room with the same dates and times and
> within those range.
> How will I use sqldatasource insert or any other ways of inserting to
> prevent duplicate..
> I am sorry for the confusion, i am new to asp.net
>
> Here is the code i am using: --
> <%@. Page Language="VB" AutoEventWireup="false"
> CodeFile="insert2.aspx.vb" Inherits="adminaccess_insert2" %>
> <%@. Register Assembly="eWorld.UI, Version=2.0.3.2310, Culture=neutral,
> PublicKeyToken=24d65337282035f2"
> Namespace="eWorld.UI" TagPrefix="ew" %>
> <%@. Import Namespace="System.Net.Mail" %>
> <!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">
> <title>Untitled Page</title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div />
> <asp:SqlDataSource ID="SqlDataSource1" runat="server"
> ConnectionString="<%$
> ConnectionStrings:RoomReservationConnect
ionString3 %>"
> InsertCommand="INSERT INTO [ReservationInfo]
> ([Date_From], [Date_To], [Time_From], [Time_To], [RoomNo])
> VALUES
> (@.Date_From, @.Date_To, @.Time_From, @.Time_To, @.RoomNo)" >
>
> <InsertParameters>
> <asp:Parameter Name="Date_From" Type="DateTime" />
> <asp:Parameter Name="Date_To" Type="DateTime" />
> <asp:Parameter Name="Time_From" Type="DateTime" />
> <asp:Parameter Name="Time_To" Type="DateTime" />
> <asp:Parameter Name="RoomNo" Type="String" />
> </InsertParameters>
> </asp:SqlDataSource>
>
>
> <asp:FormView ID="FormView1" runat="server" DataKeyNames="Id"
> DataSourceID="SqlDataSource1" DefaultMode="Insert">
> <InsertItemTemplate>
> Date_From:
> <br />
>
> <ew:CalendarPopup ID="Date_From" runat="server"
> PostedDate=""
> SelectedDate='<%# Bind("Date_From") %>'
> ImageUrl="~/images/calendar4.jpg"
> ControlDisplay="TextBoxImage"
> UpperBoundDate="12/31/9999 23:59:59"
> Culture="(Default)" Text="Select Date
> From">
> <ButtonStyle Font-Names="verdana"
> Font-Size="8pt"
> BackColor="#DEE37F" />
> </ew:CalendarPopup>
> <br />
> <br />
> Date_To:
> <br />
>
> <ew:CalendarPopup ID="Date_To" runat="server"
> PostedDate="" SelectedDate='<%# Bind("Date_To") %>'
> ImageUrl="~/images/calendar4.jpg"
> ControlDisplay="TextBoxImage" UpperBoundDate="12/31/9999 23:59:59"
> Culture="(Default)" Text="Select Date To">
> <ButtonStyle Font-Names="verdana"
> Font-Size="8pt" BackColor="#DEE37F" />
> </ew:CalendarPopup>
> <br />
> <br />
> Time From:
> <br />
> <ew:TimePicker ID="Time_From" runat="server"
> ImageUrl="~/images/calendar3.jpg" NumberOfColumns="3"
> LowerBoundTime="12/30/1899 07:00:00"
> UpperBoundTime="12/30/1899 23:00:00"
> ControlDisplay="TextBoxImage"
> PopupLocation="Bottom" PopupWidth="170px"
> PopupHeight="178px" EnableViewState="true"
> SelectedValue='<%# Bind("Time_From", "{t}")
> %>'
> PostedTime="7:00 PM"
> SelectedTime="12/30/1899 19:00:00"
> Text="Select Time Start">
> <SelectedTimeStyle BackColor="Khaki"
> ForeColor="Black" />
> <TimeStyle BackColor="SteelBlue"
> ForeColor="White" />
> <ButtonStyle BackColor="#DEE37F"
> Font-Names="verdana" Font-Size="8pt" />
> </ew:TimePicker>
> <br />
> <br />
> Time To:
> <br />
>
> <ew:TimePicker ID="Time_To" runat="server"
> ImageUrl="~/images/calendar3.jpg"
> ControlDisplay="TextBoxImage"
> NumberOfColumns="3" LowerBoundTime="11/25/3506 07:00:00"
> UpperBoundTime="11/25/3506 23:00:00"
> PopupLocation="Bottom" PopupWidth="170px"
> PopupHeight="178px" SelectedValue='<%#
> Bind("Time_To", "{0:t}") %>' PostedTime="7:00 PM"
> SelectedTime="11/25/3506 19:00:28"
> Text="Select Time Ends">
> <SelectedTimeStyle BackColor="Khaki"
> ForeColor="Black" />
> <TimeStyle BackColor="SteelBlue"
> ForeColor="White" />
> <ButtonStyle BackColor="#DEE37F"
> Font-Names="verdana" Font-Size="8pt" />
> </ew:TimePicker>
> <br />
> <br />
> RoomNo:
> <asp:DropDownList ID="RoomNo" runat="server"
> DataSourceID="SqlDataSource3" DataTextField="RoomNo"
> AppendDataBoundItems="true"
> DataValueField="RoomNo" SelectedValue='<%# Bind("RoomNo") %>'>
> <asp:ListItem Selected="True">Pls. Select
> Your Room No.</asp:ListItem>
> </asp:DropDownList><br />
> <br />
> <%-- Start of DataSource --%>
>
> <asp:SqlDataSource ID="SqlDataSource3" runat="server"
> ConnectionString="<%$
> ConnectionStrings:RoomReservationConnect
ionString %>"
> SelectCommand="SELECT * FROM
> [RoomInfo]"></asp:SqlDataSource>
> <asp:LinkButton ID="InsertButton" runat="server"
> CausesValidation="True" CommandName="Insert"
> Text="Insert">
> </asp:LinkButton>
> <asp:LinkButton ID="InsertCancelButton" runat="server"
> CausesValidation="False" CommandName="Cancel"
> Text="Cancel">
> </asp:LinkButton>
>
> </InsertItemTemplate>
> </asp:FormView>
> <br />
> <asp:Label ID="Label1" runat="server" Text="Label"
> Height="18px" Visible="False"></asp:Label>
> </form>
> </body>
> </html>
You're already using a calendar control. Apologies for imbecility. It's
only 5:30 pm and I'm generally not at my best until at least 9:00 :)
Flinky Wisty Pomm wrote:
> This is really something you want to do in two places. Firstly, design
> your UI such that it only offers the option of reserving a room which
> is not yet taken. Have you considered using a calendar control of some
> kind?
> That would probably be more intuitive for use, and has the advantage
> that you can only allow certain ranges to be selected.
> Secondly, your database should be responsible for maintaining the
> integrity of your data. The business rule "A room can be exclusively
> reserved for a set of N days, and the time spans may not overlap" can
> be handled as a constraint of some kind.
> If you try to violate that constraint, your database will throw an
> error, and you can handle the resulting exception in your code.
>
> YMPN wrote:
>
I really appreciate your response FWP. I need all the help that I can..
What you said...
"The business rule "A room can be exclusively
reserved for a set of N days, and the time spans may not overlap" can
be handled as a constraint of some kind.
If you try to violate that constraint, your database will throw an
error, and you can handle the resulting exception in your code.
-- end of qoute --
Can anybody please "translate" this into a working code that I may use
or assist me.
Thanks people...
Flinky Wisty Pomm wrote:
> You're already using a calendar control. Apologies for imbecility. It's
> only 5:30 pm and I'm generally not at my best until at least 9:00 :)
>
> Flinky Wisty Pomm wrote:
>

Newbie - Need to prevent duplicate entries..

Dear All,

Need your help on this issue that I have with asp.net application. I
would really appreciate your help.

I am using Formview to save data into the database, Fields are
(date_from, date_to, time_from, Time_To - All are datetime format and a
roomNumber taken from a value in dropdownlist)

My requirement is simple; I want to prevent other user making
reservation on the specific room with the same dates and times and
within those range.

How will I use sqldatasource insert or any other ways of inserting to
prevent duplicate..

I am sorry for the confusion, i am new to asp.net

Here is the code i am using: ---

<%@dotnet.itags.org. Page Language="VB" AutoEventWireup="false"
CodeFile="insert2.aspx.vb" Inherits="adminaccess_insert2" %>

<%@dotnet.itags.org. Register Assembly="eWorld.UI, Version=2.0.3.2310, Culture=neutral,
PublicKeyToken=24d65337282035f2"
Namespace="eWorld.UI" TagPrefix="ew" %>
<%@dotnet.itags.org. Import Namespace="System.Net.Mail" %>
<!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">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:RoomReservationConnectionString3 %>"
InsertCommand="INSERT INTO [ReservationInfo]
([Date_From], [Date_To], [Time_From], [Time_To], [RoomNo])
VALUES
(@dotnet.itags.org.Date_From, @dotnet.itags.org.Date_To, @dotnet.itags.org.Time_From, @dotnet.itags.org.Time_To, @dotnet.itags.org.RoomNo)" >

<InsertParameters>
<asp:Parameter Name="Date_From" Type="DateTime" />
<asp:Parameter Name="Date_To" Type="DateTime" />
<asp:Parameter Name="Time_From" Type="DateTime" />
<asp:Parameter Name="Time_To" Type="DateTime" />
<asp:Parameter Name="RoomNo" Type="String" />
</InsertParameters>
</asp:SqlDataSource>

<asp:FormView ID="FormView1" runat="server" DataKeyNames="Id"
DataSourceID="SqlDataSource1" DefaultMode="Insert">

<InsertItemTemplate>
Date_From:
<br />

<ew:CalendarPopup ID="Date_From" runat="server"

PostedDate=""
SelectedDate='<%# Bind("Date_From") %>'
ImageUrl="~/images/calendar4.jpg"
ControlDisplay="TextBoxImage"
UpperBoundDate="12/31/9999 23:59:59"
Culture="(Default)" Text="Select Date
From">
<ButtonStyle Font-Names="verdana"
Font-Size="8pt"
BackColor="#DEE37F" />
</ew:CalendarPopup>
<br />
<br />
Date_To:
<br />

<ew:CalendarPopup ID="Date_To" runat="server"
PostedDate="" SelectedDate='<%# Bind("Date_To") %>'
ImageUrl="~/images/calendar4.jpg"
ControlDisplay="TextBoxImage" UpperBoundDate="12/31/9999 23:59:59"
Culture="(Default)" Text="Select Date To">
<ButtonStyle Font-Names="verdana"
Font-Size="8pt" BackColor="#DEE37F" />
</ew:CalendarPopup>
<br />
<br />
Time From:
<br />

<ew:TimePicker ID="Time_From" runat="server"
ImageUrl="~/images/calendar3.jpg" NumberOfColumns="3"
LowerBoundTime="12/30/1899 07:00:00"
UpperBoundTime="12/30/1899 23:00:00"
ControlDisplay="TextBoxImage"
PopupLocation="Bottom" PopupWidth="170px"
PopupHeight="178px" EnableViewState="true"

SelectedValue='<%# Bind("Time_From", "{t}")
%>'
PostedTime="7:00 PM"
SelectedTime="12/30/1899 19:00:00"

Text="Select Time Start">
<SelectedTimeStyle BackColor="Khaki"
ForeColor="Black" />
<TimeStyle BackColor="SteelBlue"
ForeColor="White" />
<ButtonStyle BackColor="#DEE37F"
Font-Names="verdana" Font-Size="8pt" />
</ew:TimePicker>
<br />
<br />
Time To:
<br />

<ew:TimePicker ID="Time_To" runat="server"
ImageUrl="~/images/calendar3.jpg"
ControlDisplay="TextBoxImage"
NumberOfColumns="3" LowerBoundTime="11/25/3506 07:00:00"
UpperBoundTime="11/25/3506 23:00:00"
PopupLocation="Bottom" PopupWidth="170px"
PopupHeight="178px" SelectedValue='<%#
Bind("Time_To", "{0:t}") %>' PostedTime="7:00 PM"
SelectedTime="11/25/3506 19:00:28"
Text="Select Time Ends">
<SelectedTimeStyle BackColor="Khaki"
ForeColor="Black" />
<TimeStyle BackColor="SteelBlue"
ForeColor="White" />
<ButtonStyle BackColor="#DEE37F"
Font-Names="verdana" Font-Size="8pt" />
</ew:TimePicker>
<br />
<br />
RoomNo:
<asp:DropDownList ID="RoomNo" runat="server"
DataSourceID="SqlDataSource3" DataTextField="RoomNo"
AppendDataBoundItems="true"
DataValueField="RoomNo" SelectedValue='<%# Bind("RoomNo") %>'>
<asp:ListItem Selected="True">Pls. Select
Your Room No.</asp:ListItem>
</asp:DropDownList><br />
<br />

<%-- Start of DataSource --%>

<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$
ConnectionStrings:RoomReservationConnectionString %>"

SelectCommand="SELECT * FROM
[RoomInfo]"></asp:SqlDataSource>

<asp:LinkButton ID="InsertButton" runat="server"
CausesValidation="True" CommandName="Insert"
Text="Insert">
</asp:LinkButton>
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel">
</asp:LinkButton>

</InsertItemTemplate>
</asp:FormView>
<br />
<asp:Label ID="Label1" runat="server" Text="Label"
Height="18px" Visible="False"></asp:Label>

</form>
</body>
</html>This is really something you want to do in two places. Firstly, design
your UI such that it only offers the option of reserving a room which
is not yet taken. Have you considered using a calendar control of some
kind?

That would probably be more intuitive for use, and has the advantage
that you can only allow certain ranges to be selected.

Secondly, your database should be responsible for maintaining the
integrity of your data. The business rule "A room can be exclusively
reserved for a set of N days, and the time spans may not overlap" can
be handled as a constraint of some kind.

If you try to violate that constraint, your database will throw an
error, and you can handle the resulting exception in your code.

YMPN wrote:

Quote:

Originally Posted by

Dear All,
>
Need your help on this issue that I have with asp.net application. I
would really appreciate your help.
>
I am using Formview to save data into the database, Fields are
(date_from, date_to, time_from, Time_To - All are datetime format and a
roomNumber taken from a value in dropdownlist)
>
My requirement is simple; I want to prevent other user making
reservation on the specific room with the same dates and times and
within those range.
>
How will I use sqldatasource insert or any other ways of inserting to
prevent duplicate..
>
I am sorry for the confusion, i am new to asp.net
>
>
Here is the code i am using: ---
>
<%@. Page Language="VB" AutoEventWireup="false"
CodeFile="insert2.aspx.vb" Inherits="adminaccess_insert2" %>
>
<%@. Register Assembly="eWorld.UI, Version=2.0.3.2310, Culture=neutral,
PublicKeyToken=24d65337282035f2"
Namespace="eWorld.UI" TagPrefix="ew" %>
<%@. Import Namespace="System.Net.Mail" %>
<!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">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:RoomReservationConnectionString3 %>"
InsertCommand="INSERT INTO [ReservationInfo]
([Date_From], [Date_To], [Time_From], [Time_To], [RoomNo])
VALUES
(@.Date_From, @.Date_To, @.Time_From, @.Time_To, @.RoomNo)" >
>
>
>
<InsertParameters>
<asp:Parameter Name="Date_From" Type="DateTime" />
<asp:Parameter Name="Date_To" Type="DateTime" />
<asp:Parameter Name="Time_From" Type="DateTime" />
<asp:Parameter Name="Time_To" Type="DateTime" />
<asp:Parameter Name="RoomNo" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
>
>
>
>
<asp:FormView ID="FormView1" runat="server" DataKeyNames="Id"
DataSourceID="SqlDataSource1" DefaultMode="Insert">
>
<InsertItemTemplate>
Date_From:
<br />
>
>
<ew:CalendarPopup ID="Date_From" runat="server"
>
PostedDate=""
SelectedDate='<%# Bind("Date_From") %>'
ImageUrl="~/images/calendar4.jpg"
ControlDisplay="TextBoxImage"
UpperBoundDate="12/31/9999 23:59:59"
Culture="(Default)" Text="Select Date
From">
<ButtonStyle Font-Names="verdana"
Font-Size="8pt"
BackColor="#DEE37F" />
</ew:CalendarPopup>
<br />
<br />
Date_To:
<br />
>
>
<ew:CalendarPopup ID="Date_To" runat="server"
PostedDate="" SelectedDate='<%# Bind("Date_To") %>'
ImageUrl="~/images/calendar4.jpg"
ControlDisplay="TextBoxImage" UpperBoundDate="12/31/9999 23:59:59"
Culture="(Default)" Text="Select Date To">
<ButtonStyle Font-Names="verdana"
Font-Size="8pt" BackColor="#DEE37F" />
</ew:CalendarPopup>
<br />
<br />
Time From:
<br />
>
<ew:TimePicker ID="Time_From" runat="server"
ImageUrl="~/images/calendar3.jpg" NumberOfColumns="3"
LowerBoundTime="12/30/1899 07:00:00"
UpperBoundTime="12/30/1899 23:00:00"
ControlDisplay="TextBoxImage"
PopupLocation="Bottom" PopupWidth="170px"
PopupHeight="178px" EnableViewState="true"
>
SelectedValue='<%# Bind("Time_From", "{t}")
%>'
PostedTime="7:00 PM"
SelectedTime="12/30/1899 19:00:00"
>
Text="Select Time Start">
<SelectedTimeStyle BackColor="Khaki"
ForeColor="Black" />
<TimeStyle BackColor="SteelBlue"
ForeColor="White" />
<ButtonStyle BackColor="#DEE37F"
Font-Names="verdana" Font-Size="8pt" />
</ew:TimePicker>
<br />
<br />
Time To:
<br />
>
>
<ew:TimePicker ID="Time_To" runat="server"
ImageUrl="~/images/calendar3.jpg"
ControlDisplay="TextBoxImage"
NumberOfColumns="3" LowerBoundTime="11/25/3506 07:00:00"
UpperBoundTime="11/25/3506 23:00:00"
PopupLocation="Bottom" PopupWidth="170px"
PopupHeight="178px" SelectedValue='<%#
Bind("Time_To", "{0:t}") %>' PostedTime="7:00 PM"
SelectedTime="11/25/3506 19:00:28"
Text="Select Time Ends">
<SelectedTimeStyle BackColor="Khaki"
ForeColor="Black" />
<TimeStyle BackColor="SteelBlue"
ForeColor="White" />
<ButtonStyle BackColor="#DEE37F"
Font-Names="verdana" Font-Size="8pt" />
</ew:TimePicker>
<br />
<br />
RoomNo:
<asp:DropDownList ID="RoomNo" runat="server"
DataSourceID="SqlDataSource3" DataTextField="RoomNo"
AppendDataBoundItems="true"
DataValueField="RoomNo" SelectedValue='<%# Bind("RoomNo") %>'>
<asp:ListItem Selected="True">Pls. Select
Your Room No.</asp:ListItem>
</asp:DropDownList><br />
<br />
>
<%-- Start of DataSource --%>
>
>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$
ConnectionStrings:RoomReservationConnectionString %>"
>
SelectCommand="SELECT * FROM
[RoomInfo]"></asp:SqlDataSource>
>
<asp:LinkButton ID="InsertButton" runat="server"
CausesValidation="True" CommandName="Insert"
Text="Insert">
</asp:LinkButton>
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel">
</asp:LinkButton>
>
>
</InsertItemTemplate>
</asp:FormView>
<br />
<asp:Label ID="Label1" runat="server" Text="Label"
Height="18px" Visible="False"></asp:Label>
>
</form>
</body>
</html>


You're already using a calendar control. Apologies for imbecility. It's
only 5:30 pm and I'm generally not at my best until at least 9:00 :)

Flinky Wisty Pomm wrote:

Quote:

Originally Posted by

This is really something you want to do in two places. Firstly, design
your UI such that it only offers the option of reserving a room which
is not yet taken. Have you considered using a calendar control of some
kind?
>
That would probably be more intuitive for use, and has the advantage
that you can only allow certain ranges to be selected.
>
Secondly, your database should be responsible for maintaining the
integrity of your data. The business rule "A room can be exclusively
reserved for a set of N days, and the time spans may not overlap" can
be handled as a constraint of some kind.
>
If you try to violate that constraint, your database will throw an
error, and you can handle the resulting exception in your code.
>
>
YMPN wrote:
>

Quote:

Originally Posted by

Dear All,

Need your help on this issue that I have with asp.net application. I
would really appreciate your help.

I am using Formview to save data into the database, Fields are
(date_from, date_to, time_from, Time_To - All are datetime format and a
roomNumber taken from a value in dropdownlist)

My requirement is simple; I want to prevent other user making
reservation on the specific room with the same dates and times and
within those range.

How will I use sqldatasource insert or any other ways of inserting to
prevent duplicate..

I am sorry for the confusion, i am new to asp.net

Here is the code i am using: ---

<%@. Page Language="VB" AutoEventWireup="false"
CodeFile="insert2.aspx.vb" Inherits="adminaccess_insert2" %>

<%@. Register Assembly="eWorld.UI, Version=2.0.3.2310, Culture=neutral,
PublicKeyToken=24d65337282035f2"
Namespace="eWorld.UI" TagPrefix="ew" %>
<%@. Import Namespace="System.Net.Mail" %>
<!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">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:RoomReservationConnectionString3 %>"
InsertCommand="INSERT INTO [ReservationInfo]
([Date_From], [Date_To], [Time_From], [Time_To], [RoomNo])
VALUES
(@.Date_From, @.Date_To, @.Time_From, @.Time_To, @.RoomNo)" >

<InsertParameters>
<asp:Parameter Name="Date_From" Type="DateTime" />
<asp:Parameter Name="Date_To" Type="DateTime" />
<asp:Parameter Name="Time_From" Type="DateTime" />
<asp:Parameter Name="Time_To" Type="DateTime" />
<asp:Parameter Name="RoomNo" Type="String" />
</InsertParameters>
</asp:SqlDataSource>

<asp:FormView ID="FormView1" runat="server" DataKeyNames="Id"
DataSourceID="SqlDataSource1" DefaultMode="Insert">

<InsertItemTemplate>
Date_From:
<br />

<ew:CalendarPopup ID="Date_From" runat="server"

PostedDate=""
SelectedDate='<%# Bind("Date_From") %>'
ImageUrl="~/images/calendar4.jpg"
ControlDisplay="TextBoxImage"
UpperBoundDate="12/31/9999 23:59:59"
Culture="(Default)" Text="Select Date
From">
<ButtonStyle Font-Names="verdana"
Font-Size="8pt"
BackColor="#DEE37F" />
</ew:CalendarPopup>
<br />
<br />
Date_To:
<br />

<ew:CalendarPopup ID="Date_To" runat="server"
PostedDate="" SelectedDate='<%# Bind("Date_To") %>'
ImageUrl="~/images/calendar4.jpg"
ControlDisplay="TextBoxImage" UpperBoundDate="12/31/9999 23:59:59"
Culture="(Default)" Text="Select Date To">
<ButtonStyle Font-Names="verdana"
Font-Size="8pt" BackColor="#DEE37F" />
</ew:CalendarPopup>
<br />
<br />
Time From:
<br />

<ew:TimePicker ID="Time_From" runat="server"
ImageUrl="~/images/calendar3.jpg" NumberOfColumns="3"
LowerBoundTime="12/30/1899 07:00:00"
UpperBoundTime="12/30/1899 23:00:00"
ControlDisplay="TextBoxImage"
PopupLocation="Bottom" PopupWidth="170px"
PopupHeight="178px" EnableViewState="true"

SelectedValue='<%# Bind("Time_From", "{t}")
%>'
PostedTime="7:00 PM"
SelectedTime="12/30/1899 19:00:00"

Text="Select Time Start">
<SelectedTimeStyle BackColor="Khaki"
ForeColor="Black" />
<TimeStyle BackColor="SteelBlue"
ForeColor="White" />
<ButtonStyle BackColor="#DEE37F"
Font-Names="verdana" Font-Size="8pt" />
</ew:TimePicker>
<br />
<br />
Time To:
<br />

<ew:TimePicker ID="Time_To" runat="server"
ImageUrl="~/images/calendar3.jpg"
ControlDisplay="TextBoxImage"
NumberOfColumns="3" LowerBoundTime="11/25/3506 07:00:00"
UpperBoundTime="11/25/3506 23:00:00"
PopupLocation="Bottom" PopupWidth="170px"
PopupHeight="178px" SelectedValue='<%#
Bind("Time_To", "{0:t}") %>' PostedTime="7:00 PM"
SelectedTime="11/25/3506 19:00:28"
Text="Select Time Ends">
<SelectedTimeStyle BackColor="Khaki"
ForeColor="Black" />
<TimeStyle BackColor="SteelBlue"
ForeColor="White" />
<ButtonStyle BackColor="#DEE37F"
Font-Names="verdana" Font-Size="8pt" />
</ew:TimePicker>
<br />
<br />
RoomNo:
<asp:DropDownList ID="RoomNo" runat="server"
DataSourceID="SqlDataSource3" DataTextField="RoomNo"
AppendDataBoundItems="true"
DataValueField="RoomNo" SelectedValue='<%# Bind("RoomNo") %>'>
<asp:ListItem Selected="True">Pls. Select
Your Room No.</asp:ListItem>
</asp:DropDownList><br />
<br />

<%-- Start of DataSource --%>

<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$
ConnectionStrings:RoomReservationConnectionString %>"

SelectCommand="SELECT * FROM
[RoomInfo]"></asp:SqlDataSource>

<asp:LinkButton ID="InsertButton" runat="server"
CausesValidation="True" CommandName="Insert"
Text="Insert">
</asp:LinkButton>
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel">
</asp:LinkButton>

</InsertItemTemplate>
</asp:FormView>
<br />
<asp:Label ID="Label1" runat="server" Text="Label"
Height="18px" Visible="False"></asp:Label>

</form>
</body>
</html>


I really appreciate your response FWP. I need all the help that I can..

What you said...

"The business rule "A room can be exclusively
reserved for a set of N days, and the time spans may not overlap" can
be handled as a constraint of some kind.

If you try to violate that constraint, your database will throw an
error, and you can handle the resulting exception in your code.

-- end of qoute --

Can anybody please "translate" this into a working code that I may use
or assist me.

Thanks people...

Flinky Wisty Pomm wrote:

Quote:

Originally Posted by

You're already using a calendar control. Apologies for imbecility. It's
only 5:30 pm and I'm generally not at my best until at least 9:00 :)
>
>
Flinky Wisty Pomm wrote:
>

Quote:

Originally Posted by

This is really something you want to do in two places. Firstly, design
your UI such that it only offers the option of reserving a room which
is not yet taken. Have you considered using a calendar control of some
kind?

That would probably be more intuitive for use, and has the advantage
that you can only allow certain ranges to be selected.

Secondly, your database should be responsible for maintaining the
integrity of your data. The business rule "A room can be exclusively
reserved for a set of N days, and the time spans may not overlap" can
be handled as a constraint of some kind.

If you try to violate that constraint, your database will throw an
error, and you can handle the resulting exception in your code.

YMPN wrote:

Quote:

Originally Posted by

Dear All,
>
Need your help on this issue that I have with asp.net application. I
would really appreciate your help.
>
I am using Formview to save data into the database, Fields are
(date_from, date_to, time_from, Time_To - All are datetime format and a
roomNumber taken from a value in dropdownlist)
>
My requirement is simple; I want to prevent other user making
reservation on the specific room with the same dates and times and
within those range.
>
How will I use sqldatasource insert or any other ways of inserting to
prevent duplicate..
>
I am sorry for the confusion, i am new to asp.net
>
>
Here is the code i am using: ---
>
<%@. Page Language="VB" AutoEventWireup="false"
CodeFile="insert2.aspx.vb" Inherits="adminaccess_insert2" %>
>
<%@. Register Assembly="eWorld.UI, Version=2.0.3.2310, Culture=neutral,
PublicKeyToken=24d65337282035f2"
Namespace="eWorld.UI" TagPrefix="ew" %>
<%@. Import Namespace="System.Net.Mail" %>
<!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">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:RoomReservationConnectionString3 %>"
InsertCommand="INSERT INTO [ReservationInfo]
([Date_From], [Date_To], [Time_From], [Time_To], [RoomNo])
VALUES
(@.Date_From, @.Date_To, @.Time_From, @.Time_To, @.RoomNo)" >
>
>
>
<InsertParameters>
<asp:Parameter Name="Date_From" Type="DateTime" />
<asp:Parameter Name="Date_To" Type="DateTime" />
<asp:Parameter Name="Time_From" Type="DateTime" />
<asp:Parameter Name="Time_To" Type="DateTime" />
<asp:Parameter Name="RoomNo" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
>
>
>
>
<asp:FormView ID="FormView1" runat="server" DataKeyNames="Id"
DataSourceID="SqlDataSource1" DefaultMode="Insert">
>
<InsertItemTemplate>
Date_From:
<br />
>
>
<ew:CalendarPopup ID="Date_From" runat="server"
>
PostedDate=""
SelectedDate='<%# Bind("Date_From") %>'
ImageUrl="~/images/calendar4.jpg"
ControlDisplay="TextBoxImage"
UpperBoundDate="12/31/9999 23:59:59"
Culture="(Default)" Text="Select Date
From">
<ButtonStyle Font-Names="verdana"
Font-Size="8pt"
BackColor="#DEE37F" />
</ew:CalendarPopup>
<br />
<br />
Date_To:
<br />
>
>
<ew:CalendarPopup ID="Date_To" runat="server"
PostedDate="" SelectedDate='<%# Bind("Date_To") %>'
ImageUrl="~/images/calendar4.jpg"
ControlDisplay="TextBoxImage" UpperBoundDate="12/31/9999 23:59:59"
Culture="(Default)" Text="Select Date To">
<ButtonStyle Font-Names="verdana"
Font-Size="8pt" BackColor="#DEE37F" />
</ew:CalendarPopup>
<br />
<br />
Time From:
<br />
>
<ew:TimePicker ID="Time_From" runat="server"
ImageUrl="~/images/calendar3.jpg" NumberOfColumns="3"
LowerBoundTime="12/30/1899 07:00:00"
UpperBoundTime="12/30/1899 23:00:00"
ControlDisplay="TextBoxImage"
PopupLocation="Bottom" PopupWidth="170px"
PopupHeight="178px" EnableViewState="true"
>
SelectedValue='<%# Bind("Time_From", "{t}")
%>'
PostedTime="7:00 PM"
SelectedTime="12/30/1899 19:00:00"
>
Text="Select Time Start">
<SelectedTimeStyle BackColor="Khaki"
ForeColor="Black" />
<TimeStyle BackColor="SteelBlue"
ForeColor="White" />
<ButtonStyle BackColor="#DEE37F"
Font-Names="verdana" Font-Size="8pt" />
</ew:TimePicker>
<br />
<br />
Time To:
<br />
>
>
<ew:TimePicker ID="Time_To" runat="server"
ImageUrl="~/images/calendar3.jpg"
ControlDisplay="TextBoxImage"
NumberOfColumns="3" LowerBoundTime="11/25/3506 07:00:00"
UpperBoundTime="11/25/3506 23:00:00"
PopupLocation="Bottom" PopupWidth="170px"
PopupHeight="178px" SelectedValue='<%#
Bind("Time_To", "{0:t}") %>' PostedTime="7:00 PM"
SelectedTime="11/25/3506 19:00:28"
Text="Select Time Ends">
<SelectedTimeStyle BackColor="Khaki"
ForeColor="Black" />
<TimeStyle BackColor="SteelBlue"
ForeColor="White" />
<ButtonStyle BackColor="#DEE37F"
Font-Names="verdana" Font-Size="8pt" />
</ew:TimePicker>
<br />
<br />
RoomNo:
<asp:DropDownList ID="RoomNo" runat="server"
DataSourceID="SqlDataSource3" DataTextField="RoomNo"
AppendDataBoundItems="true"
DataValueField="RoomNo" SelectedValue='<%# Bind("RoomNo") %>'>
<asp:ListItem Selected="True">Pls. Select
Your Room No.</asp:ListItem>
</asp:DropDownList><br />
<br />
>
<%-- Start of DataSource --%>
>
>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$
ConnectionStrings:RoomReservationConnectionString %>"
>
SelectCommand="SELECT * FROM
[RoomInfo]"></asp:SqlDataSource>
>
<asp:LinkButton ID="InsertButton" runat="server"
CausesValidation="True" CommandName="Insert"
Text="Insert">
</asp:LinkButton>
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel">
</asp:LinkButton>
>
>
</InsertItemTemplate>
</asp:FormView>
<br />
<asp:Label ID="Label1" runat="server" Text="Label"
Height="18px" Visible="False"></asp:Label>
>
</form>
</body>
</html>

Newbie - Passing Value From MasterPage to Search Page

Hi all,
(Using asp.net 2.0 VB)
I', newbie to this, my prolem is, i have my MasterPage with a search
field(and common to all pages), how can i pass this value to my search page
and then to the select statement of my sqldatasource.??

Thank's in advance,

Joao BatistaThis should answer your question about how to pass data between a page and a
master page:
http://SteveOrr.net/faq/PassDataToMaster.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Joao Batista" <teste@.iol,pt> wrote in message
news:O4VSDXfRGHA.4300@.TK2MSFTNGP14.phx.gbl...
> Hi all,
> (Using asp.net 2.0 VB)
> I', newbie to this, my prolem is, i have my MasterPage with a search
> field(and common to all pages), how can i pass this value to my search
> page and then to the select statement of my sqldatasource.??
> Thank's in advance,
> Joao Batista

Newbie - Passing Value From MasterPage to Search Page

Hi all,
(Using asp.net 2.0 VB)
I', newbie to this, my prolem is, i have my MasterPage with a search
field(and common to all pages), how can i pass this value to my search page
and then to the select statement of my sqldatasource.'
Thank's in advance,
Joao BatistaThis should answer your question about how to pass data between a page and a
master page:
http://SteveOrr.net/faq/PassDataToMaster.aspx
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Joao Batista" <teste@.iol,pt> wrote in message
news:O4VSDXfRGHA.4300@.TK2MSFTNGP14.phx.gbl...
> Hi all,
> (Using asp.net 2.0 VB)
> I', newbie to this, my prolem is, i have my MasterPage with a search
> field(and common to all pages), how can i pass this value to my search
> page and then to the select statement of my sqldatasource.'
> Thank's in advance,
> Joao Batista
>

Newbie -- Page_Load( ) fires twice if image is added to Login page

Hi,
I'm using Visual Studio 2005 + ASP.NET and C#
I have a login.aspx page with AutoEventWireup set to FALSE (also added to
top level Web.Config, and set to false)
With a "template" loginCtl the Page_Load( ) event fires once.
As soon as I add an ImageCtl or just drag an image using the designer, onto
the login page and then run it, I'm seeing the Page_Init( ) and Page_Load( )
functions being fired twice.
If I remove the image, then these methods are only fired once.
Any ideas?
I am setting the event delegate like this in my login.aspx.cs file:
protected override void OnInit( EventArgs e )
{
this.Load += new EventHandler( Page_Load );
}
protected void Page_Load( ... etc.
Thanks for any tips,
FrankThis isn't a direct answer, but I personally avoid that this.Load += new
EventHandler(Page_Load) stuff that the wizard puts in like the plague. The
reason being is that I subclass pages a lot, and when you depend on wiring
up events, you can run into issues where a subclass won't call the base
initializer, or the listeners get added in an order that prevents proper
handling (I'd have to dig up an example, but I had issues with Page_Load
never firing at all). Since you're overriding OnInit just to wire up an
event handler, I'd just override OnLoad and see if that might prevent the
double-hit (plus, you're plugging into the vtable instead of having to deal
with event firing/delegate calling)

Newbie -- Page_Load( ) fires twice if image is added to Login page

Hi,

I'm using Visual Studio 2005 + ASP.NET and C#

I have a login.aspx page with AutoEventWireup set to FALSE (also added to
top level Web.Config, and set to false)

With a "template" loginCtl the Page_Load( ) event fires once.

As soon as I add an ImageCtl or just drag an image using the designer, onto
the login page and then run it, I'm seeing the Page_Init( ) and Page_Load( )
functions being fired twice.

If I remove the image, then these methods are only fired once.

Any ideas?

I am setting the event delegate like this in my login.aspx.cs file:

protected override void OnInit( EventArgs e )
{
this.Load += new EventHandler( Page_Load );
}

protected void Page_Load( ... etc.

Thanks for any tips,

FrankThis isn't a direct answer, but I personally avoid that this.Load += new
EventHandler(Page_Load) stuff that the wizard puts in like the plague. The
reason being is that I subclass pages a lot, and when you depend on wiring
up events, you can run into issues where a subclass won't call the base
initializer, or the listeners get added in an order that prevents proper
handling (I'd have to dig up an example, but I had issues with Page_Load
never firing at all). Since you're overriding OnInit just to wire up an
event handler, I'd just override OnLoad and see if that might prevent the
double-hit (plus, you're plugging into the vtable instead of having to deal
with event firing/delegate calling)

newbie - page load not firing

Using asp.net 2.0. I have a page confirm.aspx:

**********************************
<%@dotnet.itags.org. Page Language="VB" AutoEventWireup="false"
CodeFile="confirm.aspx.vb" Inherits="confirm" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
************************************************** *******

This is my page behind page (confirm.aspx.vb):

Partial Class confirm
Inherits System.Web.UI.Page
Sub Page_Load(ByVal s As Object, ByVal e As EventArgs)
Response.Write("hello")
End Sub
End Class
***********************************************

When I confirm.aspx loads in the browser nothing happens. i.e. a blank
page is returned. Shouldn't "hello" be displayed? What am I doing
wrong?Change AutoEventWireup="false" to AutoEventWireup="true" and it should work.
If you're a newbie to .Net from classic asp, note that response.write will
output before all the other content. - i.e. before "<!DOCTYPE.....". But
you'll see that when you run it :)

Jevon

"Steve" <bahram@.iranmania.com> wrote in message
news:1130840485.862653.166360@.g43g2000cwa.googlegr oups.com...
> Using asp.net 2.0. I have a page confirm.aspx:
> **********************************
> <%@. Page Language="VB" AutoEventWireup="false"
> CodeFile="confirm.aspx.vb" Inherits="confirm" %>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" >
> <head runat="server">
> <title>Untitled Page</title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
> </div>
> </form>
> </body>
> </html>
> ************************************************** *******
> This is my page behind page (confirm.aspx.vb):
>
> Partial Class confirm
> Inherits System.Web.UI.Page
> Sub Page_Load(ByVal s As Object, ByVal e As EventArgs)
> Response.Write("hello")
> End Sub
> End Class
> ***********************************************
> When I confirm.aspx loads in the browser nothing happens. i.e. a blank
> page is returned. Shouldn't "hello" be displayed? What am I doing
> wrong?
Set AutoEventWireup to True and try.

"Steve" wrote:

> Using asp.net 2.0. I have a page confirm.aspx:
> **********************************
> <%@. Page Language="VB" AutoEventWireup="false"
> CodeFile="confirm.aspx.vb" Inherits="confirm" %>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" >
> <head runat="server">
> <title>Untitled Page</title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
> </div>
> </form>
> </body>
> </html>
> ************************************************** *******
> This is my page behind page (confirm.aspx.vb):
>
> Partial Class confirm
> Inherits System.Web.UI.Page
> Sub Page_Load(ByVal s As Object, ByVal e As EventArgs)
> Response.Write("hello")
> End Sub
> End Class
> ***********************************************
> When I confirm.aspx loads in the browser nothing happens. i.e. a blank
> page is returned. Shouldn't "hello" be displayed? What am I doing
> wrong?
>
Thank you so much for that. I spent more than 2 needless hours this
morning getting frustrated over this. Thank you so much.

So does that mean the Page_Load event can never be captured if the
AutoEventWireup is set to false, or is there a way for the
AutoEventWireup to be set to false and for the Page_Load event to still
be captured?
Yes, manually hook up the handler method with the event:

Sub Page_Load (..., ...) Handles MyBase.Load
...
End Sub

(OR)

' Have the following line in any method/event handler that runs before page
load event.
AddHandler Me.Load, AddressOf Page_Load

"Steve" wrote:

> Thank you so much for that. I spent more than 2 needless hours this
> morning getting frustrated over this. Thank you so much.
> So does that mean the Page_Load event can never be captured if the
> AutoEventWireup is set to false, or is there a way for the
> AutoEventWireup to be set to false and for the Page_Load event to still
> be captured?
>

Newbie - Please be Nice

Hey everyone..

I've read a few posts in here, and none of them actually answered my question... I am a complete newbie to .NET ... I code XHTML & CSS for a large company and have some knowledge of ASP & SQL.

My question is where shall I start? What should be the first thing I learn and where should I get the info... I have just ordered ASP.NET 2 For Dummies and also VB.NET for Dummies... I have downloaded Visual Web Developer Express Edition and am VERY keen to start.

I hope I don't annoy too many of you with stupid questions once I get going...Wink

Hi, There is always a start point!!

There is a nice book ASP.NET 1.1 Unleashed and now a new version ASP.NET Unleashed 2.0. Both books are best recommended.

There is also a good startng point:Learn ASP.NET

You should start with VWD, install it and start with it as soon as possible.

Feel free always to ask whatever you want. I am sure all are ready to help!

Regards


Actually I'm going to jump into this question and ask as well, I am new to asp, sql, and vb as well.

I basically was given a project that required all three so I have been learning as I go, do you (or anyone with the experience) recommend an order (I have asp.net 2.0 unleashed it is a good book)such as learning vb.net first then moving onto asp, or can you learn both at the same time. I have been working on this project so I have not had the luxury of time to really learn, I've just had to do, and while I have learned some (I know more now than I did when I started), after this project gets done, I plan on actually going back and learning the language(s). Any particular order in learning or can you learn them both concurrently and have it worked out, I'll admit more than once I have gotten lost in code trying to figure out which part was asp and which part was vb, not to mention there are to many commands I parrot without actually understanding what they actually do. I have been using notepad, and dreamweaver (in code mode) because that is the best way for me to learn something (I learn HTML and CSS before I learn dreamweaverBig Smile )


Thats a good question... I wondered whether to learn VB.NET first and then move on - But I am creating web applications so really I should learn ASP.NET first and try to integrate VB.NET as I go.. Luckily I do know a very small bit of VBScript from using it with ASP which I hope will help me in the long run (hehehe.. I hope :-) ...

Are there any video tutorials for absolute beginners?? As I started watching the first beginners tutorial and even that says VWD Tutorial for VB programmers or something like that ...Huh? .. If I could find some video tutorials for people who don't know VB script first then that'd be cool ... If not I'll struggle by...

Still are there things I should make a point of getting my head round in .NET?? For example in ASP VBScript the pre-built functions are something you HAVE to know about if you want to suceed?? Any advice...

(Thanks for the home page link too...Smile)
Anyone... Surely you clever lot could give us a bit more info as to maybe where you guys n gals started??Embarrassed

Hi,

You might find this link (including video tutorials) helpful:

http://weblogs.asp.net/scottgu/archive/2006/02/26/Great-ASP.NET-2.0-Tutorial-Videos-Online.aspx

Also, I started with Professional C# by Wrox publication and learnt the language first and then came to Web programming. You can do both simultaneously, no issues. Just keep the fire inside you burning !

Regards,

Vivek


You guys should delve into VB a little bit, learn about its structure, functions, classes, Import etc. I think AT MOST a week should be enough (and that's a lot of time to learn it), and then you can start playing with ASP .Net!

Smiles.


ok... So VB 2005 or VB.NET?

VB 2005 means VB.NET ( visual studio 2005 ) on .NET framework 2.0.

-Vivek


Thanks for that...

dotnet_lee:

Anyone... Surely you clever lot could give us a bit more info as to maybe where you guys n gals started??Embarrassed

Assembler on a DEC PDP-11. From there, Bally Basic, Z-80 assembler, GW Basic, 8086/88 assembler, Basic-A, LISP, LOGO, a bit of Pascal, Cobol and Fortran, C, Visual Basic, C+, VBA, Perl, HTML, C++, Javascript, VBscript, how to do "Hello World!" in Jscript, VB.NET, CSS, a week of hating Python, C#, TSQL, one Java applet and a bunch of macro or scripting technologies along the way. And I still can't program my way out of a paper bag. :)

To get started you need to learn programming structure. You'll also need some basic OOP background to understand classes and inheritance. Learning those will take some kind of language, since you can't easily learn a pre-test or post-test loop without a language to program a loop in. Start with VB or C, and stick with that until you can do everything. Then translate that into the other one.

Get a copy of Visual Web Developer and never use drag and drop. Write the code. Let VWD mark up your improper syntax, even prompt you with Intellisense, but don't let a wizard do anything and forget any control properties except the main window in Source view. Once you've written a decent learning app, start a new one and drag and drop to create the same app. You'll see where to edit code by hand, what properties you can default and what parts of the IDE will make life easier instead of hiding the innards you're trying to learn.

Forget a week. Plan on a lifetime of learning and relearning. Take a class every year or two, buy a few books each year on new technologies or techniques and twice a year take a week to design and code an app you've never done before. Do it for your church, school or local charity. Sit with the users and watch where they screw up your carefully crafted app. Fix it so they can't screw up. Then make it pretty. Document it fully so that in a year or two you can go back and update it for them. If it's really good and widely useful, release it as open source and see waht people who you've never met will do to improve your code. And learn from them.

Above all, ask questions. Whenever you need to. Research the topic first so you don't ask dumb questions, and try to solve the problem yourself, but don't stay stuck on something when there is someone you can ask.

Good luck.

Jeff


dotnet_lee:

Anyone... Surely you clever lot could give us a bit more info as to maybe where you guys n gals started??Embarrassed

The videos in the links below covers most of what you need to know because you already know web application. Then get a comprehensive book like Asp.net 2.0 Unleashed and you are ready. It is not rocket science.

http://weblogs.asp.net/scottgu/search.aspx?q=Video+tutorials&p=1

http://www.asp.net/learn/withpss/default.aspx?tabid=63

http://www.asp.net/learn/videos/default.aspx?tabid=63

Read the tutorials at the end of the first link below for OOAD(object Oriented analysis and design), while you wait for the Video version of Craig Larman's also very comprehensive OOAD book which you can order from the second link.

http://www.objectsbydesign.com/tools/certification.html#resources
http://www.phptr.com/bookstore/product.asp?isbn=0130479500&aid=686ef932-f921-4820-99b0-fe6a0ad6f082&rl=1

Hope this helps and happy coding.


Hi there.

Being quite new to .NET and from the same background as you i do understand what you need!
I started at the learning zone here, and at the VWD learning site here:http://msdn.microsoft.com/vstudio/express/vwd/learning/default.aspx

A set of really neat instructionsvideos for C# and VB lead you the way to a finished product while describing most of the essentials.. Could it be better that that?

Happy coding!Cool

Newbie -- pls help

Hi all,

Reali need some help here.

I'm using <repeaterto display few thing taken from the dB.
1. hidden field, which contains the Language code (stored in dB)
2. Textbox

Code goes:

<asp:repeater id="myRepeater" runat="server">
<itemtemplate>
<asp:panel id="pnlCountry" runat="server">
<asp:table>
<tr>
<td>
<asp:label id="lblCounty" runat="server" text="T&Cs: "></asp:label><br>
<%# Container.DataItem("LanguageCode") %>
</td>
<td>
<asp:textbox id="txtTnC" runat="server" textmode="multiline" rows="10"
columns="45"></asp:textbox>
</td>
</tr>
<tr><td>
<INPUT id="hdnLanguage" type="hidden" runat="server" NAME="hdnAltLanguage"
value=<%# Container.DataItem("LanguageCode") %>>
</td>
</tr>
</asp:table>
</asp:panel>
</itemtemplate>
</asp:repeater>

OnClick of a button, i want to get the values entered in the textfields for
the different languages.

How do i do that? What events to use??

Pls help me!!!

Thanx lotz..

RegarDx..Well if you want to do something when someone click a button then put it in
the OnClick event handler. If you want to access the values in the labels
and textboxes in the repaeater control then you would use the command

myRepeater.FindControl("ControlID")

This will return a reference to the relevent control, although all controls
within the parent container (i.e. myRepeater) must have unique IDs.

your code for the asp:table markup is wrong. You have created an asp:table
but left out an ID and a runat=server which are required. You have also used
HTML row and column markup, to create rows and columns in an asp:table you
use <asp:TableRowand <asp:TableCell not <trand <td>.

"siLver" wrote:

Quote:

Originally Posted by

Hi all,
>
Reali need some help here.
>
I'm using <repeaterto display few thing taken from the dB.
1. hidden field, which contains the Language code (stored in dB)
2. Textbox
>
Code goes:
>
<asp:repeater id="myRepeater" runat="server">
<itemtemplate>
<asp:panel id="pnlCountry" runat="server">
<asp:table>
<tr>
<td>
<asp:label id="lblCounty" runat="server" text="T&Cs: "></asp:label><br>
<%# Container.DataItem("LanguageCode") %>
</td>
<td>
<asp:textbox id="txtTnC" runat="server" textmode="multiline" rows="10"
columns="45"></asp:textbox>
</td>
</tr>
<tr><td>
<INPUT id="hdnLanguage" type="hidden" runat="server" NAME="hdnAltLanguage"
value=<%# Container.DataItem("LanguageCode") %>>
</td>
</tr>
</asp:table>
</asp:panel>
</itemtemplate>
</asp:repeater>
>
>
OnClick of a button, i want to get the values entered in the textfields for
the different languages.
>
How do i do that? What events to use??
>
Pls help me!!!
>
Thanx lotz..
>
RegarDx..
>
>

Newbie - Protecting source code

If I create an ASP.NET (c#) web application, how can I prevent my code being
ripped off when I load it onto a 3rd party web server? (Someone copying the
.cs files, and removing them)
Is there a way to compile these .cs files for the ASP.NET pages to read.If you're using VS.NET, compile the project,
and only upload the dll's and .aspx files to your
server or, if you're not using VS.NET, compile
the assemblies ( dlls ) from the command line
and deploy them, with your .aspx files, to the server.
Juan T. Llibre
ASP.NET MVP
===========
"Fronky" <nospam@.nospam.com> wrote in message
news:OJmXokTCFHA.2032@.tk2msftngp13.phx.gbl...
> If I create an ASP.NET (c#) web application, how can I prevent my code
> being
> ripped off when I load it onto a 3rd party web server? (Someone copying
> the
> .cs files, and removing them)
> Is there a way to compile these .cs files for the ASP.NET pages to read.
>
Sorted it! Thanks for your help!
"Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
news:uxQbcyTCFHA.1396@.TK2MSFTNGP14.phx.gbl...
> If you're using VS.NET, compile the project,
> and only upload the dll's and .aspx files to your
> server or, if you're not using VS.NET, compile
> the assemblies ( dlls ) from the command line
> and deploy them, with your .aspx files, to the server.
>
>
> Juan T. Llibre
> ASP.NET MVP
> ===========
> "Fronky" <nospam@.nospam.com> wrote in message
> news:OJmXokTCFHA.2032@.tk2msftngp13.phx.gbl...
>
Of course, if the security on the server is such that someone could view the
source code of your ASP.Net pages, you have a more serious problem.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.
"Fronky" <nospam@.nospam.com> wrote in message
news:u5HmNDUCFHA.520@.TK2MSFTNGP09.phx.gbl...
> Sorted it! Thanks for your help!
>
> "Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
> news:uxQbcyTCFHA.1396@.TK2MSFTNGP14.phx.gbl...
>
"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:O$DN%23pVCFHA.3976@.tk2msftngp13.phx.gbl...

> Of course, if the security on the server is such that someone could view
> the source code of your ASP.Net pages, you have a more serious problem.
LOL! Absolutely!

Newbie - Problem Sending an email via .NET

Hello,
I am tring to send an email from my local machine (acting as a web server)
on my company's network.
For simplicity sake, I just want to send an email to myself. But I cannot
seem to configure this correctly. Either nothing happens at all, no errors
and no email, but the code seems to run OK, or I get an error saying it
cannot find the Server.
Here's the code:
Public Shared Sub SendEmailToMe()
Dim from As String = "myself@dotnet.itags.org.here.com
Dim mailto As String = "myself@dotnet.itags.org.here.com"
Dim subject As String = "Test Message"
Dim body As String = "Test the body message"
SmtpMail.SmtpServer = "localhost" 'I've tried my IP address and what I think
is my SMTP is, but I'm not sure
SmtpMail.Send(from, mailto, subject, body)
End Sub
My assumption is that I do not have the SMTPServer configured correctly. But
that is just a guess.
Any insight is greatly appreciated.
Thanks.
-RobTry :
http://support.microsoft.com/default.aspx?scid=kb;en-us;308161
"Rob G" <gumbatman@.hotmail.com> a crit dans le message de
news:10doikcrc0sgsc4@.corp.supernews.com...
> Hello,
> I am tring to send an email from my local machine (acting as a web server)
> on my company's network.
> For simplicity sake, I just want to send an email to myself. But I cannot
> seem to configure this correctly. Either nothing happens at all, no errors
> and no email, but the code seems to run OK, or I get an error saying it
> cannot find the Server.
> Here's the code:
>
> Public Shared Sub SendEmailToMe()
> Dim from As String = "myself@.here.com
> Dim mailto As String = "myself@.here.com"
> Dim subject As String = "Test Message"
> Dim body As String = "Test the body message"
> SmtpMail.SmtpServer = "localhost" 'I've tried my IP address and what I
think
> is my SMTP is, but I'm not sure
> SmtpMail.Send(from, mailto, subject, body)
> End Sub
> My assumption is that I do not have the SMTPServer configured correctly.
But
> that is just a guess.
> Any insight is greatly appreciated.
> Thanks.
> -Rob
>
>
>Public Shared Sub SendEmailToMe()
> Dim from As String = "myself@.here.com
>Dim mailto As String = "myself@.here.com"
>Dim subject As String = "Test Message"
>Dim body As String = "Test the body message"
>SmtpMail.SmtpServer = "localhost" 'I've tried my IP address and what I thin
k
>is my SMTP is, but I'm not sure
>SmtpMail.Send(from, mailto, subject, body)
>End Sub
>My assumption is that I do not have the SMTPServer configured correctly. Bu
t
>that is just a guess.
>Any insight is greatly appreciated.
>Thanks.
>-Rob
>
Where does it exception? What is the exception message?, do you have
the iis smtp relay server running? Can you see the mail anywhere in
inetpub/mailroot/?
-Adam
Just now, I found the emails in the C:\Inetpub\mailroot\Queue directory.
<ashelley@.inlandkwpp.com> wrote in message
news:l3jod0peeo7b9q0bcdfv43515v28l250pe@.
4ax.com...
think
But
> Where does it exception? What is the exception message?, do you have
> the iis smtp relay server running? Can you see the mail anywhere in
> inetpub/mailroot/?
> -Adam
ashelley,
Here's some other stuff I found:
Since I have the SMTP Server running, I no longer get the exception errors.
I walked through the steps to Test Windows 2000 IIS SMTP Services Manually
as per http://support.microsoft.com/default.aspx?scid=kb;EN-US;286421#Task1
and everything seemed to check out. However, that mail that I sent, when
testing, is still sitting in the Queue directory.
I guess the next step is to figure out why it is not moving from the Queue
to an actual email.
Thanks for your help.
-Rob
<ashelley@.inlandkwpp.com> wrote in message
news:l3jod0peeo7b9q0bcdfv43515v28l250pe@.
4ax.com...
think
But
> Where does it exception? What is the exception message?, do you have
> the iis smtp relay server running? Can you see the mail anywhere in
> inetpub/mailroot/?
> -Adam
On Fri, 25 Jun 2004 12:40:46 -0400, "Rob G" <gumbatman@.hotmail.com>
wrote:

>ashelley,
>Here's some other stuff I found:
>Since I have the SMTP Server running, I no longer get the exception errors.
>I walked through the steps to Test Windows 2000 IIS SMTP Services Manually
>as per http://support.microsoft.com/default.aspx?scid=kb;EN-US;286421#Task1
>and everything seemed to check out. However, that mail that I sent, when
>testing, is still sitting in the Queue directory.
>I guess the next step is to figure out why it is not moving from the Queue
>to an actual email.
>Thanks for your help.
>-Rob
>
Since you tested it and it is delivering mail by telnetting to it I
think you might need to look at a few things. delete the stuff in the
queue directory, and just try resending. make sure you use the same
email credentials you used while testing. if you use the same
credentials and it doesn't work maybe it is having problems with
permisions on the directories within mailroot. if it keeps failing,
drive a hammer through the front of your screen and go out and enjoy
the sun.
-Adam
ashelley,
Thanks for your help. I think we are getting closer.
It seems that these queued emails are in the Outbox of Outlook Express (I
expected them to be in Outlook). I can't send anything from Outlook Express
because it wants a dialup connection. I would like it to connect to my LAN,
but I can't figure that one out.
Another hour on this and I am going out into the sun and get some fresh air.
-Rob
<ashelley@.inlandkwpp.com> wrote in message
news:58lod01ogm3ig5s9viuedctdjodqj1k21p@.
4ax.com...
> On Fri, 25 Jun 2004 12:40:46 -0400, "Rob G" <gumbatman@.hotmail.com>
> wrote:
>
errors.
Manually
http://support.microsoft.com/default.aspx?scid=kb;EN-US;286421#Task1
Queue
> Since you tested it and it is delivering mail by telnetting to it I
> think you might need to look at a few things. delete the stuff in the
> queue directory, and just try resending. make sure you use the same
> email credentials you used while testing. if you use the same
> credentials and it doesn't work maybe it is having problems with
> permisions on the directories within mailroot. if it keeps failing,
> drive a hammer through the front of your screen and go out and enjoy
> the sun.
> -Adam
>
On Fri, 25 Jun 2004 13:03:58 -0400, "Rob G" <gumbatman@.hotmail.com>
wrote:

>ashelley,
>Thanks for your help. I think we are getting closer.
>It seems that these queued emails are in the Outbox of Outlook Express (I
>expected them to be in Outlook). I can't send anything from Outlook Express
>because it wants a dialup connection. I would like it to connect to my LAN,
>but I can't figure that one out.
>
yeah, umm okay, i assume you mean .eml files. They open in outlook
express because of a file association not because they are sent out
using outlook. I'm not particularly sure, in detail, how the relay
thing works.
What i think might be happenning is that it can't send email to the
domain you are trying to send to. are there any logs in
system32/logfiles/ that help us out?
-Adam
Hi Rob,
Outlook/Outlook Express has nothing to do with sending emails from a Net
app. It is a client program which connects to a POP3 server, or Exchange
Server in order to send emails. The .Net app uses an SMTP server, which you
already know you have on your machine. Don't get them .
If the email you're sending has a return address which is not local to your
machine, by default, the IIS SMTP server disallows "relaying," which is,
simply, the transmission of an email which did not originate on that machine
(determined by the return email address's domain name). You may need to
configure your local SMTP server to allow relaying. Be aware, however, that
it is turned off for a reason. You may find SPAMmers using your local SMTP
Server, unless you've blocked incoming traffic on Port 25.
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Rob G" <gumbatman@.hotmail.com> wrote in message
news:10domo0217j5l85@.corp.supernews.com...
> ashelley,
> Thanks for your help. I think we are getting closer.
> It seems that these queued emails are in the Outbox of Outlook Express (I
> expected them to be in Outlook). I can't send anything from Outlook
Express
> because it wants a dialup connection. I would like it to connect to my
LAN,
> but I can't figure that one out.
> Another hour on this and I am going out into the sun and get some fresh
air.
> -Rob
> <ashelley@.inlandkwpp.com> wrote in message
> news:58lod01ogm3ig5s9viuedctdjodqj1k21p@.
4ax.com...
> errors.
> Manually
> http://support.microsoft.com/default.aspx?scid=kb;EN-US;286421#Task1
when
> Queue
>
Kevin,
This is what I've done so far:
Under Default SMTP Virtual Server I went to Properties.
Clicked the Access tab.
Clicked Relay.
I added my local computer's IP address and 127.0.0.1 (just to test becuase I
don't know what I am doing).
"Only the list below " is selected and so is "Allow all computer which
succesfully authenticate..."
Does that make any sense?
Thanks.
-Rob
"Kevin Spencer" <kspencer@.takempis.com> wrote in message
news:ulogESuWEHA.3596@.tk2msftngp13.phx.gbl...
> Hi Rob,
> Outlook/Outlook Express has nothing to do with sending emails from a Net
> app. It is a client program which connects to a POP3 server, or Exchange
> Server in order to send emails. The .Net app uses an SMTP server, which
you
> already know you have on your machine. Don't get them .
> If the email you're sending has a return address which is not local to
your
> machine, by default, the IIS SMTP server disallows "relaying," which is,
> simply, the transmission of an email which did not originate on that
machine
> (determined by the return email address's domain name). You may need to
> configure your local SMTP server to allow relaying. Be aware, however,
that
> it is turned off for a reason. You may find SPAMmers using your local SMTP
> Server, unless you've blocked incoming traffic on Port 25.
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
> "Rob G" <gumbatman@.hotmail.com> wrote in message
> news:10domo0217j5l85@.corp.supernews.com...
(I
> Express
> LAN,
> air.
> when
>