Getting Started with .net and a few questions

Hello

 I've done some asp and php programming along with various other languages in the past and slowing getting my head around .net.

I have a small project of creating a Holiday Booking system on our Intranet and just trying to get the first part to work properly will hopefully get me sorted for the whole project. The Intranet is running on .net 2 and I prefer to use the VB code rather than C#. This is connecting to an SQL server.

My initial page that I am trying to create is just for an admin user to view which dates in a table have been specified as Bank Holidays and be able to add new dates or delete existing dates. As we work across UK and Ireland there are 3 regions for different bank holidays.

So my initial form  starts off with a combo box to select the Region, when that is changed it then populates another combo with the years in the table against the selected region. When that is changed a grid view is shown displaying all of the dates for that region in that year. The grid view works fine in that the user can also delete the dates.My main issue at the moment is with the new additions. I have a form where the user clicks on the New button and teh ID field and a calendar control is displayed. I just don't know how to populate the ID field at the moment from a non form combo box.

Also my boss is an SQL programmer so would prefer to run everything as SP's on the server. So can somone also let me know which would be better to run the SQL from the controls or call SP's? Is there any load difference if this was to run on very large databases? I'm also quite happy at the moment about using the local SQL commands as in teh code below but not sure how to call an SP, so a small posting on how to do that would be most appreciated in replacemtn for part of my code.

 The code below is a sample of what I am working on at the moment.

 Thanks in advance for any replies.

Langy

 

<script runat="server">
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
GridView1.DataBind()
End Sub

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

End Sub

Protected Sub
Calendar2_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Label1.Text = sender.SelectedDate
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
text-align: center;
}
.style2
{
width: 600px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="style1">

<div class="style1">

<br />
Please Select a Region:
<asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="NIL_HOL_Region"
DataTextField="RegionName" DataValueField="ID"
OnTextChanged="DropDownList1_SelectedIndexChanged"
onselectedindexchanged="DropDownList1_SelectedIndexChanged"
AutoPostBack="True">
</asp:DropDownList>
</div>
<asp:SqlDataSource ID="NIL_HOL_Region" runat="server"
ConnectionString="<%$ ConnectionStrings:NIL_HOL DBConnectionString %>"
SelectCommand="SELECT [ID], [RegionName] FROM [Regions] ORDER BY [RegionName]">
</asp:SqlDataSource>
<div class="style1">
<br />

Please Select a Year:
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="NIL_HOL_Years"
DataTextField="PubHolYearsTxt" DataValueField="PubHolYears"
OnTextChanged="DropDownList1_SelectedIndexChanged"
onselectedindexchanged="DropDownList1_SelectedIndexChanged"
AutoPostBack="True" onprerender="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
</div>
<asp:SqlDataSource ID="NIL_HOL_Years" runat="server"
ConnectionString="<%$ ConnectionStrings:NIL_HOL DBConnectionString %>"
SelectCommand="SELECT DISTINCT YEAR(NonWorkingDays.HolDate) AS PubHolYears, CONVERT (varchar, YEAR(NonWorkingDays.HolDate)) AS PubHolYearsTxt FROM Regions INNER JOIN NonWorkingDays ON Regions.ID = NonWorkingDays.RegionID WHERE (NonWorkingDays.RegionID = @RegID) UNION SELECT 0 AS PubHolYears, 'Please Select' AS PubHolYearsTxt ORDER BY PubHolYearsTxt DESC">
<SelectParameters>
<asp:ControlParameter ControlID="
DropDownList2" DefaultValue="0"
Name="
RegID" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<div class="
style1">
<br />
<table class="
style2">
<tr>
<td>
<asp:GridView ID="
GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="
NIL_HOL_PUBHOL" BorderColor="#000099"
BorderStyle="
Inset" BorderWidth="2px" CellPadding="4" GridLines="Horizontal"
Width="
298px" DataKeyNames="RegionID,HolDate" ForeColor="#333333">
<RowStyle BackColor="
#EFF3FB" BorderColor="Black" BorderStyle="Solid"
BorderWidth="
2px" />
<Columns>
<asp:TemplateField ShowHeader="
False">
<ItemTemplate>
<asp:Button ID="
btnDelete" runat="server" CausesValidation="False"
CommandName="
Delete" Text="Delete" OnClientClick="return confirm('Are you sure you want to delete this item?')"></asp:Button>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="RegionID"
SortExpression="RegionID" ReadOnly="True" >
<ItemStyle Font-Size="Smaller" ForeColor="White" Width="1px" />
</asp:BoundField>
<asp:BoundField DataField="HolDate" HeaderText="Date" ReadOnly="True"
SortExpression="HolDate" />
</Columns>
<FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="NIL_HOL_PUBHOL" runat="server"
ConnectionString="<%$ ConnectionStrings:NIL_HOL DBConnectionString %>"
SelectCommand="SELECT [RegionID], HolDate FROM [NonWorkingDays] WHERE ((YEAR([HolDate]) = @HolDate) AND ([RegionID] = @RegionID)) ORDER BY convert(datetime,[HolDate])"
DeleteCommand="DELETE FROM [NonWorkingDays] WHERE [RegionID] = @original_RegionID AND [HolDate] = @original_HolDate"

InsertCommand="INSERT INTO [NonWorkingDays] ([RegionID], [HolDate]) VALUES (@RegionID, @HolDate)"
OldValuesParameterFormatString="original_{0}">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" DefaultValue="0"
Name="HolDate" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownList2" DefaultValue="0"
Name="RegionID" PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="original_RegionID" Type="Int32" />
<asp:Parameter Name="original_HolDate" Type="String" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="RegionID" Type="Int32" />
<asp:Parameter Name="HolDate" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</td>
<td>
<br />
<asp:FormView ID="FormView1" runat="server" DataKeyNames="RegionID,HolDate"
DataSourceID="NIL_HOL_PUBHOL_Insert">

<InsertItemTemplate>
RegionID:
<asp:TextBox ID="RegionIDTextBox" runat="server"
Text='<%# Bind("RegionID") %>' />
<br />
HolDate:
<br />
<asp:Calendar ID="Calendar2" runat="server"
SelectedDate='<%# Bind("HolDate") %>'></asp:Calendar>
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
&nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
<asp:Button ID="btnAddDate" runat="server" CausesValidation="False"
CommandName="New" Text="Add Date For Selected Region" />
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="NIL_HOL_PUBHOL_Insert" runat="server"
ConnectionString="<%$ ConnectionStrings:NIL_HOL DBConnectionString %>"
DeleteCommand="DELETE FROM [NonWorkingDays] WHERE [RegionID] = @RegionID AND [HolDate] = @HolDate"
InsertCommand="INSERT INTO [NonWorkingDays] ([RegionID], [HolDate]) VALUES (@RegionID, @HolDate)"
SelectCommand="SELECT [RegionID], [HolDate] FROM [NonWorkingDays]">
<DeleteParameters>
<asp:Parameter Name="RegionID" Type="Int32" />
<asp:Parameter Name="HolDate" DbType="Date" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="RegionID" Type="Int32" />
<asp:Parameter Name="HolDate" DbType="Date" />
</InsertParameters>
</asp:SqlDataSource>
<asp:Button ID="btnAddDate2" runat="server" onclick="btnAddDate_Click"
Text="Add Date For " />
</td>
</tr>
</table>
<br />
</div>
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />
</div>
</form>
  
0
Langy
4/20/2009 9:14:17 AM
asp.net.getting-started 91979 articles. 3 followers. Follow

2 Replies
1681 Views

Similar Articles

[PageSpeed] 11

HI,
YOU CAN READ MY BELOW POST. HOPE IT WILL HELP YOU.

http://shawpnendu.blogspot.com/2009/02/how-to-read-data-from-sql-server-stored.html

MARK AS ANSWER if its help you.


Shawpnendu Bikash Maloroy
http://shawpnendu.blogspot.com
0
shawpnendu
4/20/2009 9:32:09 AM

Thanks for that, that looks pretty useful.

Still back to my current issue, how do I populate my form field with the text from a combo outside of the form?

 Langy

0
Langy
4/20/2009 3:08:48 PM
Reply:

Similar Artilces:

Newbie Question
I have a new project which has just started. One of the requirements is to generate XML files. Do I have to create schema files? Does anyone have a tutorial or sample code to help me get started. I have some background using XML, but not in .NET. Thx Mark How to create a new xml file with XmlDocument? More examples hereSonu Kapoor [MVP] Feel free to ask me any .NET question | Ajax Data Controls Forum Thanks, this is very helpful. What do I need to do extra to setup the schema for this xml file? Is the schema really necessary as well? Thx Mark You dont need to define any sc...

Getting Start With .net
hi i'm intersted to learn asp.net (vb or delphi) . i programming with delphi6 but i'd like to tp know something about programming in internet specially with .net . i hear about microsoft.net with delphi 7 that i can programming with delphi in .net .... is it right ? what 's our opinian about it ? and better to learn Vb.Net or continu with delphi(or delphi.net) thanks. Ali Darabian I think there is some support for Delphi in .Net. However, you will find much more support from the user community if you choose a more popular language such as VB.Net or C#. Since your al...

how to get start with .NET
the net help people installed  to my desktop 1-microsoft visual studio .NET enterprise developer 2003 2-microsoft .NET framework 1.1 what else do i need ...???  and how can i try with some simple code in VS.Net and run it to see wat happen...????? please help If you want to develope web applications, then you'll also need IIS on your PC.  That'll require XP-Professional or Windows 2000/2003, but XP-Home edition won't allow IIS installation. As for how to get started, you can search the web for some tutorials or buy a good book on VS.  The topic is way too vast to...

Where to start and how did you get started?
Hi, I have had a feeling for a long time to jump into the adds market for some time due to my low income (shooting for the stars) and I don't have anything better to do these days. But I find it really difficult not to give up due to lack of guides (what I can find atleast) and all the hard words which only makes me confused. But I won't give up. Never. Not sure if this is the right place to post this, but I deffinitly would be really greatfull for help getting started. How did you get started? +If there are any teacher that wanna show me the ropes private, I can give payment with ...

How do I get started with AJAX.Net?
Hi All, I'm a seasoned asp.net developer but have not yet ventured into atlas et al.  I prefer books, but will take whatever I can get if it's good and will get me going. Any recommendations? Thx in advance. Jeff try here first http://ajax.asp.net/downloads/default.aspx?tabid=47 then learn from sample and docJames Wu (MIB426).NET is only way to goMCP, MCSE, MCDBA, MCSD, MCAD I find the materials online display features and implementations but are lacking architectural depth, and am seeking more comprehensive resources. By architectural depth, I mean that I cannot watch ...

Getting started with JScript.NET
I'm a Javascript and Actionscript developer, and the thought of being able to do server-sides in something I know was too good to resist. Does anyone know some good tutorials for developing ASP.NET pages in JScript?  I can find lots of console code, but simple things are hard: like I can't even figure out how to print something out to the web page (just a string). What I'm really trying to do is access a database, verify a login, and print JSON out to the response.  What should I do to start?  Is there a better way to do this? (IE: using some JSON library already?). I'm commun...

Getting started .net website
Hi folks,Does anyone here know of a good website to just sit back and read for learning .net? Thanks in advance.Baldeep Right here... Click the Get Started and Learn sections here. Quite a few out there - - this one, has a lot of good videos -  also ASPNet101.com, but then, I might be a little prejudiced David WierMCP/ASPInsiderASPNet101.com - where to look first!Please Vote for ASPNet101 - 'Best Community Resource'!Control Grouper - easily control properties for multiple controls with one control!Calendar Express - The Best HTML Calendar Generator on the web!(P...

Getting Started Without VS.NET
Hi all, does anyone know how any online resources that can show me how to create web apps that include code-behind, and uer controls without using VS.NET? I have VS.NET in work, but would also like to do work at home, but cannot install VS.NET on my home laptop because I simply dont' have the space or processor power. Any online articles would be welcome, as will any open-source apps - I currently have SharpDevelop, but I find it unstable as it crashes my laptop alot of the time. Thanks Tryst Did you try Web Martix? It is a FREE tool from Microsoft.Regards, Narayana ...

Getting started with .net mobile/wireless application programming
Hi friends, I am very much amateur to the world of mobile/wireless application programming that's why m is having thousands of doubts and confusion regarding the technology. My first few concerns about the terms i.e. mobile web applications vs. windows mobile applications first thing are these 2 things are same if not what are the main differences. I hope you will also show me some light how to move further ahead in this field as i m having small exp approx. 1.5 yrs in Asp.net application. Any help in the form of links, URL, code will be highly appreciated. Thanks in advanced...

Getting started with mySQL Connector/Net 5.1
i have a vs2005 project which someone else built.  I need to connect to mySQL in this project. it is currently using the OleDbConnection to mySQL and I cannot make the connection, so I was told by the developer to try the the mySQL Connector/Net 5.1.  I have read the very encouraging documentation.  I am in a file called SqlDataProvider.vbI want to replace Dim objConnection As OleDbConnectionwithDim objConnection As MySqlConnection I get the blue squiggly  "MySqlConncection is undefined." I added this import to the top. Imports MySql.Da...

getting start with vb.net and crystal repots(web form)
I use Crystal Report9 in Visual Studio.NET 2003..... Example at Northwind database I want a application that.....a form include a combobox that contain CustomerID.....If I choose one CustomerID and click OK button....a Report will display information about this Customer......I think that must use Paramater.....how to do that ???? (How do I start to coding --please step by step or sample) please help me !!! Thank you so much!!! very good I have Dropdownlist when I choose the 'month'--> the all data of this field will show I use this Private Sub ddlMonth_Sel...

Getting 3.1 to start in debug mode in vs.net 2003.
  Hi All, I have a run time version of dnn installed and working at D:\Inetpub\wwwroot\dotnetnuke on my laptop. I want to be able to learn how to write DNN modules etc and so I have installed the source code in D:\Inetpub\wwwroot\dotnetnuke3100\. I set the debug flag in web.config to yes..... as in the lines.. <!-- set debugmode to false for running application --> <compilation debug="true" /> I updated the solution file D:\Inetpub\wwwroot\dotnetnuke3100\Solutions\DotNetNuke.All to look at localhost/dotnetnuke3100 which is my source code version. I have created the...

Question about getting started
I've got a question.  I'm trying to put together my first asp.net app and I think I'm a little over my head.  I've got some good experience with desktop applications but it's taking a little while for me to get the concept of asp.Anyway, first I was wondering if a lot of people on this forum have used interland to host their apps.  And if so, how do you create a subdomain?Then I was wondering if you have to create a separate application for each subdomain...Rob Mills First you have to understand the concept of a web application.The best way to start is to read the following ...

A few questions to get me started
Hello all, I've studied DNN and its capabilities and is VERY impressed with the work made by the Core group and others. I want to build a site that forces our users to login initially and the shows several "web views" of programs in different frames. My questions are: Is DNN the correct solution or would you consider it to be overkill? Do I need any other module to enable the single sign-on functionality? Windows Authentication? We probably will store the users in tha AD, but if it's easier we could consider adding users to an SQL server database as well. Could anyone ...

Web resources about - Getting Started with .net and a few questions - asp.net.getting-started

West Lothian question - Wikipedia, the free encyclopedia
He illustrated his point by pointing out the absurdity of a Member of Parliament for West Lothian being able to vote on matters affecting the ...

Facebook’s Helen Crossley on the 3 Big Mobile-Commerce Questions
Mobile grabbed hold of the holiday shopping season in 2014, and there is no reason to believe that trend won’t continue this year. Helen Crossley ...

Submit Your Questions For Autoblog Podcast #456
Filed under: Podcasts On Episode #456 of the Autoblog Podcast, we'll discuss our drive of the Mazda CX-9, Volkswagen's TDI fix, and this week's ...

‘The Walking Dead’ episode 7: A heart-pounding answer to ‘the Glenn question’
The seventh episode of The Walking Dead season 6 aired last night, and it had an interesting overall theme: people need saving. Unexpectedly, ...

Housing Rebound Didn't Lift Economy as Much as Economists Expected: Why?; Six Questions for Zandi
Home prices are nearly back to where they were before the crash. In some places, home prices are above where they were at the peak of the national ...

Real question: did Brad Pitt wear a ’90s wiglet at ‘The Big Short’ premiere?
Brad Pitt could potentially have a film at the Oscars this year. NO, not By the Sea . His real Oscar-bait film this year is The Big Short , which ...

Want a job at Apple? Here are 10 of the toughest interview questions
We alternately praise and criticize the folks at Apple depending on whether they just created the iPhone or Apple Maps, but there’s no doubting ...

Trump questions Hillary's 'stamina,' apparently unaware of her marathon Benghazi hearing
Donald Trump will find a new criticism of Hillary Clinton soon because his latest one is downright ludicrous. In an appearance on ABC’s “This ...

Lisa Vanderpump Is the Latest 'RHOBH' Star to Question Yolanda Foster's Lyme Disease
Lisa Vanderpump Is the Latest 'RHOBH' Star to Question Yolanda Foster's Lyme Disease

99 Women Answer This Persisting Question: How To Be A Woman?
99 women telling 99 stories on one stage to reveal the answer to the persisting question: “How to be a woman?” A story about intimacy and collaboration. ...

Resources last updated: 11/25/2015 11:23:19 PM