473,473 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ASP.NET C# Web Development project

1 New Member
I am doing Web Development project using ASP.NET C# as front-end & MS SQL Server 2005 as back-end. I am not familiar to ASP.NET C#, i need some help.
I am doing project for maintaining the leave details of employees. During run time when i will select "employee id" from dropdownlist, "type of leave" from radiobutton, entering the "number of leaves" in textbox & finally i will click save button. When i click the save button the values in textbox should be added to corresponding field values in database, by refering employee id from dropdownlist & types of leave from radiobuttons. If any will send a code, it will very useful for me. I will also attach my coding of the project below:
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using System.Data.SqlClient;
  12.  
  13. public partial class rb : System.Web.UI.Page
  14. {
  15.     Int32 days, rows;
  16.     String ltype;
  17.  
  18.  
  19.     protected void Button1_Click(object sender, EventArgs e)
  20.     {
  21.         if (this.RadioButton1.Checked == true)
  22.             ViewState["strLeave"] = RadioButton1.Text;
  23.         else if (this.RadioButton2.Checked == true)
  24.             ViewState["strLeave"] = RadioButton2.Text;
  25.         this.Label1.Text = "u r selected " + ViewState["strLeave"];
  26.  
  27.     }
  28.     protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
  29.     {
  30.         if (RadioButton1.Checked)
  31.         {
  32.             RadioButton1.Visible = true;
  33.             ltype = "cl";
  34.         }
  35.         else
  36.             RadioButton2.Visible = true;
  37.     }
  38.     protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
  39.     {
  40.         if (RadioButton2.Checked)
  41.         {
  42.             RadioButton2.Visible = true;
  43.             ltype = "el";
  44.         }
  45.         else
  46.             RadioButton1.Visible = true;
  47.     }
  48.     protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
  49.     {
  50.         int ddlIndex = this.DropDownList1.SelectedIndex;
  51.  
  52.         this.lblDdlCheck.Text = this.DropDownList1.SelectedItem.Text;
  53.     }
  54.  
  55.     protected void Button2_Click(object sender, EventArgs e)
  56.     {
  57.         SqlDataReader reader = null;
  58.         SqlConnection scon = null;
  59.         try
  60.         {
  61.             scon = new SqlConnection(@"Data Source = localhost; Initial Catalog = vel; Integrated Security = True");
  62.             scon.Open();
  63.             Response.Write("should have opened a connection by now");
  64.             Response.Write(rows);
  65.             days = Convert.ToInt32(TextBox1.Text);
  66.             string strQuery = "select cl,el from leave_details where empid = 2";
  67.  
  68.  
  69.             Convert.ToInt32(TextBox1.Text);
  70.             SqlCommand cmd = new SqlCommand(strQuery, scon);
  71.             rows = cmd.ExecuteNonQuery();
  72.             Response.Write(rows);
  73.             }
  74.         catch (Exception e1)
  75.         {
  76.             Response.Write("SQL connection exception" + e1.ToString());
  77.         }
  78.         try
  79.         {
  80.             catch (Exception ex)
  81.         {
  82.             Response.Write("SQL Exception occured" + ex.ToString());
  83.         }
  84.           scon.Close();
  85.    }
  86.  
  87.         protected void TextBox1_TextChanged(object sender, EventArgs e)
  88.     {
  89.         days = Convert.ToInt32(TextBox1.Text);
  90.     }
  91.     protected void Page_Load(object sender, EventArgs e)
  92.     {
  93.  
  94.     }
  95.  
  96.     protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
  97.     {
  98.  
  99.     }
  100.     protected void SqlDataSource2_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
  101.     {
  102.  
  103.     }
  104.  
  105.  
  106.     protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
  107.     {
  108.  
  109.     }
  110.     protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e)
  111.     {
  112.  
  113.     }
  114.     void GridView1_RowUpdated(Object sender, GridViewUpdateEventArgs e)
  115.     {
  116.         //Retrieve the row being edited.
  117.         int index = GridView1.EditIndex;
  118.         GridViewRow row = GridView1.Rows[index];
  119.  
  120.         // Retrieve the value of the first cell
  121.         lblDdlCheck.Text = "Updated record" + row.Cells[1].Text;
  122.     }
  123.  
  124.     protected void GridView1_SelectedIndexChanged2(object sender, EventArgs e)
  125.     {
  126.  
  127.     }
  128. }
Oct 8 '08 #1
1 1423
DrBunchman
979 Recognized Expert Contributor
Hi nithy,

Welcome to Bytes.com! I hope you find the site useful.

You've posted your question in the ASP Forum which is for Classic ASP only - I've moved it for you but in future please post all ASP.NET questions in the .NET Forum.

Please don't forget to wrap your code in CODE tags - it makes your posts much easier to read - and please read the Posting Guidelines if you have not done so already.

Furthermore, what is the actual problem you are having? Are you receiving any errors? The experts here won't write your code for you but we can help you with specific problems that you are having.

Dr B
Oct 8 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

28
by: Me | last post by:
I would like to redesign my existing site into php using classes. I am not the most experienced developer with PHP, and would like to know if anyone can give me some input on a starting point for a...
0
by: M.sajjad | last post by:
Five Steps to Rapid Development with TierDeveloper 3.0 Unlock the power of rapid development when you use TierDeveloper from AlachiSoft in your N-Tier application development. Follow the steps...
1
by: athos | last post by:
Hi all, Believe you have sound experience in development, however, if we look at the whole Software Development Life Cycle (SDLC) of the project, say, 1. Project Initiation, 2. Gathering...
3
by: Henry Reardon | last post by:
Can someone remind me how to re-install the Development Center? I was playing with the Environment Settings a bit the other day and, ever since, it hasn't worked right. I can create a new Project...
1
by: Henry Reardon | last post by:
I have been having problems with the Development Center for several days now. It seemed to be working fine when I initially installed DB2 (LUW) Version 8 (FP7) and upgraded to FP8, except that I...
6
by: Klaus Jensen | last post by:
Hi! I have a pretty traditional setup where I develop on my local PC and the use "Copy Project" to deploy to the production enviroment.. In web.config I need different values for...
5
by: Schoo | last post by:
I have been working on an ASP.NET (with VB.NET code behind) on my development workstation. Things have been going well and I have been posting changes to the project to a development server...
16
by: Linus | last post by:
Being a ASP developer for a consultant company thinking of starting developing with ASP.NET I have read literally hundreds of web pages and posts in discussion forums on the Internet to get an idea...
4
by: Richard Levasseur | last post by:
(Forewarning, most of these problems and solutions come from being the only developer in a 1 server department with no budget, few resources, unresponsive IT, and non-technical managers, so thats...
8
by: situ | last post by:
Hello all, i have Database1 and database2, is it possible to make database connection to database2 by running stored procedure on database1. Thanks and Regards Situ
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.