Insert data from a dropdownlist and textbox control into a database (

Hi everyone,

I am creating an application for my students.  I teach piano.  There are three levels for them: Beginner, Intermediate, Advanced. After they have logged in, they are given the opportunity to select various pieces of sheet music to learn according to their level from a dropdown list control.  I have created the database which lists the sheet music and bound it to the dropdownlist control.  I have also added a textbox control where I want them to type in the reason why they selected the particular piece of music to learn (I know, kids hate writing essays, but it's not an essay, I promise! :) 

 Ok, I have also added a gridview control that is bound to the datasource that will display listings of all the pieces of sheet music the student has already selected and learned, just so they can see how they have progressed. (many get a kick out of seeing how they selected a challenging piece and were able to "conquer" it)  Ok, you can tell I really like teaching piano!

The gridview contains the following columns: Name, Level, SheetMusicName, Reason, ApprovedByInstructor, Completed

Ok, next.  Here is what I want to do: I want to insert into the gridview (into the datasource), the student's selections from the dropdownlist and the text out of the textbox.

  1. Student makes a selection from the dropdownlist
  2. Student types in the reason for the selection in a textbox
  3. Student sees the music they have learned in a gridview
  4. Student clicks the "I want to learn this!" button
  5. Once the button is clicked, a new page is launched (or can I do a postback to the same page?) that shows the New selected music (dropdownlist.selectedValue) and the reason they selected it (textbox.text) all within the gridview control.

I will post my HTML and ASP.NET code below.  I appreciate your expertise.

4/21/2009 8:47:38 PM 16182 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 10


that can be easily done by postback..

you have to insert seleted item of dropdown and text of the text box into the database on button click event and after inserting you have to rebind the gridview..

i hope this will help you.

(please mark as an answer, if this helps you.)
4/22/2009 3:54:19 PM
It seems that this is similar to this post:


"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
4/22/2009 6:00:03 PM

Similar Artilces:

Text out of a formview control (label, textbox, dropdownlist) in
How would I get the text or selectedvalue out of a from view control into the subject of an email? Here is my code Dim message As New MailMessage Dim server As New SmtpClient("") Dim fromAddress As New MailAddress("") message.Subject = (Label(frmNewQCI.FindControl("P1CategoryLabel").Text)) message.Body = "New QCI Created" message.To.Add("") message.From = fromAddress server.Send(message)   It is underlining Label and saying   'Label' is a type and cannot be used as an expression.  It's also underlining the rest an...

Sending SMS using or using or
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

how to insert all data from dataset to a temporary table in sql server database
I always get solutions for my question from the forum , thanks for all your help. Question is i have select some data from a database in server 1 and save it in to a DataSet in now i need to create a temporary table in server 2 test database and insert all rows in DataSet. I know I can read row by row in DataSet.Table(0) and execute a insert statement for each row. but i think this is time consuming. Is there any way that I can transfer all data in DataSet to a temporary table at once. need your help please. I am selecting data from Server 1 Datababse (original1) as follows &n...

Populate Label, Dropdownlist, Textbox and Gridview from a SQL DataBase using VB.NET
 Good Day, Please help me, i need a VB.NET code for my web appz, i already know how to connect to a sql server database using this codes Dim conn As New Data.OleDb.OleDbConnection conn = New Data.OleDb.OleDbConnection("Provider=SQLOLEDB.1;Password=******;Persist Security Info=True;User ID=***;Initial Catalog=Database;Data Source=ServerName") conn.Open() Dim cmd As Data.OleDb.OleDbCommand cmd = New Data.OleDb.OleDbCommand("Select Field1 From Table1", conn)So i would like to ask how can i bind this VB.NET connection code to a Label and/or Dropdownlist and...

Insert xml data into the database using object data source and fileupload control
Hi There, I have a fileupload control which takes the xml file. I have an object datasource with an insert method. I need to insert xml data into the sql server 2005 table which has column of type xml. Can anybody please let me know how I can do that using the file upload control? FileUpload has a property called filebytes, but how can I convert filbytes (or any other property of the fileupload)  to xml data so that I can set the insert parameter of the object datasource. Thanks a lot!!  Hi,the xml data can be inserted into the table in the form of byte[]. Here is how to write...

.Net 2.0 Web application using is unable to create object of another dll writen in C# .net 2.0
Hi, I habe created one web application using which is adding reference of dlls written in C# and .net 2.0. But whenever trying to create object of referencing dll, it is throwing error :Object reference does not set to an object. But, locally it is working fine,. In the server i have deployed the .aspx files and dll files in the bin. There were already an web.config in the server which is of .net 1.1. But checked it is retrieving value for that web.config correctly. Should i have to deply any other files and if not what can be the solution for this? Please help. Thanks, So...

Insert datetime, using
Hello there,I got a little code there are inserting a record into my msSQL database..But i cant insert the datetime, for one reason?The problem is in line 7 () where i want to insert DateTime.Now 1 Protected Sub SendPmTilAfviste(ByVal modtager As String, ByVal festID As String) 2 ' Connection 3 Dim conn As SqlConnection = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True") 4 conn.Open() 5 6 ' SQL-kommandoen 7 Dim cm...

converting to from offered me some sample code when I signed up with them the only problem is the sample code is in but my page that they type all of their credit card into is <code><%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.IO" %> <script language="C#" runat="server"> void Page_Load(Object Src, EventArgs E) { myPage.Text = readHtmlPage(""); } private String readHtmlPage(string url) { ...

Insertting data using
Hi everyone,  Ive been trying to insert data into an database using vb. There is a lot of content on the net about doing this in different ways, however what ive seen doesnt work and seems really long winded. Is there an easy guide on insertting data programmatically using on the internet. The reason i dont want to use an SQLDataSource is because i want to insert data into several tables with current time and date etc. And to the best of my limited knowledge using code behind would be the best/ easiest way to do it.  Any help/advice would be great!! The_...

How do I bind a textbox to a database VB.Net
I am an old time VB6.0 programmer who is making the transition into VB.Net. I'm having problems connecting a textbox to a database field. I can get dropdown lists to work and datagrids, but I need textboxes to display data. The first step in this code sample from shows how to query a database and put the returned data into textboxes: WierMCP/ - where to look first!Please Vote for ASPNet101 - 'Best Community Resource'!Control Grouper - easily control properties for multiple c... vs vs
just out of curiousity which looks, acts most like java? i'm still learning trying to used to but it seems that it was easier to do some stuff with java. C# is Java++ in my opinion. If you have done C or Jave you will prefer C#.Mike Schellenberger - MCAD If you are looking for language similar to java go for J#. However most code samples you find on the net will be in VB.NET and C#....

.Net 2
Hi Friends, I want to show Different Tabs for different information on my web form ( .aspx page ). I could not found Tab Control with .net 2005. I know there is some but couldnt find it. Can you please tell me from where can I add Tab Control to my web form ? Thanks in advance, Nirav With some tedious settings of properties on the menu control, it will behave like a tab control.  Then you need to use a multiview control and fill it with views.  Then you need to wire up the menu to the multiview or something.  I tried this before and it works, but we wrote our own contro...

insert multiple data from a textbox control to database
New to programming, get some progress, seems fun.Have one problem, don't know how to accomplish. I want to use a textbox control to insert multiple data into the database at a time. It will be some thing like this. There is a table [customer], and only one column [customerid], the [customerid] is always 3 character, we can assume it as char(3). And I want to use a textbox control to insert data to this column. The input format will be like this:ABC, BCD, FFF, DDD, GHI, GHE, GIQ, GKGBasically, three character, then follow a common, then a space, I want to input these data into the...

How to create a PDF with data from a database in
Is there a way to create a PDF with data from a database in VB.NET? Once I get the results from a data grid I have a link where they can click to view the results in PDF format. do a google for "itextsharp" I have used this to generate PDF's in VB.NET.    There's no "built in" way of doing this.  You must use a 3rd party library or manually write the pdf per the documentation from Adobe.  I've personally had better success with some commercial packages than I ever did with iTextSharp but ymmv.  JeffreyABecker:  There&#...

Web resources about - Insert data from a dropdownlist and textbox control into a database ( -

Tag Synonyms - Stack Overflow
Q&A for professional and enthusiast programmers

Accidental entities - what about the UI?
This post is a follow-up to my previous blog post " Accidental entities - you don't need that identity ". In that post, we followed a consultant ...

Flash Builder Plug-in for SAP Netweaver Gateway - Adobe Labs
Search Navigation Labs Home Wiki Home Technologies Alchemy Blueprint Camera Profiles and DNG Profile Editor Cirrus ColdFusion 10 DNG Codec Fireworks ...

Air Astana - Join Now
Thank you for considering membership of Nomad Club – Kazakhstan’s first Frequent Flyer Program. You could soon be on your way to earning free ...

Languages -> C# Articles, Tutorials, Examples: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Blog - Avisra
Avisra Web Development Home Blog Services Contact The Blog Latest Module Builder: How can we make it better? Sitefinity by Chris on July 2, 2013 ...

Online Booking Tool Support
This Online Booking Tool Support page might help you as you navigate through the process of booking travel through your OBT provided by CWT. ...

@Html and beyond
... ); } return string .Format( “{0}{1}” , me.Member.Name, id); } The Html building methods are quite simple. Building a dropdownlist for a ...

Top Ranked Articles
Top Ranked Articles - Free source code and tutorials for Software developers and Architects.; Updated: 23 Feb 2013

Unit Testing DateTime.Now Without Isolation
public virtual void SeedWithYearsSince(DropDownList list, int year){ for (int index = year; index

Resources last updated: 2/5/2016 6:51:15 AM